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:io.gravitee.management.service.impl.UUIDApiKeyGenerator.java

@Override
public String generate() {
    return UUID.randomUUID().toString();
}

From source file:com.qycloud.oatos.license.utils.LicenseUtil.java

public void toXml(License license, File file) throws Exception {
    FileOutputStream out = null;/*from  ww  w. j  a  v a 2  s . c  o  m*/
    try {
        String sha = sha(license);
        String[] uuids = UUID.randomUUID().toString().split("-");
        StringBuilder sign = new StringBuilder(sha);
        for (int i = 0; i < 5; i++) {
            sign.setCharAt(chars[i], uuids[i].charAt(0));
        }

        license.setSignature(sign.toString());
        out = new FileOutputStream(file);
        xstream.toXML(license, out);
    } finally {
        try {
            if (out != null) {
                out.close();
            }
        } catch (Exception ex) {
        }
    }
}

From source file:org.trustedanalytics.user.common.UaaProblemReaderTest.java

@Test
public void test_read() {
    UUID userId = UUID.randomUUID();
    HttpClientErrorException exception = TestUtils.createDummyHttpClientException(userId);
    UaaProblem expectedError = new UaaProblem("Username already in use: test@example.com",
            "scim_resource_already_exists", userId.toString());
    Assert.assertThat(UaaProblemReader.read(exception), CoreMatchers.equalTo(expectedError));
}

From source file:com.organization.automation.project.utility.DataGenerator.java

public String getRandomUUID() {
    return UUID.randomUUID().toString();
}

From source file:eu.codesketch.adam.rest.domain.model.SwarmId.java

/**
 * Create an new swarm identifier using a random UUID
 *
 * @return a new {@link SwarmId} instance.
 *//*w  w w . j  a  v a 2  s  . c o  m*/
public static SwarmId newSwarmId() {
    return new SwarmId(UUID.randomUUID().toString());
}

From source file:com.sqewd.os.maracache.mdfs.VersionUtils.java

public static long next(long current) throws NoSuchAlgorithmException, UnsupportedEncodingException {
    while (true) {
        UUID uuid = UUID.randomUUID();

        char[] buff = uuid.toString().toCharArray();
        long v = System.currentTimeMillis();

        for (int ii = 0; ii < buff.length; ii++) {
            v += (buff[ii] * (ii + iphash));
        }/* w w w  .j ava2 s  . c  om*/

        if (v != current) {
            return v;
        }
    }
}

From source file:us.swcraft.springframework.cache.aerospike.usage.spring.SomeCacheableService.java

@Override
@Cacheable(cacheManager = "aerospikeCacheManager", value = "ITUUID")
public String getDescription(Integer id) {
    return new StringBuilder().append(id).append(":").append(UUID.randomUUID()).toString();
}

From source file:com.mvdb.scratch.HadoopClientTest.java

private static void createDataFile(String dataFileName) {
    int numOfLines = 20;
    String baseStr = "....Test...";
    List<String> lines = new ArrayList<String>();
    for (int i = 0; i < numOfLines; i++)
        lines.add(i + baseStr + UUID.randomUUID());

    File dataFile = new File(dataFileName);
    try {//from  w w  w .  j  a  v a 2  s .co  m
        FileUtils.writeLines(dataFile, lines, true);
        Thread.sleep(2000);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:com.thistech.spotlink.model.BasicTrackingEvents.java

public BasicTrackingEvents() {
    setId(UUID.randomUUID().toString());
}

From source file:de.kaiserpfalzEdv.office.ui.web.widgets.menu.AbstractMenuEvent.java

public AbstractMenuEvent(final UUID id) {
    super(UUID.randomUUID());
}