Example usage for java.util UUID toString

List of usage examples for java.util UUID toString

Introduction

In this page you can find the example usage for java.util UUID toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this UUID .

Usage

From source file:com.facebook.presto.rakam.S3BackupStore.java

@Override
public boolean deleteShard(UUID uuid) {
    try {/*from  ww w . java  2 s  . c  o  m*/
        s3Client.deleteObject(config.getS3Bucket(), uuid.toString());
        return true;
    } catch (Exception e) {
        throw new PrestoException(RAPTOR_BACKUP_ERROR, "Failed to delete S3 backup: " + uuid, e);
    }
}

From source file:com.huawei.streaming.cql.executor.mergeuserdefinds.Merger.java

private void createTmpDir(String tmpDir) throws IOException {
    UUID uuid = UUID.randomUUID();
    String dirName = uuid.toString().replace("-", "");
    File baseDir = new File(tmpDir);
    tmpOutputDir = new File(baseDir, dirName);
    tmpJarUnzipDir = new File(tmpOutputDir, JAR_UNZIP_DIR_NAME);
    if (!tmpJarUnzipDir.mkdirs()) {
        LOG.error("failed to create tmp dir");
        throw new IOException("failed to create tmp dir");
    }/*from w  w  w.  ja  v  a2  s  .c o  m*/
}

From source file:de.kaiserpfalzEdv.commons.jee.spring.ServiceLogging.java

/**
 * Retrieves the first UUID from argument list.
 *
 * @param joinPoint The join point information
 * @return a string containing the UUID.
 * @throws NullPointerException if no argument contained an UUID.
 *//*from  w w w . ja  v  a 2  s  .  co  m*/
private String retrieveUUIDFromArguments(ProceedingJoinPoint joinPoint) throws NullPointerException {
    for (Object arg : joinPoint.getArgs()) {
        if (arg != null && arg.getClass().equals(UUID.class)) {
            UUID result = (UUID) arg;

            return result.toString();
        }
    }

    throw new NullPointerException("There is no UUID in the argument list of this joinPoint!");
}

From source file:com.splunk.shuttl.archiver.filesystem.glacier.FakeArchiveTransferManager.java

@Override
public UploadResult upload(String accountId, String vaultName, String archiveDescription, File file)
        throws AmazonServiceException, AmazonClientException, FileNotFoundException {
    copyFileToManagedDirectory(file);//w ww .j a va2  s . co m
    UUID uuid = storeUuidForFile(file);
    return new UploadResult(uuid.toString());
}

From source file:net.maurerit.dao.DeckDaoTest.java

@Test
public void saveAndRetrieveADeck() {
    Deck deck = new Deck();
    UUID id = UUID.randomUUID();
    deck.setId(id.toString());
    deck.setName("Name");
    deck.setAuthor("Author");
    deck.setFormat("Format");
    deck.setLocation("Location");

    Card card = cardDao.read(new CardPK("Card", "M12"));

    if (card == null) {
        card = new Card();
        card.setCardNumber(1);/*  ww w  .j a v a2 s .  c  o m*/
        card.setExpansionSetCode("M12");
        card.setFaceDown(false);
        card.setName("Card");
        card.setNightCard(false);
        card.setPower(1);
        card.setRarity(Rarity.COMMON);
        card.setToughness(1);

        cardDao.create(card);
    }

    deck.getMainBoardCards().add(card);

    deckDao.create(deck);

    em.flush();

    String query = "select count(*) from Deck where id = '" + id.toString() + "'";
    int count = simpleJdbcTemplate.queryForInt(query);
    assertEquals("Deck with id=" + id.toString() + " should exist.", 1, count);

    String cardQuery = "select count(*) from Card where name='Card' and expansionSetCode='M12'";
    count = simpleJdbcTemplate.queryForInt(cardQuery);
    assertEquals("Card with name='Card' and expansionSetCode='M12' should exist.", 1, count);

    Deck retrievedDeck = deckDao.read(id.toString());
    assertEquals("Deck mainboard should have one card.", 1, retrievedDeck.getMainBoardCards().size());
}

From source file:org.trustedanalytics.users.orgs.OrgsControllerTest.java

@Test
public void deleteOrg_positive() {
    UUID orgId = UUID.randomUUID();
    sut.deleteOrg(orgId.toString());
    verify(cfClient).deleteOrg(orgId);
}

From source file:com.nesscomputing.jackson.datatype.TestCustomUuidModule.java

@Test
public void testCustomUUIDSerialization() throws Exception {
    final AtomicBoolean called = new AtomicBoolean(false);
    ObjectMapper mapper = getObjectMapper(new AbstractModule() {
        @Override//www  . ja v  a 2  s  . c o m
        protected void configure() {
            bind(new TypeLiteral<JsonSerializer<UUID>>() {
            }).toInstance(new CustomUuidSerializer() {
                @Override
                public void serialize(UUID value, JsonGenerator jgen, SerializerProvider provider)
                        throws IOException, JsonGenerationException {
                    called.set(true);
                    super.serialize(value, jgen, provider);
                }
            });
        }
    });
    final UUID id = new UUID(9, 9);
    Assert.assertEquals('"' + id.toString() + '"', mapper.writeValueAsString(id));
    Assert.assertTrue(called.get());
}

From source file:org.noorganization.instalist.comm.message.ListInfo.java

public ListInfo withCategoryUUID(UUID uuid) {
    setCategoryUUID(uuid.toString());
    return this;
}

From source file:org.noorganization.instalist.comm.message.TaggedProductInfo.java

public void setUUID(UUID _uuid) {
    mUUID = _uuid != null ? _uuid.toString() : null;
}

From source file:io.pivotal.pde.demo.tracker.gemfire.CheckInEditor.java

public void save() {
    UUID newid = UUID.randomUUID();
    CheckIn c = new CheckIn();
    c.setId(newid.toString());
    c.setPlate(plate.getValue());/*from w w  w  . jav a  2 s.com*/
    c.setCity(location.getValue());
    c.setTimestamp(new Date());
    repository.save(c);

    if (changeHandler != null)
        changeHandler.onChange();
}