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:us.swcraft.springframework.cache.aerospike.usage.spring.SomeCacheableService.java

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

From source file:jp.pigumer.job.IntervalJob.java

@Scheduled(fixedDelay = 5000)
public void job() {
    log.info("job");
    try {//from w w  w  .jav a2s  .  c  om
        client.getClient().publish("test", new MqttMessage(UUID.randomUUID().toString().getBytes()));
    } catch (MqttException e) {
        log.warn("publish", e);
    }
}

From source file:com.amazonaws.serverless.sample.spring.PetsController.java

@RequestMapping(path = "/pets", method = RequestMethod.POST)
public Pet createPet(@RequestBody Pet newPet) {
    if (newPet.getName() == null || newPet.getBreed() == null) {
        return null;
    }/*from w  ww . j  ava2  s.com*/

    Pet dbPet = newPet;
    dbPet.setId(UUID.randomUUID().toString());
    return dbPet;
}

From source file:upgrade.core_1_DOT_0_DOT_0.java

private void doCoreSetup() throws ResourceCreationException {

    for (Realm realm : realmRepository.allRealms()) {

        String uuid = UUID.randomUUID().toString();
        if (log.isInfoEnabled()) {
            log.info("Adding uuid " + uuid + " to realm " + realm.getName());
        }//from   w w w. ja v a2 s .  c om
        realm.setUuid(uuid);
        realmRepository.saveRealm(realm);
    }
}

From source file:com.hp.autonomy.frontend.find.core.view.AbstractViewController.java

@ExceptionHandler
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ModelAndView handleGeneralException(final Exception e, final HttpServletRequest request,
        final HttpServletResponse response) {
    response.reset();//from   w  w w. j  a  v a  2 s .  c  o m

    final UUID uuid = UUID.randomUUID();
    log.error("Unhandled exception with uuid {}", uuid);
    log.error("Stack trace", e);

    final Locale locale = Locale.ENGLISH;

    return buildErrorModelAndView(request,
            messageSource.getMessage("error.internalServerErrorMain", null, locale),
            messageSource.getMessage("error.internalServerErrorSub", new Object[] { uuid }, locale));
}

From source file:org.cryptomator.crypto.aes256.LongFilenameMetadata.java

public synchronized UUID getOrCreateUuidForEncryptedFilename(String encryptedFilename) {
    UUID uuid = encryptedFilenames.getKey(encryptedFilename);
    if (uuid == null) {
        uuid = UUID.randomUUID();
        encryptedFilenames.put(uuid, encryptedFilename);
    }//from   ww  w  .  j  a  v  a  2 s  .  c o  m
    return uuid;
}

From source file:com.cubeia.backoffice.wallet.manager.ExternalAccountManagerMockImpl.java

@Override
public String deposit(BigDecimal amount, String externalUserId, long licenseeId) {
    String xid = UUID.randomUUID().toString();
    log.debug("deposit external, amount = " + amount + ", xUId = " + externalUserId + ", licenseeId = "
            + licenseeId + ", xTId = " + xid);
    return xid;//  w w  w. j  a v  a 2  s . co  m
}

From source file:org.trustedanalytics.cloud.cc.UuidJsonDeserializerTest.java

@Test
public void uuidMapping_correctUuid() throws IOException {
    UUID randomUuid = UUID.randomUUID();
    String json = "{\"guid\":\"" + randomUuid + "\"}";

    CcMetadata metadata = objectMapper.readValue(json, CcMetadata.class);
    assertEquals(randomUuid, metadata.getGuid());
}

From source file:de.pawlidi.openaletheia.license.LicenseHandlerTest.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    KeyPair keyPair = CipherUtils.generateKeyPair();
    publicKey = CipherUtils.getPublicKey(keyPair);
    privateKey = CipherUtils.getPrivateKey(keyPair);

    license = new License();
    license.setProduct("License product");
    license.setProductVersion("1.2.0");
    license.setUuid(UUID.randomUUID().toString());
    license.setMaxHost(3L);/*ww  w  .ja  v a 2  s  .  c  o m*/
    license.setAddress(AletheiaUtils.getMacAddress());
    license.setOwner(SystemUtils.USER_NAME);
    license.setOperatingSystem(SystemUtils.OS_NAME);
    license.setCompany("Company abc");
    license.setMaxUser(3L);
    license.setCreated(DateTime.now());
    license.setDescription("License file for license product");
}

From source file:agendapoo.Model.Atividade.java

public Atividade(String descricao, String local, LocalDate data, LocalTime horaInicio, LocalTime horaFim,
        TipoAtividade tipo, Usuario u) {
    id = UUID.randomUUID();
    this.descricao = descricao;
    this.local = local;
    this.data = data;
    this.horaInicio = horaInicio;
    this.horaFim = horaFim;
    convidados = new ArrayList<>();
    this.tipo = tipo;
    this.usuario = u;
}