List of usage examples for java.util UUID toString
public String toString()
From source file:org.energyos.espi.common.repositories.jpa.ElectricPowerQualitySummaryRepositoryImpl.java
@Override public ElectricPowerQualitySummary findByUUID(UUID uuid) { return (ElectricPowerQualitySummary) em.createNamedQuery(ElectricPowerQualitySummary.QUERY_FIND_BY_UUID) .setParameter("uuid", uuid.toString().toUpperCase()).getSingleResult(); }
From source file:org.energyos.espi.common.repositories.jpa.AuthorizationRepositoryImpl.java
@Override public Authorization findByUUID(UUID uuid) { return (Authorization) em.createNamedQuery(Authorization.QUERY_FIND_BY_UUID) .setParameter("uuid", uuid.toString().toUpperCase()).getSingleResult(); }
From source file:lydichris.smashbracket.persistence.UserPersistence.java
public User createUser(String username, byte[] passwordHash, String email) { UUID uuid = UUID.randomUUID(); String SQL = "insert into users (username, Userid, passwordhash, email) values (?, ?, ?, ?)"; jdbcTemplateObject.update(SQL, username, uuid.toString(), passwordHash, email); return new User(uuid.toString(), username, email); }
From source file:org.ng200.openolympus.services.StorageService.java
@PreAuthorize(SecurityExpressionConstants.IS_ADMIN) public Path createTaskJudgeDirectory(Task task) throws IOException { final UUID uuid = UUID.randomUUID(); final Path dir = FileSystems.getDefault().getPath(this.storagePath, "tasks", "judges", uuid.toString()); FileAccess.createDirectories(dir);// w w w . ja va2 s . c o m task.setTaskLocation(uuid.toString()); return dir; }
From source file:nl.knaw.huygens.alexandria.endpoint.resource.ResourcePrototypeTest.java
@Test public void testResourcePrototypeFromJson() throws IOException { UUID uuid = UUID.randomUUID(); Instant instant = Instant.now(); String json = singleQuotesToDouble("{"// + "'resource':{"// + "'id':'" + uuid.toString() + "',"// + "'ref':'whatever',"// + "'provenance':{"// + "'when':'" + instant + "'"// + "}"// + "}}"); Log.info("json={}", json); ResourcePrototype rp = om.readValue(json, ResourcePrototype.class); Log.info("resourcePrototype={}", rp); assertThat(rp.getId().getValue()).isEqualTo(uuid); assertThat(rp.getRef()).isEqualTo("whatever"); assertThat(rp.getProvenance().isPresent()).isTrue(); assertThat(rp.getProvenance().get().getWhen()).isEqualTo(instant); assertThat(rp.getProvenance().get().getValue().getWho()).isEqualTo(ThreadContext.getUserName()); assertThat(rp.getProvenance().get().getValue().getWhy()).isEqualTo(AlexandriaProvenance.DEFAULT_WHY); }
From source file:org.ovirt.engine.sdk.decorators.SchedulingPolicyUnits.java
/** * Fetches SchedulingPolicyUnit object by id. * * @return {@link SchedulingPolicyUnit } * * @throws ClientProtocolException// w w w . jav a2 s . c om * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public SchedulingPolicyUnit get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.SchedulingPolicyUnit.class, SchedulingPolicyUnit.class); }
From source file:com.spectralogic.ds3client.commands.GetObjectRequest.java
public GetObjectRequest withJob(final UUID job) { this.job = job.toString(); this.updateQueryParam("job", job); return this; }
From source file:org.trustedanalytics.servicebroker.hive.plans.binding.HiveBindingClient.java
@Override public Map<String, Object> createCredentialsMap(UUID serviceInstanceId) { Map<String, Object> credentialsCopy = new HashMap<>(credentials.getCredentialsMap()); String dbName = DbNameNormalizer.create().normalize(serviceInstanceId.toString()); String connectionUrl = String.format("jdbc:hive2://%s:%d/%s%s", this.hiveServerHost, this.hiveServerPort, dbName, kerberosSpecific()); credentialsCopy.put("connectionUrl", connectionUrl); return credentialsCopy; }
From source file:de.pksoftware.springstrap.cms.service.CmsService.java
public String convertBase64Images(String modelName, String path, String value) { Pattern base64ImagePattern = Pattern.compile( "\\<img.+src\\=\\\"data\\:(image\\/[a-z]+)\\;base64\\,([a-zA-Z0-9\\+\\/]+[\\=]*)\\\"[^\\>]*\\>"); Pattern fileNamePattern = Pattern.compile("data\\-filename\\=\\\"([\\w\\.\\-\\(\\)]+)\\\""); Matcher base64ImageMatcher = base64ImagePattern.matcher(value); if (base64ImageMatcher.find()) { String imgTag = base64ImageMatcher.group(0); logger.info("Found img tag: {}", imgTag); String mimeType = base64ImageMatcher.group(1); String base64Image = base64ImageMatcher.group(2); logger.info("Found {} Image: {}", mimeType, base64Image); Matcher fileNameMatcher = fileNamePattern.matcher(imgTag); String fileName = null;/*from w w w.j a v a2s. co m*/ if (fileNameMatcher.find()) { fileName = fileNameMatcher.group(1); logger.info("Filename is: {}", fileName); } if (null == fileName) { String fileExtension = getFileExtensionFromMime(mimeType); UUID fileNameUUID = UUID.randomUUID(); fileName = fileNameUUID.toString() + "." + fileExtension; } logger.info("File name is: {}", fileName); String imagePath = "models/" + modelName + "/" + fileName; String finalImagePath = imagePath; /* boolean fileExists = true; int i = 0; while(fileExists){ if(i > 0){ logger.info("File already exists: {}", finalImagePath); finalImagePath = "(" + i + ")" + imagePath; } try { fileExists = fileSystemService.existPublicFile(BUCKET_NAME, finalImagePath); i++; } catch (InvalidPathException | InvalidBucketException e) { break; } } */ byte[] data = Base64.decodeBase64(base64Image); try { SitePath imageSitePath = new SitePath(finalImagePath); fileSystemService.writeFile(ItemVisibility.PUBLIC, cmsBucket, imageSitePath, data, true, true); value = base64ImageMatcher.replaceFirst("<img src=\"" + fileSystemService.getItemURL(ItemVisibility.PUBLIC, cmsBucket, imageSitePath) + "\" />"); } catch (Exception ex) { logger.error("Could not write file: " + ex.getMessage()); } } return value; }
From source file:org.ovirt.engine.sdk.decorators.DataCenterClusterGlusterVolumeStatistics.java
/** * Fetches DataCenterClusterGlusterVolumeStatistic object by id. * * @return// w ww . j a v a2s . c o m * {@link DataCenterClusterGlusterVolumeStatistic } * * @throws ClientProtocolException * Signals that HTTP/S protocol error has occurred. * @throws ServerException * Signals that an oVirt api error has occurred. * @throws IOException * Signals that an I/O exception of some sort has occurred. */ @Override public DataCenterClusterGlusterVolumeStatistic get(UUID id) throws ClientProtocolException, ServerException, IOException { String url = this.parent.getHref() + SLASH + getName() + SLASH + id.toString(); return getProxy().get(url, org.ovirt.engine.sdk.entities.Statistic.class, DataCenterClusterGlusterVolumeStatistic.class); }