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.rusticisoftware.tincan.Context.java

public Context(JsonNode jsonNode) throws MalformedURLException, URISyntaxException {
    this();//from  w w  w  . j a va 2  s  .c o  m

    JsonNode registrationNode = jsonNode.path("registration");
    if (!registrationNode.isMissingNode()) {
        this.setRegistration(UUID.fromString(registrationNode.textValue()));
    }

    // TODO: check these for Group
    JsonNode instructorNode = jsonNode.path("instructor");
    if (!instructorNode.isMissingNode()) {
        this.setInstructor(Agent.fromJson(instructorNode));
    }

    JsonNode teamNode = jsonNode.path("team");
    if (!teamNode.isMissingNode()) {
        this.setTeam(Agent.fromJson(teamNode));
    }

    JsonNode contextActivitiesNode = jsonNode.path("contextActivities");
    if (!contextActivitiesNode.isMissingNode()) {
        this.setContextActivities(new ContextActivities(contextActivitiesNode));
    }

    JsonNode revisionNode = jsonNode.path("revision");
    if (!revisionNode.isMissingNode()) {
        this.setRevision(revisionNode.textValue());
    }

    JsonNode platformNode = jsonNode.path("platform");
    if (!platformNode.isMissingNode()) {
        this.setPlatform(platformNode.textValue());
    }

    JsonNode languageNode = jsonNode.path("language");
    if (!languageNode.isMissingNode()) {
        this.setLanguage(languageNode.textValue());
    }

    JsonNode statementNode = jsonNode.path("statement");
    if (!statementNode.isMissingNode()) {
        this.setStatement(new StatementRef(statementNode));
    }

    JsonNode extensionsNode = jsonNode.path("extensions");
    if (!extensionsNode.isMissingNode()) {
        this.setExtensions(new Extensions(extensionsNode));
    }
}

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

public Statement(JsonNode jsonNode) throws URISyntaxException, MalformedURLException {
    super(jsonNode);

    JsonNode idNode = jsonNode.path("id");
    if (!idNode.isMissingNode()) {
        this.setId(UUID.fromString(idNode.textValue()));
    }//  w  ww.  jav  a 2 s . com

    JsonNode storedNode = jsonNode.path("stored");
    if (!storedNode.isMissingNode()) {
        this.setStored(new DateTime(storedNode.textValue()));
    }

    JsonNode authorityNode = jsonNode.path("authority");
    if (!authorityNode.isMissingNode()) {
        this.setAuthority(Agent.fromJson(authorityNode));
    }

    JsonNode voidedNode = jsonNode.path("voided");
    if (!voidedNode.isMissingNode()) {
        this.setVoided(voidedNode.asBoolean());
    }

    JsonNode versionNode = jsonNode.path("version");
    if (!versionNode.isMissingNode()) {
        this.setVersion(TCAPIVersion.fromString(versionNode.textValue()));
    }
}

From source file:fm.last.musicbrainz.data.dao.impl.TrackDaoImplIT.java

@Test
public void getByExistingGidReturnsOneTrack() {
    UUID gid = UUID.fromString("70c4bd53-f3ef-354f-97a9-7ed76915087a");
    Track track = dao.getByGid(gid);
    assertThat(track.getName(), is("The Saint"));
}

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

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

    this.id = UUID.fromString(args.getId());
    this.bucket = args.getBucket();
    this.ejectLabel = args.GetEjectLabel();
    this.ejectLocation = args.GetEjectLocation();
    return this;
}

From source file:hd3gtv.mydmam.db.orm.AutotestOrm.java

public static AutotestOrm populate(int index) {
    AutotestOrm result = new AutotestOrm();

    result.key = "THISISMYKEY" + String.valueOf(index);
    result.strvalue = "Hello world with cnts";
    result.bytvalue = result.strvalue.toUpperCase().getBytes();
    result.intvalue = 42;/* ww  w. ja  v  a  2  s .  c o m*/
    result.lngvalue = -3329447494103907027L;
    result.bolvalue = true;
    result.fltvalue = 6.55957f;
    result.dlbvalue = (double) result.lngvalue / 11d;
    result.uuivalue = UUID.fromString("110E8400-E29B-11D4-A716-446655440000");
    result.jsovalue = new JSONObject();
    result.jsovalue.put("Hello", "world");
    result.jsovalue.put("Count", index);
    result.jsavalue = new JSONArray();
    result.jsavalue.add("One");
    result.jsavalue.add(42);
    result.jsavalue.add("Un");
    try {
        result.addressvalue = InetAddress.getLocalHost();
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    result.sbuvalue = new StringBuffer();
    result.sbuvalue.append(result.key);
    result.sbuvalue.append(result.strvalue);
    result.sbuvalue.append(result.lngvalue);
    result.calendarvalue = Calendar.getInstance();
    result.calendarvalue.set(1995, 05, 23, 10, 04, 8);
    result.calendarvalue.set(Calendar.MILLISECOND, 666);
    result.dtevalue = result.calendarvalue.getTime();
    result.strarrayvalue = new String[2];
    result.strarrayvalue[0] = result.strvalue;
    result.strarrayvalue[1] = result.key;
    result.serializvalue = new HashMap<String, String>();
    result.serializvalue.put("Some var", result.strvalue);
    result.serializvalue.put("Other var", result.uuivalue.toString());

    result.enumvalue = MyEnum.ME;

    result.iamempty = "";
    result.iamanindex = index;
    result.donttouchme = "F*ck you";
    return result;
}

From source file:org.trustedanalytics.servicebroker.hive.plans.HiveShared.java

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

From source file:fm.last.musicbrainz.data.dao.impl.ReleaseDaoImplIT.java

@Test
public void getByExistingGidReturnsOneRelease() {
    UUID gid = UUID.fromString("e1f5f807-3851-48fb-838b-fb8a069f53e7");
    Release release = dao.getByGid(gid);
    assertThat(release.getName(), is("The Best of Rick Astley"));
}

From source file:eu.griend.grpf.controller.NodeController.java

@RequestMapping(value = "/nodes/{id}", method = RequestMethod.GET)
public NodeEntity readNode(@PathVariable String id) {
    UUID uuid = UUID.fromString(id);

    return this.nodeService.readNode(uuid);
}

From source file:com.publicuhc.pluginframework.util.UUIDFetcherTest.java

@Test
public void testUUIDFetch() throws ParseException, InterruptedException, IOException {
    UUID uuid = UUIDFetcher.getUUIDOf("ghowden");

    assertThat(uuid, is(equalTo(UUID.fromString("048fa310-30de-44fe-9f5e-c7443e91ad46"))));
    assertThat(uuid.toString(), is(equalTo("048fa310-30de-44fe-9f5e-c7443e91ad46")));
}

From source file:com.hortonworks.streamline.streams.common.StreamlineEventImplTest.java

@Test
public void testGetId() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("a", "aval");
    map.put("b", "bval");

    StreamlineEvent event = new StreamlineEventImpl(map, org.apache.commons.lang.StringUtils.EMPTY);

    assertNotNull(UUID.fromString(event.getId()));
}