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.energyos.espi.common.repositories.jpa.ReadingTypeRepositoryImpl.java

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

From source file:org.trustedanalytics.serviceexposer.RedisCredentialsStoreTest.java

@Test
public void testServiceInstanceExists() {
    UUID randomGuid = UUID.randomUUID();
    CredentialProperties existingEntry = new CredentialProperties(true, "", randomGuid.toString(), "", "", "",
            "", "", "", "");
    when(mockHashOps.get(SERVICE_TYPE, randomGuid.toString())).thenReturn(existingEntry);
    boolean eligible = sut.exists(SERVICE_TYPE, randomGuid);
    assertEquals(true, eligible);/*w  ww .jav  a  2  s  .c o m*/
}

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

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

From source file:org.ovirt.engine.sdk.decorators.Capabilities.java

/**
 * Fetches VersionCaps object by id.//from  w w  w. j  ava  2  s  .c  o m
 *
 * @return {@link VersionCaps }
 *
 * @throws ClientProtocolException
 *             Signals that HTTP/S protocol error has occurred.
 * @throws ServerException
 *             Signals that an oVirt api error has occurred.
 * @throws IOException
 *             Signals that an I/O exception of some sort has occurred.
 */
@Override
public VersionCaps get(UUID id) throws ClientProtocolException, ServerException, IOException {
    String url = SLASH + getName() + SLASH + id.toString();
    return getProxy().get(url, org.ovirt.engine.sdk.entities.VersionCaps.class, VersionCaps.class);
}

From source file:com.haulmont.cuba.core.sys.encryption.Sha1EncryptionModule.java

@Override
public String getPasswordHash(UUID userId, String password) {
    String plainHash = getPlainHash(password);
    return getHash(plainHash, userId.toString());
}

From source file:org.trustedanalytics.metricsprovider.rest.MetricsDownloadTasks.java

public CompletableFuture<EventSummary> getLatestEvents(UUID org) {
    String path = latestEventsService + "/rest/les/events?size=10&org=" + org.toString();
    return getAsynchronouslyWithLogging(path, EventSummary.class, null, "getting last events");
}

From source file:com.igormaznitsa.sciareto.preferences.PreferencesManager.java

private PreferencesManager() {
    this.prefs = Preferences.userNodeForPackage(PreferencesManager.class);
    String packedUuid = this.prefs.get(PROPERTY_UUID, null);
    if (packedUuid == null) {
        try {/*from   w  w w.j  a  va  2s  . c o m*/
            final UUID newUUID = UUID.randomUUID();
            packedUuid = Base64.encodeBase64String(IOUtils.packData(newUUID.toString().getBytes("UTF-8")));
            this.prefs.put(PROPERTY_UUID, packedUuid);
            this.prefs.flush();
            LOGGER.info("Generated new installation UUID : " + newUUID.toString());

            final Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    LOGGER.info("Send first start metrics");
                    com.igormaznitsa.sciareto.metrics.MetricsService.getInstance().onFirstStart();
                }
            }, "SCIARETO_FIRST_START_METRICS");
            thread.setDaemon(true);
            thread.start();

        } catch (Exception ex) {
            LOGGER.error("Can't generate UUID", ex);
        }
    }
    try {
        this.installationUUID = UUID
                .fromString(new String(IOUtils.unpackData(Base64.decodeBase64(packedUuid)), "UTF-8"));
        LOGGER.info("Installation UUID : " + this.installationUUID.toString());
    } catch (UnsupportedEncodingException ex) {
        LOGGER.error("Can't decode UUID", ex);
        throw new Error("Unexpected error", ex);
    }
}

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

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

From source file:com.valygard.aohruthless.utils.inventory.InventoryHandler.java

/**
 * Restore the player's inventory back to them.
 *//*from www.  ja  v a2s. c  o m*/
public void restoreInventory(Player p) {
    UUID uuid = p.getUniqueId();

    // Grab disk file
    File file = new File(dir, uuid.toString());
    JsonConfiguration json = new JsonConfiguration(dir, uuid.toString());

    // Try to grab the items from memory first
    ItemStack[] items = this.items.remove(p.getName());
    ItemStack[] armor = this.armor.remove(p.getName());

    // If we can't restore from memory, restore from file
    if (items == null || armor == null) {
        JSONArray itemsList = (JSONArray) json.getValue("items");
        JSONArray armorList = (JSONArray) json.getValue("armor");

        // Turn the lists into arrays
        items = (ItemStack[]) itemsList.toArray();
        armor = (ItemStack[]) armorList.toArray();
    }

    // Set the player inventory contents
    p.getInventory().setContents(items);
    p.getInventory().setArmorContents(armor);

    // Delete the file
    file.delete();
}

From source file:org.trustedanalytics.serviceexposer.rest.CredentialsController.java

public Map<String, Map<String, String>> getCredentialsInJson(String serviceType, UUID spaceGuid) {
    try {// w ww  .  j  a v a2s.  com
        return store.values(serviceType).stream().filter(s -> s.getSpaceGuid().equals(spaceGuid.toString()))
                .filter(f -> f.isCredentialsExtracted())
                .collect(toMap(CredentialProperties::getName, CredentialProperties::retriveMapForm));

    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
    return Collections.emptyMap();
}