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.createnet.raptor.auth.service.objects.CheckRequestBody.java

protected boolean validateUUID(String uuid, String fieldName) throws ValidationException {

    if (objectId == null) {
        throw new ValidationException("Permission missing or not valid");
    }//from w w w.j a va  2s.  co  m

    try {
        UUID.fromString(uuid);
    } catch (IllegalArgumentException e) {
        throw new ValidationException("Cannot parse UUID from " + fieldName);
    }

    return true;
}

From source file:de.kaiserpfalzEdv.commons.dto.IdentityDTO.java

public IdentityDTO(final String id) {
    this.id = UUID.fromString(id);
}

From source file:com.consol.citrus.samples.todolist.web.TodoController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody//from  ww  w.  j  a  va  2s  .  c o m
public TodoEntry getEntry(@PathVariable(value = "id") String id) {
    return todoListService.getEntry(UUID.fromString(id));
}

From source file:org.openlmis.fulfillment.service.ConfigurationSettingService.java

public UUID getTransferInReasonId() {
    return UUID.fromString(env.getProperty(TRANSFER_IN));
}

From source file:com.haulmont.cuba.client.testsupport.TestUserSessionSource.java

@Override
public synchronized UserSession getUserSession() {
    if (session == null) {
        User user = new User();
        user.setId(UUID.fromString(USER_ID));
        user.setLogin("test_admin");
        user.setName("Test Administrator");
        user.setPassword(DigestUtils.md5Hex("test_admin"));

        session = new UserSession(UUID.randomUUID(), user, Collections.<Role>emptyList(), Locale.ENGLISH,
                false);/*w  w  w.  ja  v a 2  s  .c  om*/
    }
    return session;
}

From source file:org.trustedanalytics.cloud.cc.api.utils.UuidJsonDeserializer.java

@Override
public UUID deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
        throws IOException {

    try {//from   w  ww  . j a  v a 2s.c  o m
        return UUID.fromString(jsonParser.getValueAsString());
    } catch (IllegalArgumentException e) {
        LOGGER.debug("Unable to deserialize GUID: {}, exception: {}", jsonParser.getValueAsString(), e);
        return ARTIFICIAL_USER_GUID;
    }
}

From source file:com.thinkbiganalytics.metadata.core.BaseId.java

public BaseId(Serializable ser) {
    if (ser instanceof String) {
        String uuid = (String) ser;
        if (!StringUtils.contains(uuid, "-")) {
            uuid = ((String) ser).replaceFirst(
                    "([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)",
                    "$1-$2-$3-$4-$5");
        }/*from  ww  w . java2 s.  c  om*/
        setUuid(UUID.fromString(uuid));

    } else if (ser instanceof UUID) {
        setUuid((UUID) ser);
    } else {
        throw new IllegalArgumentException("Unknown ID value: " + ser);
    }
}

From source file:com.microsoft.visualstudio.services.account.AccountHttpClient.java

public Profile getMyProfile() {
    final UUID locationId = UUID.fromString("f83735dc-483f-4238-a291-d45f6080a9af");
    final ApiResourceVersion apiVersion = new ApiResourceVersion("3.0-preview.1"); //$NON-NLS-1$
    final Map<String, Object> routeValue = new HashMap<String, Object>();
    routeValue.put("id", "me");

    final Invocation httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValue, apiVersion,
            APPLICATION_JSON_TYPE);//  w w w.ja  v  a  2 s.  com

    return super.sendRequest(httpRequest, Profile.class);
}

From source file:com.tollefoto.tetravex.Highscore.java

public Highscore(JSONObject json) throws JSONException {
    mId = UUID.fromString(json.getString(JSON_ID));
    setBoardSize(json.getInt(JSON_BOARDSIZE));
    setMoves(json.getInt(JSON_MOVES));//from   w w w.  j a  va  2  s  .  c o  m
    setTimer(json.getString(JSON_TIMER));
}

From source file:com.capitalone.commander.example.kafka_streams.CustomerController.java

@RequestMapping("/customers/:id")
public Customer customer(@RequestParam(value = "id") String idStr) {
    UUID id = UUID.fromString(idStr);
    return customerStore.getCustomer(id);
}