List of usage examples for java.util UUID randomUUID
public static UUID randomUUID()
From source file:net.sourceforge.fenixedu.domain.phd.candidacy.PhdProgramPublicCandidacyHashCode.java
@Atomic static private PhdProgramPublicCandidacyHashCode create(final String email) { final PhdProgramPublicCandidacyHashCode hash = new PhdProgramPublicCandidacyHashCode(); hash.setEmail(email);/* ww w . j a va 2 s . co m*/ hash.setValue(UUID.randomUUID().toString()); /* Disable alerts */ // new PublicPhdMissingCandidacyAlert(hash); return hash; }
From source file:com.cloudmine.api.rest.ResponseTimeDataStoreTest.java
private HttpResponse fakeResponse() { HttpResponse response = new BasicHttpResponse(null); response.setHeader(HeaderFactory.REQUEST_ID_KEY, UUID.randomUUID().toString()); return response; }
From source file:com.keetip.versio.domain.Release.java
/** * Construct a new transient Release entity * /*w w w . j av a2s. co m*/ * @param project * @param name * @param revision * @return */ public static Release newRelase(Project project, String name, Revision revision) { return new Release(project, UUID.randomUUID(), name, revision); }
From source file:com.finedo.base.utils.upload.FileUploadUtils.java
public static final List<FileInfo> saveFiles(String uploadDir, List<FileItem> list) { List filelist = new ArrayList(); if (list == null) { return filelist; }/* w w w.jav a 2 s . c om*/ File dir = new File(uploadDir); if (!(dir.isDirectory())) { dir.mkdirs(); } String uploadPath = uploadDir; DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding("utf-8"); Iterator it = list.iterator(); String name = ""; String extName = ""; while (it.hasNext()) { FileItem item = (FileItem) it.next(); if (!(item.isFormField())) { name = item.getName(); logger.info("saveFiles name=============" + name); if (name == null) continue; if (name.trim().equals("")) { continue; } if (name.lastIndexOf(".") >= 0) { extName = name.substring(name.lastIndexOf(".")); } File file = null; do { name = UUID.randomUUID().toString(); file = new File(uploadPath + name + extName); } while (file.exists()); File saveFile = new File(uploadPath + name + extName); try { item.write(saveFile); } catch (Exception e) { e.printStackTrace(); } String fileName = item.getName().replace("\\", "/"); String[] ss = fileName.split("/"); fileName = trimExtension(ss[(ss.length - 1)]); FileInfo fileinfo = new FileInfo(); fileinfo.setName(fileName); fileinfo.setUname(name); fileinfo.setFilePath(uploadDir); fileinfo.setFileExt(extName); fileinfo.setSize(String.valueOf(item.getSize())); fileinfo.setContentType(item.getContentType()); fileinfo.setFieldname(item.getFieldName()); filelist.add(fileinfo); } } return filelist; }
From source file:com.mirth.connect.model.ResourceProperties.java
public ResourceProperties(String pluginPointName, String type) { this.pluginPointName = pluginPointName; this.type = type; this.id = UUID.randomUUID().toString(); }
From source file:io.github.msurdi.redeye.api.Entry.java
@Builder @JsonCreator public Entry(@JsonProperty("id") String id) { this.id = (id != null ? id : UUID.randomUUID().toString()); }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaFileDownloader.java
public void downloadFile(Resource resource) { String resourceId = DOWNLOAD_RESOURCE_PREFIX + UUID.randomUUID().toString(); setResource(resourceId, resource);//from w w w . j a v a2 s . c o m getRpcProxy(CubaFileDownloaderClientRPC.class).downloadFile(resourceId); }
From source file:com.allogy.couch.importers.command.BufferedImportCommandTest.java
@Before public void setUp() { innerImportCommand = mock(ImportCommand.class); innerDataStream = UUID.randomUUID().toString(); stub(innerImportCommand.getDataStream()).toReturn(IOUtils.toInputStream(innerDataStream)); }
From source file:com.here.account.util.JsonSerializerTest.java
License:asdf
@Test public void test_pojo_extensible() throws JsonParseException, JsonMappingException, IOException { String arbitraryProperty = "prop" + UUID.randomUUID(); String accessToken = "at" + UUID.randomUUID(); String json = "{\"access_token\":\"" + accessToken + "\",\"expires_in\":123,\"" + arbitraryProperty + "\":\"asdf\"}"; InputStream jsonInputStream = new ByteArrayInputStream(json.getBytes(JsonSerializer.CHARSET)); AccessTokenResponse accessTokenResponse = JsonSerializer.toPojo(jsonInputStream, AccessTokenResponse.class); assertTrue("accessTokenResponse was null", null != accessTokenResponse); String actualAccessToken = accessTokenResponse.getAccessToken(); assertTrue("expected accessToken " + accessToken + ", actual " + actualAccessToken, accessToken.equals(actualAccessToken)); }
From source file:com.cloudant.sync.util.TestUtils.java
public static String createTempTestingDir(String dirPrefix) { String tempPath = String.format("%s_%s", dirPrefix, UUID.randomUUID().toString()); File f = new File(FileUtils.getTempDirectory().getAbsolutePath(), tempPath); f.mkdirs();//from ww w . ja v a 2 s . co m return f.getAbsolutePath(); }