List of usage examples for java.util UUID toString
public String toString()
From source file:adminpackage.adminview.UpdateProductServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String value = "defa"; AdminUpdateProductWrapper product = new AdminUpdateProductWrapper(); try {//w w w . ja va 2 s.c o m DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List<FileItem> items = upload.parseRequest(request); Iterator itr = items.iterator(); String url = ""; while (itr.hasNext()) { FileItem item = (FileItem) itr.next(); if (item.isFormField()) { String name = item.getFieldName(); value = item.getString(); switch (name) { case "pid": product.setId(Integer.parseInt(value)); break; case "pname": product.setName(value); break; case "quantity": product.setQuantity(Integer.parseInt(value)); break; case "author": product.setAuthor(value); break; case "isbn": product.setISBN(Long.parseLong(value)); break; case "description": product.setDescription(value); break; case "category": product.setCategory(value); break; case "price": product.setPrice(Integer.parseInt(value)); break; } } else { try { if (item.getName().length() > 0) { item.write(new File(context.getRealPath("/pages/images/").replaceAll( "\\\\target\\\\MavenOnlineShoping-1.0-SNAPSHOT", "\\\\src\\\\main\\\\webapp") + item.getName())); //System.out.println(context.getRealPath("/pages/images/").replaceAll("\\\\target\\\\MavenOnlineShoping-1.0-SNAPSHOT", "\\\\src\\\\main\\\\webapp") + item.getName()); //url = context.getRealPath("/pages/images/").replaceAll("\\\\target\\\\MavenOnlineShoping-1.0-SNAPSHOT", "\\\\src\\\\main\\\\webapp") + item.getName(); UUID idOne = UUID.randomUUID(); product.setImage( idOne.toString() + item.getName().substring(item.getName().length() - 4)); } } catch (Exception ex) { Logger.getLogger(UpdateProductServlet.class.getName()).log(Level.SEVERE, null, ex); } } } } catch (FileUploadException ex) { Logger.getLogger(UpdateProductServlet.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("adminpackage.adminview.UpdateProductServlet.processRequest()"); out.print(adminFacadeHandler.UpdateProduct(product)); if (value != null) { } }
From source file:io.apicurio.hub.core.editing.EditingSessionManager.java
/** * @see io.apicurio.hub.core.editing.IEditingSessionManager#createSessionUuid(java.lang.String, java.lang.String, java.lang.String, long) *//* ww w.jav a 2s . c o m*/ @Override public String createSessionUuid(String designId, String user, String secret, long contentVersion) throws ServerError { try { UUID uuid = UUID.randomUUID(); String hash = DigestUtils.sha512Hex(SALT + user + secret); long expiresOn = System.currentTimeMillis() + EXPIRATION_OFFSET; this.storage.createEditingSessionUuid(uuid.toString(), designId, user, hash, contentVersion, expiresOn); return uuid.toString(); } catch (StorageException e) { throw new ServerError(e); } }
From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java
@Override protected void storeTuple(long id, String key, UUID agent, String value) { getSim(id).with("agentproperties").with(agent.toString()).put(key, value); }
From source file:uk.ac.imperial.presage2.db.json.JsonStorage.java
@Override protected void storeTuple(long id, String key, UUID agent, double value) { getSim(id).with("agentproperties").with(agent.toString()).put(key, value); }
From source file:com.esri.geoportal.harvester.beans.TaskManagerBean.java
@Override public Collection<Map.Entry<UUID, TaskDefinition>> list() throws CrudlException { HashMap<UUID, TaskDefinition> map = new HashMap<>(); try (Connection connection = dataSource.getConnection(); PreparedStatement st = connection.prepareStatement("SELECT * FROM TASKS");) { ResultSet rs = st.executeQuery(); while (rs.next()) { try { UUID id = UUID.fromString(rs.getString("id")); TaskDefinition td = deserialize(rs.getString("taskDefinition"), TaskDefinition.class); td.setRef(id.toString()); map.put(id, td);//from ww w .j av a 2s .com } catch (IOException | SQLException ex) { LOG.warn("Error reading task definition", ex); } } } catch (SQLException ex) { throw new CrudlException("Error selecting task", ex); } return map.entrySet(); }
From source file:com.delphix.session.service.ServiceUUID.java
public ServiceUUID(UUID uuid, boolean ephemeral, String alias) { this.uuid = uuid; this.ephemeral = ephemeral; if (alias != null) { this.alias = alias; } else {//from w w w . j ava 2 s.c o m this.alias = uuid.toString(); } }
From source file:de.linzn.cubit.internal.blockEdit.normal.snapshot.WorldEditFunctions.java
public HashSet<String> getSnapshotNames(UUID playerUUID) { HashSet<String> snapshotNames = new HashSet<>(); String path = this.snapshotsDirectory + "/" + playerUUID.toString(); File filePath = new File(path); filePath.listFiles();/*from w w w . ja va2 s . com*/ for (File file : filePath.listFiles()) { if (file.isDirectory()) { snapshotNames.add(file.getName()); } } return snapshotNames; }
From source file:me.st28.flexseries.flexchat.backend.chatadmin.ChatAdminManager.java
private void loadPlayer(UUID uuid) { FileConfiguration config = spyFile.getConfig(); spies.put(uuid, new SpySettings(config.getConfigurationSection(uuid.toString()))); }
From source file:net.sourceforge.msscodefactory.cfensyntax.v2_1.CFEnSyntaxMssCF.CFEnSyntaxMssCFBindSecUserDefaultDevSecUserId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFEnSyntaxMssCFBindSecUserDefaultDevSecUserId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//from w ww .j a va 2 s . c o m ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFEnSyntaxSecUserObj) { UUID defaultDevSecUserId = ((ICFEnSyntaxSecUserObj) genDef).getOptionalDefaultDevSecUserId(); if (defaultDevSecUserId == null) { ret = null; } else { ret = defaultDevSecUserId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFEnSyntaxSecUserObj"); } return (ret); }
From source file:com.orange.clara.cloud.servicedbdumper.dbdumper.DatabaseRefManager.java
protected String generateDatabaseRefName(String srcUrl) { UUID dbRefName = UUID.nameUUIDFromBytes(srcUrl.getBytes()); return dbRefName.toString(); }