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.vehicles.domain.entities.Car.java

private void init(Color color, int wheels, int steeringWheels) {
    this.id = UUID.randomUUID().toString();
    this.color = color;
    this.wheels = wheels;
    this.steeringWheels = steeringWheels;
}

From source file:com.github.woozoo73.test.dummy.ProcessorImpl.java

private String processInternal(String name) {
    if (name == null) {
        throw new IllegalStateException("name must not be null.");
    }/*from   ww w .  j a  v a  2s  .  c  om*/

    String id = UUID.randomUUID().toString();
    User user = new User(id, name);
    userDao.insert(user);

    try {
        userDao.insertInvalid();
    } catch (Exception e) {
    }

    user = userDao.select(id);

    return "Hello, " + user.getName() + ".";
}

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

public static void setupData(final DBI dbi) {
    final Sql sql = dbi.onDemand(Sql.class);

    sql.createTable();//  w ww.  ja  v  a 2s.com

    for (int i = 0; i < 1000; i++) {
        sql.insertTable(i, UUID.randomUUID().toString());
    }
}

From source file:hoot.services.controllers.info.ErrorLog.java

static String generateExportLog() throws IOException {
    String fileId = UUID.randomUUID().toString();

    AboutResource about = new AboutResource();

    VersionInfo vInfo = about.getCoreVersionInfo();
    String data = System.lineSeparator() + "************ CORE VERSION INFO ***********"
            + System.lineSeparator();
    data += vInfo.toString();//  w  w w. ja  v a 2  s.  co m

    CoreDetail cd = about.getCoreVersionDetail();
    data += System.lineSeparator() + "************ CORE ENVIRONMENT ***********" + System.lineSeparator();

    if (cd != null) {
        data += StringUtils.join(cd.getEnvironmentInfo(), System.lineSeparator());
    }

    data += System.lineSeparator() + "************ SERVICE VERSION INFO ***********" + System.lineSeparator();
    data += about.getServicesVersionInfo().toString();
    data += System.lineSeparator() + "************ CATALINA LOG ***********" + System.lineSeparator();

    // 5MB Max
    int maxSize = 5000000;

    String logStr = getErrorlog(maxSize);

    String outputPath = TEMP_OUTPUT_PATH + File.separator + fileId;
    try (RandomAccessFile raf = new RandomAccessFile(outputPath, "rw")) {
        raf.writeBytes(data + System.lineSeparator() + logStr);
        return outputPath;
    }
}

From source file:com.noorq.casser.test.integration.build.BuildProperties.java

public static String getRandomKeyspace() {
    return "test" + UUID.randomUUID().toString().replace("-", "");
}

From source file:org.obp.DefaultDataInstrument.java

public DefaultDataInstrument(String resourceName) {
    super(UUID.randomUUID().toString(), "defaults", "predefined default data");
    logger.info("init default attributes");
    loadDefaultsFromResource(resourceName);
    setStatus(Status.OPERATIONAL);//  w w  w  .ja va 2  s  .c  o  m
}

From source file:com.netflix.genie.web.data.entities.TagEntityTest.java

/**
 * Make sure the argument constructor sets the tag argument.
 *///  w  w w  .jav a2  s . co  m
@Test
public void canCreateTagEntityWithTag() {
    final String tag = UUID.randomUUID().toString();
    final TagEntity tagEntity = new TagEntity(tag);
    Assert.assertThat(tagEntity.getTag(), Matchers.is(tag));
}

From source file:de.kaiserpfalzEdv.commons.dto.IdentityDTO.java

public IdentityDTO() {
    id = UUID.randomUUID();
}

From source file:com.netflix.genie.web.data.entities.FileEntityTest.java

/**
 * Make sure the argument constructor sets the file argument.
 *///w  ww.j av  a  2 s  .co m
@Test
public void canCreateFileEntityWithFile() {
    final String file = UUID.randomUUID().toString();
    final FileEntity fileEntity = new FileEntity(file);
    Assert.assertThat(fileEntity.getFile(), Matchers.is(file));
}

From source file:com.keetip.versio.domain.Revision.java

/**
 * Construct a new transient Revision entity
 * /*ww w.  j  a  v a 2 s . c o  m*/
 * @param project
 * @param revisionNumber
 * @return
 */
public static Revision newRevision(Project project, Integer revisionNumber) {
    return new Revision(project, UUID.randomUUID(), revisionNumber);
}