List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.CFAstSecUserHPKey.java
public CFAstSecUserHPKey() { super(); requiredSecUserId = UUID.fromString(CFAstSecUserBuff.SECUSERID_INIT_VALUE.toString()); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAst.CFAstSecUserHPKey.java
public CFAstSecUserHPKey() { super(); requiredSecUserId = UUID.fromString(CFAstSecUserBuff.SECUSERID_INIT_VALUE.toString()); }
From source file:com.hp.autonomy.hod.client.api.resource.ResourceTest.java
private void testDeserialization(final String file) throws IOException { final Resource output; try (final InputStream jsonStream = getClass().getResourceAsStream(file)) { output = objectMapper.readValue(jsonStream, Resource.class); }/*from ww w. j a v a2 s.com*/ final Resource expectedOutput = new Resource(UUID.fromString("1f885ea5-9d63-4101-908d-257d300efb72"), "DEFAULT_USER_STORE", "33ed089f-8fe7-451d-82b3-51a06dcdc49b"); assertThat(output, is(expectedOutput)); }
From source file:at.alladin.rmbt.controlServer.LogResource.java
@Post("json") public String request(final String entity) { addAllowOrigin();/* w w w .ja v a 2 s.c o m*/ JSONObject request = null; final ErrorList errorList = new ErrorList(); final JSONObject answer = new JSONObject(); String answerString; final String clientIpRaw = getIP(); final InetAddress clientAddress = InetAddresses.forString(clientIpRaw); System.out.println(MessageFormat.format(labels.getString("NEW_LOG_REQ"), clientIpRaw)); if (entity != null && !entity.isEmpty()) { try { request = new JSONObject(entity); UUID uuid = null; final String uuidString = request.optString("uuid", ""); if (uuidString.length() != 0) { uuid = UUID.fromString(uuidString); } final Platform platform = Platform.valueOf(request.getString("plattform").toUpperCase(Locale.US)); final String logFileName = request.getString("logfile"); final File logPath = new File(LOG_PATH, platform.name().toLowerCase(Locale.US)); final File logFile = new File(logPath, logFileName); final boolean appendClientInfo = !logFile.exists(); try (PrintWriter out = new PrintWriter( new BufferedWriter(new FileWriter(logFile, logFile.exists())))) { final String content = request.getString("content"); request.remove("content"); if (appendClientInfo) { out.println("client IP: " + clientAddress.toString()); out.println("\n#############################################\n"); out.println(request.toString(3)); out.println("\n#############################################\n"); } out.println(content); } final JSONObject fileTimes = request.optJSONObject("file_times"); if (fileTimes != null) { try { final Long created = fileTimes.getLong("created"); final Long lastAccess = fileTimes.getLong("last_access"); final Long lastModified = fileTimes.getLong("last_modified"); BasicFileAttributeView attributes = Files.getFileAttributeView( Paths.get(logFile.getAbsolutePath()), BasicFileAttributeView.class); FileTime lastModifiedTime = FileTime .fromMillis(TimeUnit.MILLISECONDS.convert(lastModified, TimeUnit.SECONDS)); FileTime lastAccessTime = FileTime .fromMillis(TimeUnit.MILLISECONDS.convert(lastAccess, TimeUnit.SECONDS)); FileTime createdTime = FileTime .fromMillis(TimeUnit.MILLISECONDS.convert(created, TimeUnit.SECONDS)); attributes.setTimes(lastModifiedTime, lastAccessTime, createdTime); } catch (Exception e) { } // final Long lastModified = fileTimes.getLong("last_modified"); // logFile.setLastModified(TimeUnit.MILLISECONDS.convert(lastModified, TimeUnit.SECONDS)); } answer.put("status", "OK"); } catch (final JSONException e) { errorList.addError("ERROR_REQUEST_JSON"); System.out.println("Error parsing JSON Data " + e.toString()); } catch (final Exception e) { errorList.addError("ERROR_LOG_WRITE"); System.out.println("Error writing Log " + e.toString()); } } else { errorList.addErrorString("Expected request is missing."); } try { answer.putOpt("error", errorList.getList()); } catch (final JSONException e) { System.out.println("Error saving ErrorList: " + e.toString()); } answerString = answer.toString(); return answerString; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccSecUserHPKey.java
public CFAccSecUserHPKey() { super(); requiredSecUserId = UUID.fromString(CFAccSecUserBuff.SECUSERID_INIT_VALUE.toString()); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.CFAstSecSessionHPKey.java
public CFAstSecSessionHPKey() { super(); requiredSecSessionId = UUID.fromString(CFAstSecSessionBuff.SECSESSIONID_INIT_VALUE.toString()); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAst.CFAstSecSessionHPKey.java
public CFAstSecSessionHPKey() { super(); requiredSecSessionId = UUID.fromString(CFAstSecSessionBuff.SECSESSIONID_INIT_VALUE.toString()); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccSecSessionHPKey.java
public CFAccSecSessionHPKey() { super(); requiredSecSessionId = UUID.fromString(CFAccSecSessionBuff.SECSESSIONID_INIT_VALUE.toString()); }
From source file:com.haulmont.cuba.web.controllers.FileDownloadController.java
@RequestMapping(value = "/download", method = RequestMethod.GET) public ModelAndView download(HttpServletRequest request, HttpServletResponse response) throws IOException { UserSession userSession = getSession(request, response); if (userSession == null) { error(response);// w w w . ja v a2s . c o m return null; } AppContext.setSecurityContext(new SecurityContext(userSession)); try { UUID fileId; try { fileId = UUID.fromString(request.getParameter("f")); } catch (Exception e) { log.error(e.toString()); error(response); return null; } FileDescriptor fd = dataService.load(LoadContext.create(FileDescriptor.class).setId(fileId)); if (fd == null) { log.warn("Unable to find file with id {}", fileId); error(response); return null; } String fileName = URLEncodeUtils.encodeUtf8(fd.getName()); response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache"); response.setDateHeader(HttpHeaders.EXPIRES, 0); response.setHeader(HttpHeaders.CONTENT_TYPE, getContentType(fd)); response.setHeader(HttpHeaders.PRAGMA, "no-cache"); boolean attach = Boolean.valueOf(request.getParameter("a")); response.setHeader("Content-Disposition", (attach ? "attachment" : "inline") + "; filename=" + fileName); downloadFromMiddlewareAndWriteResponse(fd, response); } finally { AppContext.setSecurityContext(null); } return null; }