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.keetip.versio.domain.Project.java

/**
 * Construct a new transient Project entity
 * //from  ww  w .j  a v a2 s  .  c om
 * @return
 */
public static Project newProject(String name) {
    return new Project(UUID.randomUUID(), name);
}

From source file:com.feedzai.fos.api.util.ManagerUtils.java

/**
 * Obtain model UUID from ModelConfig if defined or generate a new random uuid
 *
 * @param config Model Configuration/*from ww w . ja  v  a  2 s.c o  m*/
 * @return new Model UUID
 * @throws com.feedzai.fos.api.FOSException
 */
public static UUID getUuid(ModelConfig config) throws FOSException {
    String suuid = config.getProperty("UUID");

    return StringUtils.isBlank(suuid) ? UUID.randomUUID() : UUID.fromString(suuid);
}

From source file:com.hp.autonomy.hod.client.api.resource.ResourceTest.java

@Test
public void buildsResourceName() {
    final Resource resource = new Resource(UUID.randomUUID(), "resource_name", "domain_name");

    final ResourceName identifier = resource.getResourceName();
    assertThat(identifier.getDomain(), is("domain_name"));
    assertThat(identifier.getName(), is("resource_name"));
}

From source file:com.microsoft.azure.servicebus.samples.duplicatedetection.DuplicateDetection.java

void send(String connectionString) throws Exception {
    IMessageSender sender = ClientFactory.createMessageSenderFromConnectionStringBuilder(
            new ConnectionStringBuilder(connectionString, "DupdetectQueue"));

    String messageId = UUID.randomUUID().toString();
    // Send messages to queue
    System.out.printf("\tSending messages to %s ...\n", sender.getEntityPath());
    IMessage message = new Message();
    message.setMessageId(messageId);/*w  ww .  j a  va 2s  . c om*/
    message.setTimeToLive(Duration.ofMinutes(1));
    sender.send(message);
    System.out.printf("\t=> Sent a message with messageId %s\n", message.getMessageId());

    IMessage message2 = new Message();
    message2.setMessageId(messageId);
    message2.setTimeToLive(Duration.ofMinutes(1));
    sender.send(message2);
    System.out.printf("\t=> Sent a duplicate message with messageId %s\n", message.getMessageId());
    sender.close();
}

From source file:com.egt.core.util.STP.java

public static String getRandomString(int length) {
    String uuid = UUID.randomUUID().toString().toUpperCase().replaceAll("-", "");
    int endIndex = length < 1 || length > uuid.length() ? uuid.length() : length;
    return UUID.randomUUID().toString().toUpperCase().replaceAll("-", "").substring(0, endIndex);
}

From source file:com.sample.serviceImpl.UsersServiceImpl.java

@Override
public void save(Users user) {
    if (user.getId() == null) {
        user.setId(UUID.randomUUID() + "");
    }/*  w  ww  .j av  a2  s . co m*/
    usersRepository.save(user);
}

From source file:eu.impress.repository.util.EDXLlib.java

public static EDXLDistribution createEDXLEnvelope() throws DatatypeConfigurationException {

    List<String> country = new ArrayList<String>();
    List<TargetAreaType> targetArea = new ArrayList<TargetAreaType>();
    TargetAreaType tatype = new TargetAreaType();

    List<ValueSchemeType> explicitAddress = new ArrayList<ValueSchemeType>();
    ValueSchemeType vstype = new ValueSchemeType();
    List<String> explicitAddressValue = new ArrayList<String>();

    List<ContentObjectType> contentObject = new ArrayList<ContentObjectType>();
    ContentObjectType ct = new ContentObjectType();
    XmlContentType xt = new XmlContentType();

    String uuid = UUID.randomUUID().toString();

    EDXLDistribution ed = new EDXLDistribution();
    ed.setDistributionID("impress_dhc_" + uuid); //this must be defined
    ed.setSenderID("urn://impress/dhc/bedavailability");

    //country.add("GR");
    country.add("ME");
    tatype.setCountry(country);// www. jav a2  s . co m
    targetArea.add(tatype);
    ed.setTargetArea(targetArea);

    ed.setDateTimeSent(getXMLGregorianCalendar());
    ed.setDistributionStatus(StatusValues.ACTUAL);
    ed.setDistributionType(TypeValues.REPORT);
    ed.setCombinedConfidentiality("Unclassified");

    vstype.setExplicitAddressScheme("urn");
    //explicitAddressValue.add("urn://agency/keelpno");
    explicitAddressValue.add("urn://me.gov.incimag");
    vstype.setExplicitAddressValue(explicitAddressValue);
    explicitAddress.add(vstype);
    ed.setExplicitAddress(explicitAddress);

    xt.setEmbeddedXMLContent(null);
    ct.setXmlContent(xt);
    contentObject.add(ct);
    ed.setContentObject(contentObject);

    return ed;

}

From source file:com.clican.pluto.orm.desc.PropertyDescription.java

public PropertyDescription() {
    this.id = UUID.randomUUID().toString();
}

From source file:gobblin.scheduler.SchedulerDaemon.java

private static String getAppName(Properties properties) {
    return properties.getProperty(ServiceBasedAppLauncher.APP_NAME, "SchedulerDaemon-" + UUID.randomUUID());
}

From source file:edu.umn.msi.tropix.jobs.activities.factories.TestUtils.java

static <T extends ActivityDescription> T init(final T activityDescription) {
    final JobDescription jobDescription = new JobDescription();
    jobDescription.setName("Job Description");
    jobDescription.setId(UUID.randomUUID().toString());
    activityDescription.setJobDescription(jobDescription);
    activityDescription.setId(UUID.randomUUID().toString());
    return activityDescription;
}