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:fm.last.musicbrainz.data.dao.impl.ReleaseDaoImplIT.java

@Test
public void getByExistingGidReturnsOneReleaseThatHasNoRedirectedGids() {
    UUID gid = UUID.fromString("f80addb0-1f8c-3c37-a4a9-6f8867be35fe");
    Release release = dao.getByGid(gid);
    assertThat(release.getName(), is("The Warning"));
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccSecSessionPKey.java

public CFAccSecSessionPKey() {
    requiredSecSessionId = UUID.fromString(CFAccSecSessionBuff.SECSESSIONID_INIT_VALUE.toString());
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCash.CFGCashSecUserPKey.java

public CFGCashSecUserPKey() {
    requiredSecUserId = UUID.fromString(CFGCashSecUserBuff.SECUSERID_INIT_VALUE.toString());
}

From source file:org.ohmage.query.impl.SurveyResponseImageQueries.java

public List<UUID> getImageIdsFromSurveyResponse(UUID surveyResponseId) throws DataAccessException {
    try {/*  www .j  ava  2s  . c o m*/
        return getJdbcTemplate().query(SQL_GET_IMAGE_IDS_FROM_SURVEY_RESPONSE,
                new Object[] { surveyResponseId.toString() }, new RowMapper<UUID>() {
                    @Override
                    public UUID mapRow(ResultSet rs, int rowNum) throws SQLException {

                        String response = rs.getString("response");
                        try {
                            return UUID.fromString(response);
                        } catch (IllegalArgumentException notUuid) {
                            try {
                                NoResponse.valueOf(response.toUpperCase());
                                return null;
                            } catch (IllegalArgumentException notNoResponse) {
                                throw new SQLException("The response value is not a valid UUID.",
                                        notNoResponse);
                            }
                        }
                    }
                });
    } catch (org.springframework.dao.DataAccessException e) {
        throw new DataAccessException("Error executing SQL '" + SQL_GET_IMAGE_IDS_FROM_SURVEY_RESPONSE
                + "' with parameter: " + surveyResponseId, e);
    }
}

From source file:de.thm.arsnova.controller.SocketController.java

@RequestMapping(method = RequestMethod.POST, value = "/assign")
public void authorize(@RequestBody final Map<String, String> sessionMap, final HttpServletResponse response) {
    String socketid = sessionMap.get("session");
    if (null == socketid) {
        LOGGER.debug("Expected property 'session' missing", socketid);
        response.setStatus(HttpStatus.BAD_REQUEST.value());
        return;//  w  ww .jav a2s  .  c  o m
    }
    User u = userService.getCurrentUser();
    if (null == u) {
        LOGGER.debug("Client {} requested to assign Websocket session but has not authenticated", socketid);
        response.setStatus(HttpStatus.FORBIDDEN.value());
        return;
    }
    userService.putUser2SocketId(UUID.fromString(socketid), u);
    userSessionService.setSocketId(UUID.fromString(socketid));
    response.setStatus(HttpStatus.NO_CONTENT.value());
}

From source file:com.igormaznitsa.sciareto.preferences.PreferencesManager.java

private PreferencesManager() {
    this.prefs = Preferences.userNodeForPackage(PreferencesManager.class);
    String packedUuid = this.prefs.get(PROPERTY_UUID, null);
    if (packedUuid == null) {
        try {/*from  w  w w  . ja v  a  2  s . c o m*/
            final UUID newUUID = UUID.randomUUID();
            packedUuid = Base64.encodeBase64String(IOUtils.packData(newUUID.toString().getBytes("UTF-8")));
            this.prefs.put(PROPERTY_UUID, packedUuid);
            this.prefs.flush();
            LOGGER.info("Generated new installation UUID : " + newUUID.toString());

            final Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    LOGGER.info("Send first start metrics");
                    com.igormaznitsa.sciareto.metrics.MetricsService.getInstance().onFirstStart();
                }
            }, "SCIARETO_FIRST_START_METRICS");
            thread.setDaemon(true);
            thread.start();

        } catch (Exception ex) {
            LOGGER.error("Can't generate UUID", ex);
        }
    }
    try {
        this.installationUUID = UUID
                .fromString(new String(IOUtils.unpackData(Base64.decodeBase64(packedUuid)), "UTF-8"));
        LOGGER.info("Installation UUID : " + this.installationUUID.toString());
    } catch (UnsupportedEncodingException ex) {
        LOGGER.error("Can't decode UUID", ex);
        throw new Error("Unexpected error", ex);
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCash.CFGCashSecSessionPKey.java

public CFGCashSecSessionPKey() {
    requiredSecSessionId = UUID.fromString(CFGCashSecSessionBuff.SECSESSIONID_INIT_VALUE.toString());
}

From source file:nl.esciencecenter.octopus.webservice.api.SandboxedJobTest.java

@Before
public void setUp() throws URISyntaxException {
    sandbox = mock(Sandbox.class);
    ojob = mock(Job.class);
    UUID uuid = UUID.fromString("11111111-1111-1111-1111-111111111111");
    when(ojob.getUUID()).thenReturn(uuid);
    request = new JobSubmitRequest();
    request.status_callback_url = new URI("http://localhost/job/status");
    httpClient = mock(HttpClient.class);
    Map<String, String> info = new HashMap<String, String>();
    info.put("status", "STOPPED");
    status = new JobStatusImplementation(ojob, "DONE", 0, null, false, true, info);
    pollIterations = 10;/*from w  w  w .j a  v  a  2 s .  co m*/
    job = new SandboxedJob(sandbox, ojob, request, httpClient, status, pollIterations);
}

From source file:com.feedzai.fos.impl.r.RIntegrationTest.java

@Test
public void addModel() throws Exception {

    BaseConfiguration configuration = new BaseConfiguration();
    Map<String, String> properties = new HashMap<>();
    List<Attribute> attributes = getAttributes();

    String suuid = "d9556c14-97f1-40f6-9514-f6fb339474af";
    UUID uuid = UUID.fromString(suuid);

    ModelConfig modelConfig = new ModelConfig(attributes, properties);
    modelConfig.setProperty("UUID", suuid);

    modelConfig.setProperty(RModelConfig.LIBRARIES, "e1071, foreign");
    modelConfig.setProperty(RModelConfig.MODEL_SAVE_PATH, getCwd());
    modelConfig.setProperty(RModelConfig.CLASS_INDEX, Integer.valueOf(attributes.size() - 1).toString());
    modelConfig.setProperty(RModelConfig.TRAIN_FUNCTION, "svm");
    modelConfig.setProperty(RModelConfig.TRAIN_FUNCTION_ARGUMENTS, "probability = TRUE");
    modelConfig.setProperty(RModelConfig.PREDICT_FUNCTION_ARGUMENTS, "probability = TRUE");
    modelConfig.setProperty(RModelConfig.PREDICT_RESULT_TRANSFORM, "r <- attr(r, 'probabilities')");
    configuration.setProperty(FosConfig.FACTORY_NAME, RManagerFactory.class.getName());

    FosConfig config = new FosConfig(configuration);

    RManagerConfig rManagerConfig = new RManagerConfig(config);

    RManager rManager = new RManager(rManagerConfig);
    rManager.trainFile(modelConfig, getCwd() + "/credit-a.arff");
    rManager.addModel(modelConfig,/*from ww w.  jav  a 2  s  .co m*/
            new ModelDescriptor(ModelDescriptor.Format.BINARY, getCwd() + "/credit-a.arff.model"));

    Scorer scorer = rManager.getScorer();

    Object[] instance = { "b", 30.83, 0, "u", "g", "w", "v", 1.25, "t", "t", 1, "f", "g", 202, 0 };

    List<double[]> result = scorer.score(ImmutableList.of(uuid), instance);
    assertEquals("Only 1 score expected", 1, result.size());
    assertEquals("2 probabilities (not fraud, fraud)", 2, result.get(0).length);

}