Example usage for java.util UUID randomUUID

List of usage examples for java.util UUID randomUUID

Introduction

In this page you can find the example usage for java.util UUID randomUUID.

Prototype

public static UUID randomUUID() 

Source Link

Document

Static factory to retrieve a type 4 (pseudo randomly generated) UUID.

Usage

From source file:se.vgregion.mobile.types.ErrorReport.java

public ErrorReport(Printer printer, PrinterQueue queue, String reporter, String description) {
    Assert.notNull(printer);/*from   ww w.jav a 2 s. c o m*/
    Assert.hasText(description);

    this.id = UUID.randomUUID();
    this.printer = printer;
    this.queue = queue;
    this.reporter = reporter;
    this.description = description;
}

From source file:com.parse.ParseOperationSet.java

/**
 * Creates a new operation set with a random UUID.
 */
public ParseOperationSet() {
    this(UUID.randomUUID().toString());
}

From source file:net.anthonychaves.bookmarks.web.ApiKeyController.java

@RequestMapping(method = RequestMethod.POST)
public String generateApiKey(HttpSession session, ModelMap model) {
    User user = (User) session.getAttribute("user");
    String apiKey = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 16).toUpperCase();
    user = userService.setApiKey(user, apiKey);
    session.setAttribute("user", user);

    model.addAttribute("status", "success");
    model.addAttribute("newKey", apiKey);

    return "redirect:user";
}

From source file:com.flipkart.foxtrot.core.MockElasticsearchServer.java

public MockElasticsearchServer(String directory) {
    this.DATA_DIRECTORY = UUID.randomUUID().toString() + "/" + directory;
    ImmutableSettings.Builder elasticsearchSettings = ImmutableSettings.settingsBuilder()
            .put("http.enabled", "false").put("path.data", "target/" + DATA_DIRECTORY);

    node = nodeBuilder().local(true).settings(elasticsearchSettings.build()).node();
}

From source file:com.talis.storage.s3.S3ObjectFactoryTest.java

@Before
public void setup() {
    bucketname = UUID.randomUUID().toString();
    factory = new S3ObjectFactory(bucketname);
    buffer = ByteBuffer.allocate(1024);
    buffer.put(entity);/* w w  w.  jav a 2  s .c  om*/
}

From source file:com.fusesource.forge.jmstest.probe.AbstractProbe.java

public AbstractProbe() {
    this("Probe-" + UUID.randomUUID().toString());
}

From source file:eu.freme.broker.security.TokenService.java

public Token generateNewToken(User user) {
    Token token = new Token(UUID.randomUUID().toString(), user);
    token = tokenRepository.save(token);
    return token;
}

From source file:com.streamsets.pipeline.stage.origin.spooldir.TestSpoolDirWithCompression.java

@BeforeClass
public static void setUpClass()
        throws IOException, InterruptedException, URISyntaxException, CompressorException {
    testDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(testDir.mkdirs());
    Files.copy(Paths.get(Resources.getResource("logArchive.zip").toURI()),
            Paths.get(testDir.getAbsolutePath(), "logArchive1.zip"));
    Files.copy(Paths.get(Resources.getResource("logArchive.zip").toURI()),
            Paths.get(testDir.getAbsolutePath(), "logArchive2.zip"));
    Files.copy(Paths.get(Resources.getResource("logArchive.tar.gz").toURI()),
            Paths.get(testDir.getAbsolutePath(), "logArchive1.tar.gz"));
    Files.copy(Paths.get(Resources.getResource("logArchive.tar.gz").toURI()),
            Paths.get(testDir.getAbsolutePath(), "logArchive2.tar.gz"));
    Files.copy(Paths.get(Resources.getResource("testAvro.tar.gz").toURI()),
            Paths.get(testDir.getAbsolutePath(), "testAvro1.tar.gz"));
    Files.copy(Paths.get(Resources.getResource("testAvro.tar.gz").toURI()),
            Paths.get(testDir.getAbsolutePath(), "testAvro2.tar.gz"));

    File bz2File = new File(testDir, "testFile1.bz2");
    CompressorOutputStream bzip2 = new CompressorStreamFactory().createCompressorOutputStream("bzip2",
            new FileOutputStream(bz2File));
    bzip2.write(IOUtils.toByteArray(Resources.getResource("testLogFile.txt").openStream()));
    bzip2.close();//from  w  ww.  j a v a  2 s  . co  m

    bz2File = new File(testDir, "testFile2.bz2");
    bzip2 = new CompressorStreamFactory().createCompressorOutputStream("bzip2", new FileOutputStream(bz2File));
    bzip2.write(IOUtils.toByteArray(Resources.getResource("testLogFile.txt").openStream()));
    bzip2.close();
}

From source file:com.migo.oss.CloudStorageService.java

/**
 * /*from  w  w  w  . j  a v  a2  s .co m*/
 * @param prefix ?
 * @return 
 */
public String getPath(String prefix) {
    //?uuid
    String uuid = UUID.randomUUID().toString().replaceAll("-", "");
    //
    String path = DateUtils.format(new Date(), "yyyyMMdd") + "/" + uuid;

    if (StringUtils.isNotBlank(prefix)) {
        path = prefix + "/" + path;
    }

    return path;
}

From source file:org.opensafety.hishare.model.factories.ParcelFactory.java

private String createParcelId() {
    return UUID.randomUUID().toString();
}