List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public VM getVmById(String vmid) { try {//from w w w.j ava2 s.c om return this.api.getVMs().get(UUID.fromString(vmid)); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getMessage(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }
From source file:eu.dasish.annotation.backend.dao.impl.JdbcCachedRepresentationDaoTest.java
/** * Test of getExternalId method, of class JdbcCachedRepresentationDao. * public UUID getExternalId(Number internalID); * *//* w ww. j av a2 s .c o m*/ @Test public void testGetExternalId() { System.out.println("getExternalId"); UUID expResult = UUID.fromString("00000000-0000-0000-0000-000000000051"); UUID result = jdbcCachedRepresentationDao.getExternalID(1); assertEquals(expResult, result); }
From source file:org.trustedanalytics.servicebroker.hdfs.plans.HdfsPlanGetUserDirectory.java
@Override public Map<String, Object> bind(ServiceInstance serviceInstance) throws ServiceBrokerException { UUID instanceId = UUID.fromString(serviceInstance.getServiceInstanceId()); UUID orgId = UUID.fromString(serviceInstance.getOrganizationGuid()); Map<String, Object> configurationMap = bindingOperations.createCredentialsMap(instanceId, orgId); Map<String, Object> storedCredentials = credentialsStore.get(instanceId); if (getParameterUri(storedCredentials, URI_KEY).isPresent()) { configurationMap.remove(URI_KEY); }/* ww w . jav a 2 s. c o m*/ Map<String, Object> credentials = new HashMap<>(); credentials.putAll(configurationMap); credentials.putAll(storedCredentials); return credentials; }
From source file:com.onyxscheduler.domain.Job.java
public static Job fromQuartzJobDetailAndTriggers(JobDetail jobDetail, Set<? extends org.quartz.Trigger> triggers) { try {//from w w w . j a v a 2 s. c om Job job = (Job) jobDetail.getJobClass().newInstance(); org.quartz.JobKey jobKey = jobDetail.getKey(); job.setId(UUID.fromString((String) jobDetail.getJobDataMap().remove(ID_DATAMAP_KEY))); job.setName(jobKey.getName()); job.setGroup(jobKey.getGroup()); job.setTriggers(triggers.stream().map(Trigger::fromQuartzTrigger).collect(Collectors.toSet())); job.initFromDataMap(jobDetail.getJobDataMap()); return job; } catch (InstantiationException | IllegalAccessException e) { throw Throwables.propagate(e); } }
From source file:com.urbancode.ud.client.PropertyClient.java
public UUID createPropDef(UUID propSheetDefId, String propSheetDefPath, String name, String description, String label, Boolean required, String type, String value) throws IOException, JSONException { UUID result;/*from w w w . j a v a2 s. c om*/ String uri = url + "/property/propSheetDef/" + encodePath(propSheetDefPath) + ".-1/propDefs"; JSONObject propDefObject = new JSONObject(); propDefObject.put("name", name); propDefObject.put("description", description); propDefObject.put("label", label); propDefObject.put("required", required.toString()); propDefObject.put("type", type); propDefObject.put("value", value); propDefObject.put("definitionGroupId", propSheetDefId); HttpPut method = new HttpPut(uri); method.setEntity(getStringEntity(propDefObject)); HttpResponse response = invokeMethod(method); String body = getBody(response); result = UUID.fromString(new JSONObject(body).getString("id")); return result; }
From source file:org.stockwatcher.web.WatchListController.java
@RequestMapping(value = "/{watchListId}", method = RequestMethod.GET) public String displayWatchListDetail(@PathVariable String watchListId, Model model, HttpServletRequest request) {/* w w w . j a v a2 s. com*/ UUID id = UUID.fromString(watchListId); model.addAttribute("watchList", watchListDAO.getWatchList(id)); model.addAttribute("watchListItems", watchListDAO.getWatchListItems(id)); return "watchList"; }
From source file:com.termmed.idcreation.IdCreation.java
/** * Execute./* w w w .j a va 2 s . c o m*/ * * @throws IOException Signals that an I/O exception has occurred. */ public void execute() throws IOException { IdAssignmentBI idAssignment = new IdAssignmentImpl(endPointURL, username, pass); File relFile = new File(componentFile); File newRelFile = new File(relFile.getParent(), "uuids_" + relFile.getName()); FileInputStream rfis = new FileInputStream(componentFile); InputStreamReader risr = new InputStreamReader(rfis, "UTF-8"); BufferedReader rbr = new BufferedReader(risr); String header = rbr.readLine(); FileOutputStream fos = new FileOutputStream(newRelFile); OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); BufferedWriter bw = new BufferedWriter(osw); bw.append(header); bw.append("\r\n"); String line; String[] spl; int i; UUID uuid; List<UUID> list = new ArrayList<UUID>(); while ((line = rbr.readLine()) != null) { spl = line.split("\t", -1); Long sctid = null; try { sctid = Long.parseLong(spl[0]); bw.append(line); bw.append("\r\n"); } catch (Exception e) { try { uuid = UUID.fromString(spl[0]); } catch (Exception e2) { uuid = UUID.randomUUID(); } list.add(uuid); bw.append(uuid.toString()); bw.append("\t"); for (i = 1; i < spl.length; i++) { bw.append(spl[i]); if (i == spl.length - 1) { bw.append("\r\n"); } else { bw.append("\t"); } } } } bw.close(); bw = null; rbr.close(); rbr = null; HashMap<UUID, Long> sctIdMap = new HashMap<UUID, Long>(); String sPart = ("0" + String.valueOf(partitionId)).substring(0, 2); try { sctIdMap = idAssignment.createSCTIDList(list, namespaceId, sPart, releaseDate, releaseDate, releaseDate); } catch (Exception cE) { log.error("Message : SCTID creation error for list ", cE); } File finalRelFile = new File(relFile.getParent(), "tmp_" + relFile.getName()); rfis = new FileInputStream(newRelFile); risr = new InputStreamReader(rfis, "UTF-8"); rbr = new BufferedReader(risr); header = rbr.readLine(); fos = new FileOutputStream(finalRelFile); osw = new OutputStreamWriter(fos, "UTF-8"); bw = new BufferedWriter(osw); bw.append(header); bw.append("\r\n"); while ((line = rbr.readLine()) != null) { spl = line.split("\t", -1); if (spl[0].contains("-")) { uuid = UUID.fromString(spl[0]); Long id = sctIdMap.get(uuid); if (id != null) { bw.append(id.toString()); bw.append("\t"); for (i = 1; i < spl.length; i++) { bw.append(spl[i]); if (i == spl.length - 1) { bw.append("\r\n"); } else { bw.append("\t"); } } } else { bw.append(line); bw.append("\r\n"); } } else { bw.append(line); bw.append("\r\n"); } } bw.close(); bw = null; rbr.close(); rbr = null; if (newRelFile.exists()) { newRelFile.delete(); } if (relFile.exists()) { String inputFile = relFile.getAbsolutePath(); File reconFile = new File(relFile.getParent(), "Reconcil_" + relFile.getName()); relFile.renameTo(reconFile); File outFile = new File(inputFile); finalRelFile.renameTo(outFile); } }
From source file:io.restassured.test.osgi.XmlPathOSGiITest.java
@Test public void getUUIDParsesAStringResultToUUID() throws Exception { final String UUID_XML = "<some>\n" + " <thing id=\"1\">db24eeeb-7fe5-41d3-8f06-986b793ecc91</thing>\n" + " <thing id=\"2\">d69ded28-d75c-460f-9cbe-1412c60ed4cc</thing>\n" + "</some>"; final UUID uuid = from(UUID_XML).getUUID("some.thing[0]"); assertThat(uuid, Matchers.equalTo(UUID.fromString("db24eeeb-7fe5-41d3-8f06-986b793ecc91"))); }
From source file:com.haulmont.cuba.core.jmx.PasswordEncryptionSupport.java
@Override public String getSpecificPasswordHash(String userId, String password, String method) { UUID userUUID;//from www . j a v a2 s. c om try { userUUID = UUID.fromString(userId); } catch (Exception e) { return "Invalid user Id"; } EncryptionModule module; try { module = getEncryptionModule(method); } catch (UnsupportedHashMethodException ex) { return UNSUPPORTED_HASH_METHOD; } return module.getPasswordHash(userUUID, password); }
From source file:org.trustedanalytics.user.orgs.SpacesController.java
@ApiOperation(value = "Getting a list of spaces of given organization current user has access to.", notes = "Privilege level: Any consumer of this endpoint must have a valid access token") @ApiResponses(value = {/*from w w w .j ava 2 s. c o m*/ @ApiResponse(code = 200, message = "OK", response = CcSpace.class, responseContainer = "List"), @ApiResponse(code = 500, message = "Internal server error, e.g. error connecting to CloudController") }) @RequestMapping(value = GET_SPACES_OF_ORG_URL, method = GET, produces = APPLICATION_JSON_VALUE) public Collection<CcSpace> getSpaces(@PathVariable String org) { return ccClient.getSpaces(UUID.fromString(org)).toList().toBlocking().single(); }