List of usage examples for java.util UUID toString
public String toString()
From source file:com.coffeebeans.persistence.domain.model.base.DomainObject.java
public DomainObject(UUID uuid) { Assert.notNull(uuid, "UUID is required"); this.uuid = uuid.toString(); this.insertDate = new Date(); }
From source file:com.baasbox.controllers.Admin.java
/** * /admin/db/import (POST)/*from w ww . jav a2 s .co m*/ * * the method allows to upload a json export file and apply it to the db. * WARNING: all data on the db will be wiped out before importing * * @return a 200 Status code when the import is successfull,a 500 status code otherwise */ public static Result importDb() { String appcode = (String) ctx().args.get("appcode"); if (appcode == null || StringUtils.isEmpty(appcode.trim())) { unauthorized("appcode can not be null"); } MultipartFormData body = request().body().asMultipartFormData(); if (body == null) return badRequest("missing data: is the body multipart/form-data?"); FilePart fp = body.getFile("file"); if (fp != null) { ZipInputStream zis = null; try { java.io.File multipartFile = fp.getFile(); java.util.UUID uuid = java.util.UUID.randomUUID(); File zipFile = File.createTempFile(uuid.toString(), ".zip"); FileUtils.copyFile(multipartFile, zipFile); zis = new ZipInputStream(new FileInputStream(zipFile)); DbManagerService.importDb(appcode, zis); zipFile.delete(); return ok(); } catch (org.apache.xmlbeans.impl.piccolo.io.FileFormatException e) { BaasBoxLogger.warn(ExceptionUtils.getMessage(e)); return badRequest(ExceptionUtils.getMessage(e)); } catch (Exception e) { BaasBoxLogger.error(ExceptionUtils.getStackTrace(e)); return internalServerError(ExceptionUtils.getStackTrace(e)); } finally { try { if (zis != null) { zis.close(); } } catch (IOException e) { // Nothing to do here } } } else { return badRequest("The form was submitted without a multipart file field."); } }
From source file:com.ryan.ryanreader.fragments.CommentListingFragment.java
public static CommentListingFragment newInstance(final String parentPostIdAndType, final URI url, final UUID session, final CacheRequest.DownloadType downloadType) { final CommentListingFragment f = new CommentListingFragment(); final Bundle bundle = new Bundle(4); bundle.putString("parentPostIdAndType", parentPostIdAndType); bundle.putString("url", url.toString()); if (session != null) bundle.putString("session", session.toString()); bundle.putString("downloadType", downloadType.name()); f.setArguments(bundle);/* ww w . j a v a 2 s . c o m*/ return f; }
From source file:org.trustedanalytics.serviceexposer.keyvaluestore.RedisCredentialsStore.java
@Override public void delete(String serviceType, UUID serviceInstanceGuid) { hashOps.delete(serviceType, serviceInstanceGuid.toString()); LOG.info("redis entry deleted: " + serviceInstanceGuid); }
From source file:gr.upatras.ece.nam.baker.InstalledServiceTest.java
@Test public void testSetUuid() { InstalledBun is = installedServiceInit(); UUID uuid = UUID.randomUUID(); is.setUuid(uuid.toString()); assertEquals(uuid.toString(), is.getUuid()); }
From source file:org.trustedanalytics.serviceexposer.keyvaluestore.RedisCredentialsStore.java
@Override public T get(String serviceType, UUID serviceInstanceGuid) { return hashOps.get(serviceType, serviceInstanceGuid.toString()); }
From source file:org.trustedanalytics.serviceexposer.keyvaluestore.RedisCredentialsStore.java
@Override public void put(String serviceType, UUID serviceInstanceGuid, T code) { hashOps.put(serviceType, serviceInstanceGuid.toString(), code); LOG.info("redis entry saved: " + serviceInstanceGuid); }
From source file:org.noorganization.instalist.comm.message.TagInfo.java
public void setUUID(UUID _uuid) { setUUID(_uuid != null ? _uuid.toString() : null); }
From source file:com.consol.citrus.samples.todolist.TodoListIT.java
@Test @CitrusTest//from w w w. j a va 2 s .co m public void testObjectMapping() { final UUID uuid = UUID.randomUUID(); variable("todoId", uuid.toString()); variable("todoName", "citrus:concat('todo_', citrus:randomNumber(4))"); variable("todoDescription", "Description: ${todoName}"); http().client(todoClient).send().post("/todolist").contentType("application/json") .payload(new TodoEntry(uuid, "${todoName}", "${todoDescription}"), objectMapper); http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT) .payload("${todoId}"); http().client(todoClient).send().get("/todo/${todoId}").accept("application/json"); http().client(todoClient).receive().response(HttpStatus.OK) .validationCallback(new JsonMappingValidationCallback<TodoEntry>(TodoEntry.class, objectMapper) { @Override public void validate(TodoEntry todoEntry, Map<String, Object> headers, TestContext context) { Assert.assertNotNull(todoEntry); Assert.assertEquals(todoEntry.getId(), uuid); } }); }
From source file:com.joyent.manta.http.RequestIdInterceptor.java
@Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { final UUID id = TIME_BASED_GENERATOR.generate(); final String requestId = id.toString(); final Header idHeader = new BasicHeader(MantaHttpHeaders.REQUEST_ID, requestId); request.addHeader(idHeader);/*from ww w . j a v a 2 s. c o m*/ MDC.put(MDC_REQUEST_ID_STRING, requestId); }