List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:org.addsimplicity.anicetus.web.TelemetryServletFilter.java
@SuppressWarnings("unchecked") private void setRequestOnSession(TelemetryHttpSession session, HttpServletRequest request) { session.setMethod(request.getMethod()); session.setProtocol(request.getProtocol()); if (request.getContentType() != null) { session.setContentType(request.getContentType(), HeaderType.Request); }//from w w w . java2 s. c o m session.setRequestURL(request.getRequestURI()); Enumeration<String> pnames = request.getParameterNames(); while (pnames.hasMoreElements()) { String name = pnames.nextElement(); session.setParameter(name, request.getParameter(name)); } Enumeration<String> hnames = request.getHeaderNames(); while (hnames.hasMoreElements()) { String name = hnames.nextElement(); String value = request.getHeader(name); if (value != null) { session.setHeader(name, request.getHeader(name), HeaderType.Request); } } String parent = request.getHeader(s_PARENT_NAME); if (parent == null) { parent = request.getParameter(s_PARENT_NAME); } if (parent != null) { try { UUID parentId = UUID.fromString(parent); session.setParentId(parentId); } catch (IllegalArgumentException iae) { // TODO - Exception handler } } }
From source file:com.haulmont.cuba.gui.components.filter.condition.DynamicAttributesCondition.java
public DynamicAttributesCondition(Element element, String messagesPack, String filterComponentName, Datasource datasource) {/*from w w w . jav a2s. com*/ super(element, messagesPack, filterComponentName, datasource); propertyPath = element.attributeValue("propertyPath"); MessageTools messageTools = AppBeans.get(MessageTools.NAME); locCaption = isBlank(caption) ? element.attributeValue("locCaption") : messageTools.loadString(messagesPack, caption); entityAlias = element.attributeValue("entityAlias"); text = element.getText(); join = element.attributeValue("join"); categoryId = UUID.fromString(element.attributeValue("category")); String categoryAttributeValue = element.attributeValue("categoryAttribute"); if (!Strings.isNullOrEmpty(categoryAttributeValue)) { categoryAttributeId = UUID.fromString(categoryAttributeValue); } else { //for backward compatibility List<Element> paramElements = Dom4j.elements(element, "param"); for (Element paramElement : paramElements) { if (BooleanUtils.toBoolean(paramElement.attributeValue("hidden", "false"), "true", "false")) { categoryAttributeId = UUID.fromString(paramElement.getText()); String paramName = paramElement.attributeValue("name"); text = text.replace(":" + paramName, "'" + categoryAttributeId + "'"); } } } isCollection = Boolean.parseBoolean(element.attributeValue("isCollection")); resolveParam(element); }
From source file:eu.openanalytics.rsb.component.ResultsResource.java
@Path("/{jobId}") @DELETE/*ww w . j a va 2 s . com*/ public Response deleteSingleResult(@PathParam("applicationName") final String applicationName, @PathParam("jobId") final String jobId) throws URISyntaxException, IOException { validateApplicationName(applicationName); validateJobId(jobId); if (!resultStore.deleteByApplicationNameAndJobId(applicationName, getUserName(), UUID.fromString(jobId))) { return Response.status(Status.NOT_FOUND).build(); } else { return Response.noContent().build(); } }
From source file:me.ryvix.claimcommands.functions.FlagsFunctions.java
/** * List values of a flag//from w w w .j a v a 2 s . c o m * * @param loc * @param flag * @return */ public String list(Location loc, String flag) { List<String> values; List<String> outList = new ArrayList<>(); String output; String playerName; try { values = sql.select(plugin.getCcClaim().getGPClaimId(loc), flag); if (values.size() > 0) { if (flag.equalsIgnoreCase("allow")) { for (String value : values) { playerName = plugin.getServer().getOfflinePlayer(UUID.fromString(value)).getName(); if (playerName == null || playerName.isEmpty()) { playerName = "Unknown"; } outList.add(playerName); } } else { for (String value : values) { outList.add(value); } } output = StringUtils.join(outList, ", "); output = ChatColor.GREEN + flag + ": " + ChatColor.GOLD + output; } else { output = ChatColor.RED + "No values found for " + flag; } } catch (SQLException e) { plugin.getLogger().log(Level.WARNING, "Error: {0}", e.getMessage()); return ChatColor.RED + "Sorry, there was an error retrieving values for " + flag; } return output; }
From source file:com.amossys.hooker.common.InterceptEvent.java
/** * Constructor which will be used to read in the Parcel. * @param in//from www. ja va 2 s . co m */ private InterceptEvent(Parcel in) { idEvent = UUID.fromString(in.readString()); IDXP = in.readString(); timestamp = in.readLong(); relativeTimestamp = in.readLong(); hookerName = in.readString(); intrusiveLevel = in.readInt(); instanceID = in.readInt(); packageName = in.readString(); className = in.readString(); methodName = in.readString(); readParametersList(in); readReturnsEntry(in); readDataMap(in); }
From source file:com.haulmont.cuba.web.controllers.LogDownloadController.java
protected UserSession getSession(String sessionId, HttpServletResponse response) throws IOException { UUID sessionUUID;/*from w w w . ja va 2s . c om*/ try { sessionUUID = UUID.fromString(sessionId); } catch (Exception e) { log.error("Error parsing sessionId from URL param", e); response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } AppContext.setSecurityContext(new SecurityContext(sessionUUID)); try { UserSession session = userSessionService.getUserSession(sessionUUID); if (session == null) response.sendError(HttpServletResponse.SC_FORBIDDEN); return session; } finally { AppContext.setSecurityContext(null); } }
From source file:com.haulmont.cuba.portal.controllers.LogDownloadController.java
protected UserSession getSession(String sessionId, HttpServletResponse response) throws IOException { UUID sessionUUID;/*from ww w .ja va 2 s . co m*/ try { sessionUUID = UUID.fromString(sessionId); } catch (Exception e) { log.error("Error parsing sessionId from URL param", e); response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } AppContext.setSecurityContext(new SecurityContext(sessionUUID)); try { UserSession session = userSessionService.getUserSession(sessionUUID); if (session == null) response.sendError(HttpServletResponse.SC_FORBIDDEN); return session; } finally { AppContext.setSecurityContext(null); } }
From source file:com.jim.im.login.rpc.LoginRpcServiceImpl.java
/** * redis result Map resove to bean Info/*from w ww. j ava 2s . c om*/ * @param map * @return */ private TerminalSessionInfo redisMap2Info(Map<Object, Object> map) { TerminalSessionInfo info = new TerminalSessionInfo(); String osType = (String) map.get("OsType"); String sessionID = (String) map.get("sessionID"); String devicetoken = (String) map.get("devicetoken"); String userID = (String) map.get("userID"); String terminalStatus = (String) map.get("TerminalStatus"); info.setUserID(userID); info.setSessionID(UUID.fromString(sessionID)); info.setDeviceToken(StringUtils.isEmpty(devicetoken) ? null : devicetoken); info.setTerminalStatus(StringUtils.isEmpty(terminalStatus) ? null : TerminalStatus.valueOf(terminalStatus)); info.setOsType(StringUtils.isEmpty(osType) ? OsType.NONE : OsType.valueOf(osType)); return info; }
From source file:io.sidecar.client.SidecarUserClient.java
/************************************** * Event Publication/*from w w w .j a va 2 s. c om*/ *************************************/ public UUID postEvent(Event event) { try { URL endpoint = clientConfig.fullUrlForPath("/rest/v1/event"); SidecarPostRequest sidecarPostRequest = new SidecarPostRequest.Builder(accessKey.getKeyId(), "", accessKey.getSecret()).withSignatureVersion(ONE).withUrl(endpoint).withPayload(event).build(); SidecarResponse response = sidecarPostRequest.send(); if (response.getStatusCode() == 202) { String s = response.getBody(); JsonNode json = mapper.readTree(s); System.out.println(json); return UUID.fromString(json.path("id").asText()); } else { throw new SidecarClientException(response.getStatusCode(), response.getBody()); } } catch (Exception e) { throw propagate(e); } }
From source file:ac.dynam.rundeck.plugin.resources.ovirt.oVirtSDKWrapper.java
public Action stopVm(String vmid) { try {/* w ww . j a va2 s .c om*/ VM vm = this.api.getVMs().get(UUID.fromString(vmid)); return vm.stop(new Action()); } catch (ClientProtocolException e) { this.message = "Protocol Exception: " + e.getMessage(); } catch (ServerException e) { this.message = "Server Exception: " + e.getReason() + ": " + e.getDetail(); } catch (IOException e) { this.message = "IOException Exception: " + e.getMessage(); } return null; }