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:com.xiaoke.common.util.EncryptionUtil.java

/** 
  * UUID //from w ww .  j av  a  2  s  . co  m
  * @return String UUID 
  */
public static String getUUID() {
    String s = UUID.randomUUID().toString();
    //-?? 
    return s.replace("-", "");
}

From source file:com.quartz.monitor.util.Tools.java

public static String generateUUID() {
    UUID id = UUID.randomUUID();
    return id.toString();
}

From source file:ch.systemsx.cisd.openbis.generic.shared.util.UuidUtil.java

/** generates canonical string representation of the random UUID */
public static final String generateUUID() {
    return CodeConverter.tryToDatabase(UUID.randomUUID().toString());
}

From source file:com.yonyou.dms.function.utils.common.StringUtils.java

public static UUID getRandomUUID() {
    return UUID.randomUUID();
}

From source file:de.softwareforge.streamery.StreameryMain.java

public static final DBI getH2Dbi() {
    final JdbcDataSource ds = new JdbcDataSource();
    ds.setURL(format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1", UUID.randomUUID()));
    return new DBI(ds);
}

From source file:com.daimler.spm.storefront.util.CSRFTokenManager.java

/**
 * Generates a new token.
 *
 * @return The new token.
 */
protected static String generateToken() {
    return UUID.randomUUID().toString();
}

From source file:com.networknt.utility.Util.java

/**
 * Generate UUID across the entire app and it is used for correlationId.
 *
 * @return String correlationId/*from   www . j  av  a2 s  .  co m*/
 */
public static String getUUID() {
    UUID id = UUID.randomUUID();
    ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
    bb.putLong(id.getMostSignificantBits());
    bb.putLong(id.getLeastSignificantBits());
    return Base64.encodeBase64URLSafeString(bb.array());
}

From source file:org.opendatakit.utilities.LocalizationUtils.java

public static String genUUID() {
    return "uuid:" + UUID.randomUUID();
}

From source file:nz.gate5a.schoolstories.importer.NceaQualificationCreator.java

@Override
public SchoolNceaQualifications create(String[] fields) {
    try {/*from  w  w w  . jav a2s  .c  o m*/
        SchoolNceaQualifications school = new SchoolNceaQualifications();

        school.setId(UUID.randomUUID().toString());
        school.setAcademicYear(integer(fields[0]));
        school.setDecile(integer(trimmed(fields[1])));
        school.setRegion(fields[2]);
        school.setSchool(fields[3]);
        school.setYearLevel(integer(fields[4]));

        school.setQualification(fields[5]);
        school.setCurrentYearAchievementRateParticipation(bigDecimal(fields[6]));
        school.setCumulativeAchievementRateParticipation(bigDecimal(fields[7]));
        school.setCurrentYearAchievementRateRoll(bigDecimal(fields[8]));
        school.setCumulativeAchievementRateRoll(bigDecimal(fields[9]));
        school.setCohortWarning(fields[10]);

        return school;
    } catch (RuntimeException e) {
        throw new RuntimeException("Failed to parse school " + fields[0] + " " + fields[1], e);
    }
}

From source file:instamo.MapReduceExample.java

public static void run(String instanceName, String zookeepers, String rootPassword, String args[])
        throws Exception {

    // run continuous ingest to create data. This is not a map reduce job
    ContinuousIngest.main(new String[] { "-i", instanceName, "-z", zookeepers, "-u", "root", "-p", rootPassword,
            "--table", "ci", "--num", "5000000", "--batchMemory", "1000000" });

    String outputDir = FileUtils.getTempDirectoryPath() + File.separator + "ci_verify"
            + UUID.randomUUID().toString();

    try {//ww w . ja  v a  2 s. c  o m
        // run verify map reduce job locally. This jobs looks for holes in the linked list create by continuous ingest
        ContinuousVerify.main(new String[] { "-D", "mapred.job.tracker=local", "-D", "fs.default.name=file:///",
                "-i", instanceName, "-z", zookeepers, "-u", "root", "-p", rootPassword, "--table", "ci",
                "--output", outputDir, "--maxMappers", "4", "--reducers", "1" });
    } finally {
        // delete output dir of mapreduce job
        FileUtils.deleteQuietly(new File(outputDir));
    }
}