List of usage examples for java.util UUID toString
public String toString()
From source file:com.esri.geoportal.harvester.beans.BrokerDefinitionManagerBean.java
@Override public boolean update(UUID id, EntityDefinition brokerDef) throws CrudlException { brokerDef.setRef(id.toString()); try (Connection connection = dataSource.getConnection(); PreparedStatement st = connection .prepareStatement("UPDATE BROKERS SET brokerDefinition = ? WHERE ID = ?");) { st.setString(1, serialize(brokerDef)); st.setString(2, id.toString());// ww w. ja va 2s . c o m return st.executeUpdate() > 0; } catch (SQLException | IOException ex) { throw new CrudlException("Error updating broker definition", ex); } }
From source file:org.energyos.espi.common.repositories.jpa.ApplicationInformationRepositoryImpl.java
@Override public ApplicationInformation findByUUID(UUID uuid) { return (ApplicationInformation) em.createNamedQuery(ApplicationInformation.QUERY_FIND_BY_UUID) .setParameter("uuid", uuid.toString().toUpperCase()).getSingleResult(); }
From source file:org.energyos.espi.common.repositories.jpa.MeterReadingRepositoryImpl.java
@Override public MeterReading findByUUID(UUID uuid) { return (MeterReading) em.createNamedQuery(MeterReading.QUERY_FIND_BY_UUID) .setParameter("uuid", uuid.toString().toUpperCase()).getSingleResult(); }
From source file:com.yoshio3.backingbean.PhotoUploader.java
public void sendPhoto(CaptureEvent captureEvent) { // try {//from www. ja v a 2 s. com // ???? UUID uuid = UUID.randomUUID(); String fileName = uuid.toString() + IMAGE_FORMAT_EXTENSION; byte[] data = captureEvent.getData(); // // Azure Storage ?? storageService.uploadFile(data, fileName); // // ??? URL fileURL = AZURE_BLOG_UPLOAD_URL + fileName; CompletableFuture<Void> f = serviceInvoker.getFaceInfo(fileURL).thenAccept(face -> { log.info("face => {}", face); this.age = face.getAge(); this.gender = face.getGender(); }); CompletableFuture<Void> e = serviceInvoker.getEmotionInfo(fileURL).thenAccept(emotion -> { log.info("emotion => {}", emotion); this.anger = emotion.getAnger(); this.contempt = emotion.getContempt(); this.disgust = emotion.getDisgust(); this.fear = emotion.getFear(); this.happiness = emotion.getHappiness(); this.neutral = emotion.getNeutral(); this.sadness = emotion.getSadness(); this.surprise = emotion.getSurprise(); }); try { CompletableFuture.allOf(f, e).get(); } catch (InterruptedException | ExecutionException ex) { log.error("Service call failed!", ex); } }
From source file:eu.openanalytics.rsb.data.FileResultStore.java
private File getResultFile(final String applicationName, final String userName, final UUID jobId) { final String jobIdAsString = jobId.toString(); final File[] resultFiles = getResultsDirectory(applicationName, userName).listFiles(new FilenameFilter() { public boolean accept(final File dir, final String name) { return jobIdAsString.equals(StringUtils.substringBefore(name, ".")); }// w ww. j a va2s . c o m }); if ((resultFiles == null) || (resultFiles.length == 0)) { return null; } if (resultFiles.length > 1) { throw new IllegalStateException("Found " + resultFiles.length + " results for job Id: " + jobId); } return resultFiles[0]; }
From source file:com.marc.lastweek.business.services.images.impl.ImageServiceImpl.java
public Folder createRandomDir(String basePath) { UUID uuid = UUID.randomUUID(); Folder folder = new Folder(basePath, uuid.toString()); folder.mkdir();// www.j av a2s .c o m return folder; }
From source file:gov.nih.nci.cagrid.portal.portlet.workflow.mvc.NewInstanceFormController.java
@Override protected void processFormSubmission(ActionRequest request, ActionResponse response, Object command, BindException errors) throws Exception { String id = PortletRequestUtils.getStringParameter(request, "id", "NaN"); log.debug("processFormSubmission. action: " + PortletRequestUtils.getStringParameter(request, "action", "NaN") + " | id - " + id); SubmitWorkflowCommand cmd = (SubmitWorkflowCommand) command; log.debug("Command Object: " + cmd.getTheWorkflow()); try {/*from ww w . j a va2 s . c o m*/ WorkflowDescription selectedWorkflow = registry.getWorkflow(id); log.info("Submitting the selected workflow.. #" + id); String tempFilePath = saveWorkflowDefinition(selectedWorkflow); EndpointReferenceType epr = workflowService.submitWorkflow(selectedWorkflow.getName(), tempFilePath, cmd.getInputValues()); UUID uuid = UUID.randomUUID(); log.debug("Will submit UUID : " + uuid.toString()); eprs.put(uuid.toString(), new WorkflowSubmitted(epr, selectedWorkflow, "Submitted")); cmd.setResult("The Workflow was submitted successfully."); log.info("The Workflow was submitted successfully."); } catch (Throwable e) { log.error("Error submitting workflow", e); Throwable ex = e.getCause(); while (ex.getCause() != null) { ex = ex.getCause(); } cmd.setResult(e.getClass().getSimpleName() + " submitting workflow: " + e.getMessage()); } }
From source file:org.trustedanalytics.servicebroker.hdfs.users.GroupMappingOperations.java
public UUID createSysUser(UUID groupId, UUID userId, String password) throws ServiceBrokerException { UUID uaaUserId = uaaUsersOperations.createUser(userId, password); try {//from ww w . ja va2 s. c o m restTemplate.postForObject(configuration.getUrl().concat(USER_GROUP_ENDPOINT), new User(uaaUserId.toString()), String.class, groupId.toString().concat(TECH_GROUP_POSTFIX)); return uaaUserId; } catch (RestClientException e) { throw new ServiceBrokerException( String.format("Can't add user %s to group: %s", uaaUserId.toString(), groupId), e); } }
From source file:org.ovirt.engine.sdk.decorators.ClusterGlusterHooks.java
/** * Fetches ClusterGlusterHook object by id. * * @return//from w ww . j ava 2s . co m * {@link ClusterGlusterHook } * * @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 ClusterGlusterHook 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.GlusterHook.class, ClusterGlusterHook.class); }
From source file:org.ovirt.engine.sdk.decorators.DataCenterQuotas.java
/** * Fetches DataCenterQuota object by id. * * @return/*w w w . j a va 2 s.com*/ * {@link DataCenterQuota } * * @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 DataCenterQuota 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.Quota.class, DataCenterQuota.class); }