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:eu.planets_project.tb.impl.serialization.ExperimentFileCache.java

/**
 * /*from ww w  .  j a  va 2s.  com*/
 */
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:annis.administration.MediaImportHelper.java

public MediaImportHelper(String absolutePath, File dataDir, long corpusRef,
        Map<String, String> mimeTypeMapping) {

    this.fileSource = new File(absolutePath);

    // create a file-name in the form of "filename-UUID.ending", thus we
    // need to split the file name into its components
    String baseName = FilenameUtils.getBaseName(fileSource.getName());
    String extension = FilenameUtils.getExtension(fileSource.getName());
    UUID uuid = UUID.randomUUID();
    fileDestination = new File(dataDir,
            baseName + "_" + uuid.toString() + (extension.isEmpty() ? "" : "." + extension));

    String fileEnding = FilenameUtils.getExtension(absolutePath);
    if (mimeTypeMapping.containsKey(fileEnding)) {
        this.mimeType = mimeTypeMapping.get(fileEnding);
    } else {/*from  w w w  .j  a va2s . com*/
        this.mimeType = new MimetypesFileTypeMap().getContentType(fileSource);
    }
    this.corpusRef = corpusRef;

}

From source file:de.appsolve.padelcampus.utils.LoginUtil.java

public void updateLoginCookie(HttpServletRequest request, HttpServletResponse response) {
    Player player = sessionUtil.getUser(request);
    if (player != null) {
        UUID cookieUUID = UUID.randomUUID();
        UUID cookieValue = UUID.randomUUID();
        String cookieValueHash = BCrypt.hashpw(cookieValue.toString(), BCrypt.gensalt());
        LoginCookie loginCookie = new LoginCookie();
        loginCookie.setUUID(cookieUUID.toString());
        loginCookie.setPlayerUUID(player.getUUID());
        loginCookie.setLoginCookieHash(cookieValueHash);
        loginCookie.setValidUntil(new LocalDate().plusYears(1));
        loginCookieDAO.saveOrUpdate(loginCookie);
        Cookie cookie = new Cookie(COOKIE_LOGIN_TOKEN, cookieUUID.toString() + ":" + cookieValue.toString());
        cookie.setDomain(request.getServerName());
        cookie.setMaxAge(ONE_YEAR_SECONDS);
        cookie.setPath("/");
        response.addCookie(cookie);/*  www .j  av a2  s  .co m*/
    }
}

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

public void setRecipeUUID(UUID listUUID) {
    mRecipeUUID = listUUID != null ? listUUID.toString() : null;
}

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

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

From source file:com.redgate.hadoop.hive.azuretables.AzureTablesRecordReader.java

/**
 * This generates a GUID that can be used as a key and converts it to a Text
 * object//www .  j a v a 2s  .co  m
 */
public Text createKey() {
    UUID uid = UUID.randomUUID();
    return new Text(uid.toString());
}

From source file:com.atomicleopard.thundr.gae.channels.ChannelService.java

public <U extends User> String createChannel(U user, Session session) {
    UUID id = session.getId();
    return service.createChannel(id.toString());
}

From source file:com.atomicleopard.thundr.gae.channels.ChannelService.java

public <U extends User> String createChannel(U user, Session session, int durationMinutes) {
    UUID id = session.getId();
    return service.createChannel(id.toString(), durationMinutes);
}

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

@Override
public UUID create(TaskDefinition taskDef) throws CrudlException {
    UUID id = UUID.randomUUID();
    taskDef.setRef(id.toString());
    try (Connection connection = dataSource.getConnection();
            PreparedStatement st = connection
                    .prepareStatement("INSERT INTO TASKS (taskDefinition,id) VALUES (?,?)");) {
        st.setString(1, serialize(taskDef));
        st.setString(2, id.toString());/*w  w w .  j  a  v a2  s. c om*/
        st.executeUpdate();
    } catch (SQLException | IOException ex) {
        throw new CrudlException("Error selecting task", ex);
    }
    return id;
}

From source file:nl.esciencecenter.octopus.webservice.api.SandboxedJob.java

/**
 *
 * @return Universally unique identifier of job
 *///from  ww w.  j  ava  2s.  c om
@JsonIgnore
public String getIdentifier() {
    UUID uuid = job.getUUID();
    return uuid.toString();
}