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:org.trustedanalytics.servicebroker.yarn.plans.YarnPlanBare.java

@Override
public Map<String, Object> bind(ServiceInstance serviceInstance) throws ServiceBrokerException {
    UUID orgId = UUID.fromString(serviceInstance.getOrganizationGuid());
    return bindingOperations.createCredentialsMap(orgId);
}

From source file:com.spectralogic.ds3cli.command.DeleteTape.java

@Override
public CliCommand init(final Arguments args) throws Exception {
    processCommandOptions(requiredArgs, EMPTY_LIST, args);

    this.id = UUID.fromString(args.getId());
    return this;
}

From source file:com.khubla.cbean.serializer.impl.json.JSONUUIDFieldSerializer.java

@Override
public void deserialize(Object o, Field field, String value) throws SerializerException {
    try {//from ww w .java  2  s.  co m
        final UUID uuid = UUID.fromString(value);
        PropertyUtils.setProperty(o, field.getName(), uuid);
    } catch (final Exception e) {
        throw new SerializerException(e);
    }
}

From source file:com.rusticisoftware.tincan.StatementRef.java

public StatementRef(JsonNode jsonNode) throws URISyntaxException {
    this();/*from  w w w .  j  a  v  a 2s. c  om*/

    JsonNode idNode = jsonNode.path("id");
    if (!idNode.isMissingNode()) {
        this.setId(UUID.fromString(idNode.textValue()));
    }
}

From source file:at.alladin.rmbt.db.fields.UUIDField.java

@Override
public void setField(final ResultSet rs) throws SQLException {
    final String string = rs.getString(dbKey);
    if (string == null)
        value = null;/*  w  w w.  j ava2  s  .  c  o m*/
    else
        value = UUID.fromString(string);
}

From source file:cf.client.Token.java

public static Token parseJson(InputStream json) {
    try {// www.jav  a 2 s  .com
        final JsonNode node = new ObjectMapper().readTree(json);
        final String accessToken = node.get("access_token").asText();
        final Type type = Type.getType(node.get("token_type").asText());
        final Date expiration = new Date(System.currentTimeMillis() + node.get("expires_in").asLong());
        final String rawScopes = node.get("scope").asText();
        final String[] splitScopes = rawScopes.split("\\s+");
        final List<String> scopes = Collections.unmodifiableList(Arrays.asList(splitScopes));
        final UUID jti = UUID.fromString(node.get("jti").asText());
        return new Token(accessToken, type, expiration, scopes, jti);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanMultitenant.java

@Override
public Map<String, Object> bind(ServiceInstance serviceInstance) throws ServiceBrokerException {
    UUID instanceId = UUID.fromString(serviceInstance.getServiceInstanceId());
    return bindingOperations.createCredentialsMap(instanceId);
}

From source file:io.sidecar.query.UserAnswerBucketJsonValidationTest.java

@Test(description = "Asserts that serializing a UserAnswerBucket containing RawEventsAnswers produces the proper"
        + "json")
public void testRawEventsAnswerBucketSerialization() throws Exception {
    JsonNode expectedJson = mapper/*from  w  ww.ja  v a  2s  .c o m*/
            .readTree(this.getClass().getResource("/raw_events_answer_bucket_response.json"));

    Event event = mapper.readValue(expectedJson.path("answer").path("events").get(0).traverse(), Event.class);

    RawEventsAnswer rawEventsAnswer = RawEventsAnswer.fromEvents(event);
    UserAnswerBucket<RawEventsAnswer> uab = new UserAnswerBucket<>(
            UUID.fromString(expectedJson.path("userId").asText()), expectedJson.path("deviceId").asText(),
            rawEventsAnswer);

    JsonNode actualJson = mapper.readTree(mapper.writeValueAsBytes(uab));

    assertTrue(actualJson.equals(expectedJson));
}

From source file:io.github.minecraftgui.models.network.packets.PacketComponentEvent.java

public PacketComponentEvent(UserConnection userConnection, JSONObject jsonObject) {
    super(jsonObject);
    this.component = userConnection
            .getComponent(UUID.fromString(jsonObject.getString(NetworkController.COMPONENT_ID)));
}

From source file:annis.gui.requesthandler.ResourceRequestHandler.java

@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response)
        throws IOException {
    if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) {
        String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/");
        UUID uuid = UUID.fromString(uuidString);
        IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class);
        if (map == null) {
            response.setStatus(404);//from w w w .ja  va2s. co m
        } else {
            IFrameResource res = map.get(uuid);
            if (res != null) {
                response.setStatus(200);
                response.setContentType(res.getMimeType());
                response.getOutputStream().write(res.getData());
            }
        }
        return true;
    }
    return false;
}