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:org.opencredo.couchdb.transformer.CouchDbIdToDocumentTransformerTest.java

@Test
public void transformUuidMessage() throws Exception {
    UUID uuid = UUID.randomUUID();
    DummyDocument document = new DummyDocument("test");
    when(documentOperations.readDocument(eq(uuid.toString()), eq(DummyDocument.class))).thenReturn(document);

    Message<UUID> message = MessageBuilder.withPayload(uuid).build();
    Message<DummyDocument> transformedMessage = (Message<DummyDocument>) transformer.transform(message);

    assertThat(transformedMessage.getPayload(), equalTo(document));
}

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

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

From source file:com.esri.geoportal.harvester.beans.BrokerDefinitionManagerBean.java

@Override
public UUID create(EntityDefinition brokerDef) throws CrudlException {
    UUID id = UUID.randomUUID();
    brokerDef.setRef(id.toString());
    try (Connection connection = dataSource.getConnection();
            PreparedStatement st = connection
                    .prepareStatement("INSERT INTO BROKERS (brokerDefinition,id) VALUES (?,?)");) {
        st.setString(1, serialize(brokerDef));
        st.setString(2, id.toString());// w ww.  j  a v a 2  s  .  c  o m
        st.executeUpdate();
    } catch (SQLException | IOException ex) {
        throw new CrudlException("Error creating broker definition", ex);
    }
    return id;
}

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

@Override
public void restoreShard(java.util.UUID uuid, java.io.File target) {
    try {//from  w  w w. ja v a  2s . c o m
        new TransferManager(s3Client).download(config.getS3Bucket(), uuid.toString(), target)
                .waitForCompletion();
    } catch (InterruptedException e) {
        throw Throwables.propagate(e);
    }
}

From source file:edu.unc.lib.dl.cdr.sword.server.deposit.AtomPubEntryDepositHandler.java

@Override
public DepositReceipt doDeposit(PID destination, Deposit deposit, PackagingType type, SwordConfiguration config,
        String depositor, String owner) throws SwordError {
    log.debug("Preparing to perform an Atom Pub entry metadata only deposit to " + destination.getPid());

    if (deposit.getSwordEntry() == null || deposit.getSwordEntry().getEntry() == null)
        throw new SwordError(UriRegistry.ERROR_CONTENT, 415, "No AtomPub entry was included in the submission");

    if (log.isDebugEnabled()) {
        Abdera abdera = new Abdera();
        Writer writer = abdera.getWriterFactory().getWriter("prettyxml");
        try {/*ww  w  . j a v  a2 s.  c  o m*/
            writer.writeTo(deposit.getSwordEntry().getEntry(), System.out);
        } catch (IOException e) {
            throw new Error(e);
        }
    }

    PID depositPID = null;
    UUID depositUUID = UUID.randomUUID();
    depositPID = new PID("uuid:" + depositUUID.toString());
    File dir = makeNewDepositDirectory(depositPID.getUUID());
    dir.mkdir();

    // write SWORD Atom entry to file
    File atomFile = new File(dir, "atom.xml");
    Abdera abdera = new Abdera();

    try (FileOutputStream fos = new FileOutputStream(atomFile)) {
        Writer writer = abdera.getWriterFactory().getWriter("prettyxml");
        writer.writeTo(deposit.getSwordEntry().getEntry(), fos);
    } catch (IOException e) {
        throw new SwordError(ErrorURIRegistry.INGEST_EXCEPTION, 400,
                "Unable to unpack your deposit: " + deposit.getFilename(), e);
    }

    // write deposit file to data directory
    if (deposit.getFile() != null) {
        File dataDir = new File(dir, "data");
        dataDir.mkdirs();
        File depositFile = new File(dataDir, deposit.getFilename());
        try {
            FileUtils.moveFile(deposit.getFile(), depositFile);
        } catch (IOException e) {
            throw new Error(e);
        }
    }

    registerDeposit(depositPID, destination, deposit, type, depositor, owner,
            Collections.<String, String>emptyMap());
    return buildReceipt(depositPID, config);
}

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

public void setUnitUUID(UUID uuid) {
    setUnitUUID(uuid != null ? uuid.toString() : null);
}

From source file:net.sourceforge.vulcan.spring.jdbc.BuildQuery.java

@SuppressWarnings("unchecked")
public JdbcBuildOutcomeDto queryForBuild(UUID uuid) {
    final List<JdbcBuildOutcomeDto> results = execute(new Object[] { uuid.toString() });

    if (results.size() == 1) {
        return results.get(0);
    }// w  w  w. j a v a2s.co  m

    return null;
}

From source file:org.energyos.espi.common.repositories.jpa.IntervalBlockRepositoryImpl.java

@Override
public IntervalBlock findByUUID(UUID uuid) {
    return (IntervalBlock) em.createNamedQuery(IntervalBlock.QUERY_FIND_BY_UUID)
            .setParameter("uuid", uuid.toString().toUpperCase()).getSingleResult();
}

From source file:com.publicuhc.pluginframework.util.UUIDFetcherTest.java

@Test
public void testUUIDFetch() throws ParseException, InterruptedException, IOException {
    UUID uuid = UUIDFetcher.getUUIDOf("ghowden");

    assertThat(uuid, is(equalTo(UUID.fromString("048fa310-30de-44fe-9f5e-c7443e91ad46"))));
    assertThat(uuid.toString(), is(equalTo("048fa310-30de-44fe-9f5e-c7443e91ad46")));
}

From source file:goraci.Loop.java

protected Verify startVerify(String outputDir, int numReducers, boolean concurrent) throws Exception {
    Path outputPath = new Path(outputDir);
    UUID uuid = UUID.randomUUID(); //create a random UUID.
    Path iterationOutput = new Path(outputPath, uuid.toString());

    Verify verify = new Verify();
    verify.setConf(getConf());//  w w  w.ja v a  2 s . c  o m
    verify.start(iterationOutput, numReducers, concurrent);
    return verify;
}