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.consol.citrus.samples.todolist.web.TodoController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity deleteEntry(@PathVariable(value = "id") String id) {
    todoListService.deleteEntry(UUID.fromString(id));

    return ResponseEntity.ok().build();
}

From source file:org.restexpress.plugin.correlationid.CorrelationIdPluginTest.java

@Test
public void shouldGenerateCorrelationIdOnNull() throws Exception {
    HttpGet request = new HttpGet("http://localhost:8081/test");
    HttpResponse response = (HttpResponse) http.execute(request);
    HttpEntity entity = response.getEntity();
    String json = EntityUtils.toString(entity);
    assertNotNull(json);//from w ww .  ja va 2  s .  c  o m
    UUID.fromString(json);
}

From source file:com.sdl.odata.renderer.json.util.JsonWriterUtilTest.java

@Test
public void testWritePrimitiveValues() throws Exception {

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    JsonGenerator jsonGenerator = new JsonFactory().createGenerator(stream, JsonEncoding.UTF8);

    jsonGenerator.writeStartObject();//from w  ww  . j  a v a 2s.c om
    appendPrimitiveValue("MyString", "Some text", jsonGenerator);
    appendPrimitiveValue("MyByteProperty", Byte.MAX_VALUE, jsonGenerator);
    appendPrimitiveValue("MyShortProperty", (short) 1, jsonGenerator);
    appendPrimitiveValue("MyIntegerProperty", 2, jsonGenerator);
    appendPrimitiveValue("MyFloatProperty", 3.0f, jsonGenerator);
    appendPrimitiveValue("MyDoubleProperty", 4.0d, jsonGenerator);
    appendPrimitiveValue("MyLongProperty", (long) 5, jsonGenerator);
    appendPrimitiveValue("MyBooleanProperty", true, jsonGenerator);
    appendPrimitiveValue("MyUUIDProperty", UUID.fromString("23492a5b-c4f1-4a50-b7a5-d8ebd6067902"),
            jsonGenerator);
    appendPrimitiveValue("DecimalValueProperty", BigDecimal.valueOf(21), jsonGenerator);

    jsonGenerator.writeEndObject();
    jsonGenerator.close();

    assertEquals(prettyPrintJson(readContent(EXPECTED_PRIMITIVE_VALUES_PATH)),
            prettyPrintJson(stream.toString()));
}

From source file:com.jeanchampemont.notedown.web.NoteRestController.java

@RequestMapping(value = "/", method = RequestMethod.POST)
public NoteDto save(NoteDto note) {
    Note n = new Note(note.getTitle(), note.getContent(), authenticationService.getCurrentUser());
    n.setId(UUID.fromString(note.getId()));
    n = noteService.createUpdate(n, note.getVersion());
    NoteDto result = mapNoteToNoteDto(n);
    return result;
}

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

@Test
public void getByExistingGidReturnsOneTrackThatHasNoRedirectedGids() {
    UUID gid = UUID.fromString("8f64df73-562c-4145-a9db-9736a3f04c27");
    Track track = dao.getByGid(gid);
    assertThat(track.getName(), is("The Saint"));
}

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

@Test
public void getByExistingGidReturnsOneRecordingThatHasNoRedirectedGids() {
    UUID gid = UUID.fromString("2ea1383f-aca7-4a39-9839-576cf3af438b");
    Recording recording = dao.getByGid(gid);
    assertThat(recording.getName(), is("The Sinner"));
}

From source file:com.blackducksoftware.integration.hub.api.report.LicenseDefinition.java

public UUID getLicenseUUId() {
    if (StringUtils.isBlank(licenseId)) {
        return null;
    }/*from ww  w. j  a v  a 2s  .co m*/
    try {
        return UUID.fromString(licenseId);
    } catch (final IllegalArgumentException e) {
        return null;
    }
}

From source file:com.kurtraschke.wmata.gtfsrealtime.api.alerts.Item.java

public void setGuid(String guid) {
    this.guid = UUID.fromString(guid);
}

From source file:com.drevelopment.couponcodes.bukkit.BukkitServerModTransformer.java

@Override
public String getPlayerName(String uuid) {
    return Bukkit.getOfflinePlayer(UUID.fromString(uuid)).getName();
}

From source file:edu.fing.tagsi.db4o.business.TrackingController.java

public List<Tracking> getTracking(UUID id) {
    RestTemplate restTemplate = new RestTemplate();
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    HttpEntity entity = new HttpEntity(headers);

    ResponseEntity<RequestTrackingAddPackage[]> tracking = restTemplate.exchange(
            ConfigController.getInstance().getURLFindTracking() + "/" + id.toString(), GET, entity,
            RequestTrackingAddPackage[].class);

    if (tracking != null) {
        List<Tracking> resultado = new ArrayList<>(tracking.getBody().length);
        for (RequestTrackingAddPackage r : tracking.getBody()) {

            resultado.add(new Tracking(UUID.fromString(r.getIdpaquete()), UUID.fromString(r.getIdcliente()),
                    UUID.fromString(r.getIdlugar()), r.getFecha(), r.isEsdestino()));
        }//from   ww w  . j ava 2s .  c  o m
        return resultado;
    } else {
        return null;
    }

}