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.azaptree.services.domain.entity.impl.DomainEntityAuditLogRecord.java

public DomainEntityAuditLogRecord(final Entity entity, final AuditAction auditAction) {
    Assert.notNull(entity, "entity is required");
    Assert.notNull(auditAction, "auditAction is required");
    setEntityId(UUID.randomUUID());
    setEntityAuditlogRecordCreatedOn(System.currentTimeMillis());
    setAuditedEntityId(entity.getEntityId());
    setAuditAction(auditAction);/*from w  w w . j av  a2  s  .c  o  m*/
    setEntityType(entity.getClass().getName());
    setEntityJson(entity.toJson());
}

From source file:com.streamsets.datacollector.io.TestDataStore.java

private File createTestDir() {
    File dir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(dir.mkdirs());//from   w  ww. j  a  v  a  2s.c o  m
    return dir;
}

From source file:fi.ilmoeuro.membertrack.person.Person.java

@SuppressWarnings("deprecation")
public Person(String firstName, String lastName, String email) {
    this(null, UUID.randomUUID(), firstName, lastName, email);
}

From source file:com.adobe.api.platform.msc.RequestIdFilter.java

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {

    String requestId = requestContext.getHeaderString("X-Request-Id");

    if (StringUtils.isEmpty(requestId)) {
        requestId = UUID.randomUUID().toString();
    }//from ww w .  j  a  v a  2s . c o  m

    MDC.put(REQUEST_ID, requestId);
}

From source file:de.flapdoodle.embedmongo.Files.java

public static File createTempDir(String prefix) throws IOException {
    File tempDir = new File(System.getProperty("java.io.tmpdir"));
    File tempFile = new File(tempDir, prefix + "-" + UUID.randomUUID().toString());
    if (!tempFile.mkdir())
        throw new IOException("Could not create Tempdir: " + tempFile);
    return tempFile;
}

From source file:nu.yona.server.messaging.entities.MessageSource.java

public static MessageSource createInstance() {
    KeyPair pair = PublicKeyUtil.generateKeyPair();

    MessageDestination messageDestination = MessageDestination.createInstance(pair.getPublic());
    return new MessageSource(UUID.randomUUID(), pair.getPrivate(), messageDestination);
}

From source file:com.marklogic.samplestack.impl.AbstractMarkLogicDataService.java

protected String generateUri(SamplestackType type) {
    return type.directoryName() + UUID.randomUUID() + ".json";
}

From source file:works.bill.service.UserManager.java

public User createUser(UserRegistration userRegistration) {
    User user = new User();
    user.setUsername(userRegistration.getUsername());
    user.setPassword(new BCryptPasswordEncoder().encode(userRegistration.getPassword()));
    user.setActivationHash(UUID.randomUUID().toString());
    user.setActivated(false);//w  w w  .ja  v  a 2s  . co  m
    user = userRepository.save(user);
    return user;
}

From source file:com.elasticbox.jenkins.k8s.plugin.builders.DeleteChartBuildStep.java

@DataBoundConstructor
public DeleteChartBuildStep(String id, String kubeName, String chartsRepo, String chartName) {
    super();/*w w  w .j  a  v  a  2  s.c o  m*/
    this.id = StringUtils.isNotEmpty(id) ? id : NAME_PREFIX + UUID.randomUUID().toString();
    this.kubeName = kubeName;
    this.chartsRepo = chartsRepo;
    this.chartName = chartName;
    injectMembers();
}

From source file:org.openmastery.publisher.resources.UserResource.java

/**
 * Create a new user API-Key based on the specified email.
 * @exclude/*ww w  . j a  v a  2s . co  m*/
 * @param userEmail a unique email account
 * @return API-Key
 */
@POST
public String createUser(@QueryParam("email") String userEmail) {

    UserEntity user = UserEntity.builder().email(userEmail).apiKey(UUID.randomUUID().toString()).build();
    userRepository.save(user);

    return user.getApiKey() + "\n";
}