List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:com.haulmont.cuba.core.controllers.FileUploadController.java
private UserSession getSession(HttpServletRequest request, HttpServletResponse response) throws IOException { UUID sessionId;//from ww w . ja v a 2s . c om try { sessionId = UUID.fromString(request.getParameter("s")); } catch (Exception e) { log.error("Error parsing sessionId from URL param", e); response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } UserSession session = userSessions.getAndRefresh(sessionId); if (session == null) response.sendError(HttpServletResponse.SC_FORBIDDEN); return session; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccAccountEntryPKey.java
public CFAccAccountEntryPKey() { requiredTenantId = CFAccAccountEntryBuff.TENANTID_INIT_VALUE; requiredAccountId = CFAccAccountEntryBuff.ACCOUNTID_INIT_VALUE; requiredEntryId = UUID.fromString(CFAccAccountEntryBuff.ENTRYID_INIT_VALUE.toString()); }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanGetUserDirectory.java
@Override public void provision(ServiceInstance serviceInstance, Optional<Map<String, Object>> parameters) throws ServiceInstanceExistsException, ServiceBrokerException { if (!isMapNotNullAndNotEmpty(parameters)) { throw new ServiceBrokerException("This plan require parametere uri"); }/*from ww w .ja v a2 s . co m*/ String uri = getParameterUri(parameters.get(), URI_KEY) .orElseThrow(() -> new ServiceBrokerException("No required parameter uri")).toString(); LOGGER.info("Detected parameter path: " + uri); HdfsBrokerInstancePath instance = HdfsBrokerInstancePath.createInstance(uri); credentialsStore.save(ImmutableMap.<String, Object>builder() .putAll(credentialsStore.get(instance.getInstanceId())).put(URI_KEY, uri).build(), UUID.fromString(serviceInstance.getServiceInstanceId())); }
From source file:com.cnaude.mutemanager.UUIDFetcher.java
private static UUID getUUID(String id) { return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); }
From source file:com.blackducksoftware.integration.hub.api.report.DetailedReleaseSummary.java
public UUID getProjectUUId() { if (StringUtils.isBlank(projectId)) { return null; }//from w w w. ja v a 2s . c om try { return UUID.fromString(projectId); } catch (final IllegalArgumentException e) { return null; } }
From source file:com.publicuhc.pluginframework.util.UUIDFetcher.java
public Map<String, UUID> call() throws IOException, ParseException, InterruptedException { Map<String, UUID> playerMap = new HashMap<String, UUID>(); int requests = (int) Math.ceil(m_names.size() / QUERIES_PER_REQUEST); for (int i = 0; i < requests; i++) { HttpURLConnection connection = getConnection(); String query = JSONArray/*ww w . j av a 2s . c o m*/ .toJSONString(m_names.subList(i * 100, Math.min((i + 1) * 100, m_names.size()))); writeQuery(connection, query); JSONArray parsedArray = (JSONArray) m_jsonParser .parse(new InputStreamReader(connection.getInputStream())); for (Object player : parsedArray) { JSONObject jsonPlayer = (JSONObject) player; String id = (String) jsonPlayer.get("id"); String name = (String) jsonPlayer.get("name"); UUID playerID = UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); playerMap.put(name, playerID); } if (i != requests - 1) { Thread.sleep(100L); } } return playerMap; }
From source file:com.esri.geoportal.harvester.migration.MigrationDataBuilder.java
public DataReference buildReference(MigrationData data, String xml) throws URISyntaxException, UnsupportedEncodingException { SimpleDataReference ref = new SimpleDataReference(createBrokerUri(data), definition.getEntityDefinition().getLabel(), data.docuuid, data.updateDate, createSourceUri(data), null, null);/*from w ww . ja va 2s. c o m*/ ref.addContext(MimeType.APPLICATION_XML, xml.getBytes("UTF-8")); String owner = userMap.get(data.owner); if (owner != null) { ref.getAttributesMap().put("owner", owner); } if (definition.getPreserveUuids() && data.docuuid != null) { try { ref.getAttributesMap().put("uuid", UUID.fromString(data.docuuid.replaceAll("[\\{\\}]", ""))); } catch (IllegalArgumentException ex) { } } return ref; }
From source file:com.galeoconsulting.leonardinius.api.impl.ScriptSessionManagerImpl.java
private SessionId validSessionId(final SessionId sessionId) { return SessionId.valueOf(UUID.fromString(sessionId.getSessionId()).toString()); }
From source file:eu.dasish.annotation.backend.dao.impl.JdbcPrincipalDaoTest.java
/** * Test of getInternalID method, of class JdbcPrincipalDao. Number * getInternalID(UUID UUID);/*from ww w . j av a2 s. c om*/ */ @Test public void testGetInternalID() throws NotInDataBaseException { Number testOne = jdbcPrincipalDao.getInternalID(UUID.fromString("00000000-0000-0000-0000-000000000113")); assertEquals(3, testOne.intValue()); try { Number testTwo = jdbcPrincipalDao .getInternalID(UUID.fromString("00000000-0000-0000-0000-000000000ccc")); assertEquals(null, testTwo); } catch (NotInDataBaseException e) { System.out.println(e); } }
From source file:com.avatarproject.core.storage.UserCache.java
/** * Gets a UUID of a user from the custom UserCache. * @param playername String name of the player to get. * @return UUID of the player./*from w ww.j a va2 s . com*/ */ public static UUID getUser(String playername) { JSONArray array = getUserCache(); try { for (int n = 0; n < array.size(); n++) { //Loop through all the objects in the array. JSONObject object = (JSONObject) array.get(n); if (String.valueOf(object.get("name")).equalsIgnoreCase(playername)) { return UUID.fromString(String.valueOf(object.get("id"))); } } } catch (Exception e) { e.printStackTrace(); } return null; }