Example usage for java.util UUID fromString

List of usage examples for java.util UUID fromString

Introduction

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

Prototype

public static UUID fromString(String name) 

Source Link

Document

Creates a UUID from the string standard representation as described in the #toString method.

Usage

From source file:com.feedzai.fos.api.util.ManagerUtils.java

/**
 * Obtain model UUID from ModelConfig if defined or generate a new random uuid
 *
 * @param config Model Configuration//w ww . ja v a  2  s  .co  m
 * @return new Model UUID
 * @throws com.feedzai.fos.api.FOSException
 */
public static UUID getUuid(ModelConfig config) throws FOSException {
    String suuid = config.getProperty("UUID");

    return StringUtils.isBlank(suuid) ? UUID.randomUUID() : UUID.fromString(suuid);
}

From source file:com.nestedbird.util.UUIDConverter.java

/**
 * Turns a UUID in string format to a Base64 encoded version
 *
 * @param uuidString String representation of the uuid
 * @return base64 encoded version of the uuid
 * @throws IllegalArgumentException String must be a valid uuid
 * @throws NullPointerException     String cannot be null
 *///from w ww .j a v  a2  s .  c  o  m
public static String toBase64(final String uuidString) {
    if (uuidString == null)
        throw new NullPointerException("String cannot be null");
    if (!isUUID(uuidString))
        throw new IllegalArgumentException("string must be a valid uuid");

    final UUID uuid = UUID.fromString(uuidString);
    final ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
    bb.putLong(uuid.getMostSignificantBits());
    bb.putLong(uuid.getLeastSignificantBits());
    return Base64.encodeBase64URLSafeString(bb.array());
}

From source file:gov.nih.nci.ncicb.tcga.dcc.dam.web.editor.UUIDEditor.java

@Override
public void setAsText(String s) {
    logger.debug("Set converted UUID: " + s);
    setValue(UUID.fromString(s));
}

From source file:de.kaiserpfalzEdv.commons.jee.spring.service.test.ServiceLoggingImpl.java

public boolean check(final UUID uuid, final String wantedId, final Object arg2) {
    boolean result = false;

    if (wantedId == null) {
        try {/*  ww  w.jav a 2 s.c o  m*/
            UUID.fromString(MDC.get("id"));

            result = true;
        } catch (IllegalArgumentException e) {
            // Do nothing ...
        }
    } else if (wantedId.equals(MDC.get("id"))) {
        result = true;
    }

    ServiceLogging.oplog.trace("service method checked MDC.get('id')='{}'. Wanted was '{}'. Result is: {}",
            MDC.get("id"), wantedId, result);

    return result;
}

From source file:com.nebhale.newrelicservicebroker.catalog.CatalogFactory.java

@Bean
Catalog catalog(@Value("${serviceBroker.serviceId}") String serviceId,
        @Value("${serviceBroker.planId}") String planId) {
    // @formatter:off
    return new Catalog().service().id(UUID.fromString(serviceId)).name("newrelic")
            .description("Manage and monitor your apps").bindable(true)
            .tags("newrelic", "management", "monitoring", "apm").metadata().displayName("New Relic")
            .imageUrl(URI.create("https://newrelic.com/images/logo/logo-newrelic-white.png"))
            .longDescription("New Relic is the all-in-one web app performance tool that lets you see "
                    + "performance from the end user experience, through servers, and down to the "
                    + "line of code.")
            .providerDisplayName("New Relic, Inc.").documentationUrl(URI.create("https://docs.newrelic.com"))
            .supportUrl(URI.create("https://support.newrelic.com/home")).and().plan()
            .id(UUID.fromString(planId)).name("standard").description("Broker for static New Relic credentials")
            .metadata().bullets("JVM Performance analyzer", "Database call response time & throughput",
                    "Performance data API access")
            .displayName("Standard").and().free(true).and().and();
    // @formatter:on
}

