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.sample.serviceImpl.DonarsServiceImpl.java

@Override
public void save(Donars donar) {
    if (donar.getId() == null) {
        donar.setId(UUID.randomUUID() + "");
    }//  w  ww .j a va 2  s  .co m
    donarsRepository.save(donar);
}

From source file:com.univocity.examples.ExampleWithDatabase.java

protected JdbcDataStoreConfiguration newDatabaseConfiguration() {
    // The next three lines of code use some utility classes we created to easily
    // create and initialize in-memory databases for testing purposes.

    //creates an in-memory database with a random name and a directory with table definition scripts.
    DatabaseAccessor destinationConfig = new DatabaseAccessor(UUID.randomUUID().toString(), schemaDirPath);

    //initializes the database, creates all tables and returns a javax.sql.DataSource
    dataSource = destinationConfig.getDatabase().getDataSource();

    //Back to uniVocity, here we create a data store configuration for database entities.
    //It offers a lot of configuration options, but for this example, we will just need the following:

    //##CODE_START
    //Creates a new JDBC data store based on a javax.sql.DataSource, with the name "new_schema".
    //Upon initialization, uniVocity will try to auto-detect all available tables, columns and primary keys
    //If this doesn't work you still can configure each table manually.
    JdbcDataStoreConfiguration newSchemaDataStore = new JdbcDataStoreConfiguration(dataStoreName, dataSource);

    //The database contains lots of internal tables in addition to the tables we are interested in
    //By setting the schema to "public", these internal database tables won't be made available to uniVocity.
    newSchemaDataStore.setSchema("public");
    //##CODE_END//w ww  .j a  v  a  2 s  . c  om
    return newSchemaDataStore;
}

From source file:org.brekka.phalanx.core.dao.hibernate.AbstractPhalanxHibernateEntityDAO.java

@Override
public UUID create(T entity) {
    UUID id = UUID.randomUUID();
    entity.setId(id);/*www. j a v a2 s.  c o  m*/
    Session session = phalanxSessionFactory.getCurrentSession();
    session.save(entity);
    return id;
}

From source file:com.netflix.scheduledactions.persistence.cassandra.CassandraTriggerDao.java

@Override
public String createTrigger(String triggerGroup, Trigger trigger) {
    trigger.setId(UUID.randomUUID().toString());
    cassandraDao.upsertToGroup(triggerGroup, trigger.getId(), trigger, null);
    return trigger.getId();
}

From source file:com.haulmont.cuba.web.toolkit.ui.CubaFileDownloader.java

public void viewDocument(Resource resource) {
    String resourceId = VIEW_RESOURCE_PREFIX + UUID.randomUUID().toString();
    setResource(resourceId, resource);/*from  ww  w.  ja  v  a 2s. c  o m*/

    getRpcProxy(CubaFileDownloaderClientRPC.class).viewDocument(resourceId);
}

From source file:edu.stanford.junction.api.activity.JunctionActor.java

public JunctionActor(String role) {
    actorID = UUID.randomUUID().toString();
    mRoles = new String[] { role };
}

From source file:eu.planets_project.tb.impl.serialization.ExperimentFileCache.java

/**
 * /*  www  . j  av  a2s. co  m*/
 */
public ExperimentFileCache() {
    if (cachedir != null)
        return;
    // Generate a temporary file and turn it into a directory:
    try {
        UUID dirname = UUID.randomUUID();
        File tmp = File.createTempFile(dirname.toString(), cacheExt);
        tmp.delete();
        tmp.mkdir();
        tmp.deleteOnExit();
        cachedir = tmp;
        log.info("Set up export cache: " + cachedir.getPath());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.streamsets.pipeline.stage.destination.solr.TestSolrTarget.java

@BeforeClass
public static void beforeTest() throws Exception {
    File solrHomeDir = new File("target", UUID.randomUUID().toString());
    Assert.assertTrue(solrHomeDir.mkdirs());
    URL url = Thread.currentThread().getContextClassLoader().getResource("solr/");
    Assert.assertNotNull(url);/* ww  w.  jav a 2 s .c o  m*/
    FileUtils.copyDirectoryToDirectory(new File(url.toURI()), solrHomeDir);
    createJetty(solrHomeDir.getAbsolutePath() + "/solr", null, null);
}

From source file:com.mirth.connect.model.ChannelGroup.java

public ChannelGroup(String name, String description) {
    this(UUID.randomUUID().toString(), name, description);
}

From source file:automenta.knowtention.Core.java

String newChannelID() {
    return UUID.randomUUID().toString();
}