From source file:com.hmcovisint.dynatraceservicebroker.catalog.CatalogFactory.java

@Bean
Catalog catalog(@Value("${serviceBroker.serviceId}") String serviceId,
        @Value("${serviceBroker.planId}") String planId) {
    // @formatter:off
    return new Catalog().service().id(UUID.fromString(serviceId)).name("dynatrace")
            .description("Manage and monitor your apps").bindable(true)
            .tags("dynatrace", "management", "monitoring", "apm").metadata().displayName("DynaTrace")
            .imageUrl(URI.create(
                    "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTiBIZfa-LBmUTk_w78c3n-RHFRfTeLDVd-Mog1xh6cVGbxxud6gQ"))
            .longDescription("DynaTracce is the all-in-one web app performance tool that lets you see "
                    + "performance from the end user experience, through servers, and down to the "
                    + "line of code.")
            .providerDisplayName("DYNATRACE LLC.")
            .documentationUrl(URI.create("http://www.dynatrace.com/en/resources/webinars.html"))
            .supportUrl(URI.create("https://support.dynatrace.com/")).and().plan().id(UUID.fromString(planId))
            .name("standard").description("Broker for static Dynatrace credentials").metadata()
            .bullets("JVM Performance analyzer", "Database call response time & throughput",
                    "Performance data API access")
            .displayName("Standard").and().free(true).and().and();
    // @formatter:on
}

From source file:co.uk.randompanda30.sao.modules.enhancement.BoosterHandler.java

public static void startDumpedBooster() {
    String name = boosterf.getString((String) PATHS.BOOSTER_NAME.value);
    UUID uuid = UUID.fromString(boosterf.getString((String) PATHS.BOOSTER_UUID.value));

    long start = boosterf.getLong((String) PATHS.BOOSTER_ST.value);
    long end = boosterf.getLong((String) PATHS.BOOSTER_ET.value);
    long dump = boosterf.getLong((String) PATHS.BOOSTER_DT.value);
    long duration = boosterf.getLong((String) PATHS.BOOSTER_D.value);

    int percentage = boosterf.getInt((String) PATHS.BOOSTER_P.value);

    long a = dump - start;
    long b = duration - a;
    long c = end + b;

    new Booster(name, uuid, start, c, duration, percentage);

    boosterf.set((String) PATHS.BOOSTER_DUMP.value, null);
    CBooster.save();//from   w  w w . j a  v a  2  s  .com
}

From source file:com.github.seqware.queryengine.system.Utility.java

/**
 * Parse a timestamp-less SGID from a String representation
 *
 * @param stringSGID a {@link java.lang.String} object.
 * @return a {@link com.github.seqware.queryengine.util.SGID} object.
 *//*from   ww  w  .  j  av  a2 s.  c o m*/
public static SGID parseSGID(String stringSGID) {
    SGID sgid;
    try {
        UUID uuid = UUID.fromString(stringSGID);
        sgid = new SGID(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits(), 0, null);
    } catch (IllegalArgumentException e) {
        String fRowKey = stringSGID;
        sgid = new SGID(0, 0, 0, fRowKey);
    }
    return sgid;
}

From source file:io.hakbot.controller.model.IdentifiableObject.java

@JsonIgnore
public boolean isValid() {
    try {//  w  w w .  j  a  va  2s  .  c o m
        UUID.fromString(uuid);
        return true;
    } catch (IllegalArgumentException e) {
        return false;
    }
}

From source file:com.formkiq.core.form.bean.UUIDConverter.java

@SuppressWarnings("unchecked")
@Override/*from   w  w w.j  a v  a  2 s  .co  m*/
public <T> T convert(final Class<T> type, final Object value) {

    // We have to support Object, too, because this class is sometimes
    // used for a standard to Object conversion
    if (UUID.class.equals(type) || Object.class.equals(type)) {

        if (value != null) {
            return (T) UUID.fromString(value.toString());
        }
    }

    return null;
}