List of usage examples for java.util HashMap get
public V get(Object key)
From source file:DAO.ProductManager.java
public void insertproduct(HashMap hm) { String producttype = (String) hm.get("producttype"); String productname = (String) hm.get("productname"); String sql = "INSERT INTO `product`(`id`, `product_name`, `product_type`) VALUES (?,?)"; jdbcTemplateObject.update(sql, producttype, productname); System.out.println("Created Record"); }
From source file:com.tremolosecurity.openunison.util.OpenUnisonUtils.java
private static void setDefaults(KeyStore ks, EntityDescriptor ed, IDPSSODescriptor idp, AuthMechType currentMechanism, HashMap<String, ParamType> params) { if (params.get("assertionsSigned") == null || params.get("assertionsSigned").getValue().equalsIgnoreCase("false")) { setProperty("responsesSigned", "true", params, currentMechanism); } else {//from w ww . j a v a 2 s .c om setProperty("responsesSigned", "false", params, currentMechanism); } setProperty("jumpPage", "", params, currentMechanism); setProperty("sigAlg", "RSA-SHA1", params, currentMechanism); setProperty("authCtxRef", "", params, currentMechanism); setProperty("forceToSSL", "false", params, currentMechanism); setProperty("ldapAttribute", "uid", params, currentMechanism); setProperty("dnOU", "SAML2", params, currentMechanism); setProperty("defaultOC", "inetOrgPerson", params, currentMechanism); setProperty("dontLinkToLDAP", "false", params, currentMechanism); setProperty("responsesSigned", "true", params, currentMechanism); setProperty("assertionsSigned", "false", params, currentMechanism); }
From source file:com.ibm.bi.dml.runtime.controlprogram.parfor.opt.OptimizationWrapper.java
/** * Called once per DML script (during program compile time) * in order to optimize all top-level parfor program blocks. * /*from w ww .j ava 2 s.c om*/ * NOTE: currently note used at all. * * @param prog * @param rtprog * @throws DMLRuntimeException * @throws LanguageException * @throws DMLUnsupportedOperationException */ public static void optimize(DMLProgram prog, Program rtprog, boolean monitor) throws DMLRuntimeException, LanguageException, DMLUnsupportedOperationException { LOG.debug("ParFOR Opt: Running optimize all on DML program " + DMLScript.getUUID()); //init internal structures HashMap<Long, ParForStatementBlock> sbs = new HashMap<Long, ParForStatementBlock>(); HashMap<Long, ParForProgramBlock> pbs = new HashMap<Long, ParForProgramBlock>(); //find all top-level paror pbs findParForProgramBlocks(prog, rtprog, sbs, pbs); // Create an empty symbol table ExecutionContext ec = ExecutionContextFactory.createContext(); //optimize each top-level parfor pb independently for (Entry<Long, ParForProgramBlock> entry : pbs.entrySet()) { long key = entry.getKey(); ParForStatementBlock sb = sbs.get(key); ParForProgramBlock pb = entry.getValue(); //optimize (and implicit exchange) POptMode type = pb.getOptimizationMode(); //known to be >0 optimize(type, sb, pb, ec, monitor); } LOG.debug("ParFOR Opt: Finished optimization for DML program " + DMLScript.getUUID()); }
From source file:com.dtolabs.rundeck.core.dispatcher.DataContextUtils.java
/** * Merge one context onto another by adding or replacing values. * @param targetContext the target of the merge * @param newContext context to merge *//* w w w . j ava 2 s . c o m*/ public static Map<String, Map<String, String>> merge(final Map<String, Map<String, String>> targetContext, final Map<String, Map<String, String>> newContext) { final HashMap<String, Map<String, String>> result = deepCopy(targetContext); for (final Map.Entry<String, Map<String, String>> entry : newContext.entrySet()) { if (!targetContext.containsKey(entry.getKey())) { result.put(entry.getKey(), new HashMap<String, String>()); } else { result.put(entry.getKey(), new HashMap<String, String>(targetContext.get(entry.getKey()))); } result.get(entry.getKey()).putAll(entry.getValue()); } return result; }
From source file:com.vmware.identity.idm.server.LocalOsIdentityProviderTest.java
private static void validateGroupsSubset(Set<GroupInfo> expectedSubset, Set<Group> actualSet, String domainName, String domainAlias) {/*from w ww . jav a 2 s .c om*/ HashMap<String, Group> superSet = new HashMap<String, Group>(); if (actualSet != null) { for (Group g : actualSet) { Assert.assertNotNull(g); superSet.put(g.getName(), g); } } if (expectedSubset != null) { for (GroupInfo gd : expectedSubset) { Assert.assertTrue(superSet.containsKey(gd.getName())); Group g = superSet.get(gd.getName()); assertEqualsString(gd.getName(), g.getName()); if (providerHasAlias(domainAlias)) { Assert.assertNotNull(g.getAlias()); assertEqualsString(gd.getName(), g.getAlias().getName()); assertEqualsString(domainAlias, g.getAlias().getDomain()); } assertEqualsString(domainName, g.getDomain()); Assert.assertNotNull(g.getDetail()); // assertEqualsString( gd.getDescription(), g.getDetail().getDescription() ); } } }
From source file:net.doubledoordev.backend.webserver_old.methods.Post.java
/** * Handle post requests from the login page *///from w ww . j ava2 s . c om private static void handleLogin(HashMap<String, Object> dataObject, NanoHTTPD.HTTPSession session, Map<String, String> map) { if (map.containsKey("username") && map.containsKey("password")) { User user = Settings.getUserByName(map.get("username")); if (user != null && user.verify(map.get("password"))) { session.getCookies().set(COOKIE_KEY, user.getUsername() + "|" + user.getPasshash(), 30); dataObject.put("user", user); } else dataObject.put("message", "Login failed."); } else if (map.containsKey("logout")) { session.getCookies().delete(COOKIE_KEY); dataObject.remove("user"); } else if (dataObject.containsKey("user") && map.containsKey("oldPassword") && map.containsKey("newPassword")) { User user = (User) dataObject.get("user"); if (user.updatePassword(map.get("oldPassword"), map.get("newPassword"))) { session.getCookies().set(COOKIE_KEY, user.getUsername() + "|" + user.getPasshash(), 30); } else dataObject.put("message", "Old password was wrong."); } else dataObject.put("message", "Form error."); }
From source file:contestTabulation.Main.java
private static void persistData(Level level, Collection<School> schools, Map<Test, List<Student>> categoryWinners, Map<Subject, List<School>> categorySweepstakesWinners, List<School> sweepstakesWinners) throws JSONException { PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = pm.currentTransaction(); try {//from w w w.j av a2 s . c om tx.begin(); pm.makePersistentAll(schools); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } List<Entity> categoryWinnersEntities = new ArrayList<Entity>(); for (Entry<Test, List<Student>> categoryWinnerEntry : categoryWinners.entrySet()) { String entityKey = categoryWinnerEntry.getKey().toString() + "_" + level.toString(); Entity categoryWinnersEntity = new Entity("CategoryWinners", entityKey, KeyFactory.createKey("Level", level.getName())); List<Key> studentKeys = new ArrayList<Key>(); for (Student student : categoryWinnerEntry.getValue()) { studentKeys.add(student.getKey()); } categoryWinnersEntity.setProperty("students", studentKeys); categoryWinnersEntities.add(categoryWinnersEntity); } datastore.put(categoryWinnersEntities); List<Entity> categorySweepstakesWinnersEntities = new ArrayList<Entity>(); for (Entry<Subject, List<School>> categorySweepstakesWinnerEntry : categorySweepstakesWinners.entrySet()) { String entityKey = categorySweepstakesWinnerEntry.getKey().toString() + "_" + level.toString(); Entity categoryWinnersEntity = new Entity("CategorySweepstakesWinners", entityKey, KeyFactory.createKey("Level", level.getName())); List<Key> schoolKeys = new ArrayList<Key>(); for (School school : categorySweepstakesWinnerEntry.getValue()) { schoolKeys.add(school.getKey()); } categoryWinnersEntity.setProperty("schools", schoolKeys); categorySweepstakesWinnersEntities.add(categoryWinnersEntity); } datastore.put(categorySweepstakesWinnersEntities); List<Entity> visualizationEntities = new ArrayList<Entity>(); Entity sweepstakesWinnerEntity = new Entity("SweepstakesWinners", level.toString(), KeyFactory.createKey("Level", level.getName())); List<Key> schoolKeys = new ArrayList<Key>(); for (School school : sweepstakesWinners) { schoolKeys.add(school.getKey()); } sweepstakesWinnerEntity.setProperty("schools", schoolKeys); datastore.put(sweepstakesWinnerEntity); HashMap<Test, List<Integer>> scores = new HashMap<Test, List<Integer>>(); Test[] tests = Test.getTests(level); for (Test test : tests) { scores.put(test, new ArrayList<Integer>()); } for (School school : schools) { for (Student student : school.getStudents()) { for (Entry<Subject, Score> scoreEntry : student.getScores().entrySet()) { if (scoreEntry.getValue().isNumeric()) { scores.get(Test.fromSubjectAndGrade(student.getGrade(), scoreEntry.getKey())) .add(scoreEntry.getValue().getScoreNum()); } } } } for (Test test : tests) { Entity visualizationsEntity = new Entity("Visualization", test.toString(), KeyFactory.createKey("Level", level.getName())); visualizationsEntity.setProperty("scores", scores.get(test)); visualizationEntities.add(visualizationsEntity); } datastore.put(visualizationEntities); }
From source file:cr.ac.siua.tec.services.impl.ExportServiceImpl.java
/** * In charge of retreving the base64 String (encoded PDF) for the requested ticket. */// www . ja va2s. com public String getPDF(HashMap<String, String> ticketContent) { String formType = ticketContent.get("Queue"); try { //It uses the factory pattern to invoke the form's corresponding export method. String pdfContent = pdfGeneratorFactory.getPDFGenerator(formType).generate(ticketContent); return pdfContent; } catch (NoSuchBeanDefinitionException e) { e.printStackTrace(); System.out.println("This queue's ticket export method has not been implemented."); return "Not implemented yet."; } }
From source file:com.almarsoft.GroundhogReader.lib.MessageTextProcessor.java
public static String getAttachmentsHtml(Vector<HashMap<String, String>> mimePartsVector) { if (mimePartsVector == null || mimePartsVector.size() == 0) return "<!-- No attachments -->\n"; String retString = null;//from w ww.j a v a2 s .co m if (mimePartsVector == null || mimePartsVector.size() == 0) retString = ""; else { StringBuilder returnHtml = new StringBuilder(); returnHtml.append("<I>Attachments:</i><BR/>\n"); returnHtml.append("<hr>"); returnHtml.append("<table>\n"); for (HashMap<String, String> attachData : mimePartsVector) { returnHtml.append("<tr bgcolor=\"#FFFF00\">"); returnHtml.append("<td>\n"); returnHtml.append("<A HREF=\"attachment://fake.com/" + attachData.get("md5") + "\">" + attachData.get("name") + "</A><BR/>\n"); returnHtml.append("</td>\n"); returnHtml.append("<td>\n"); returnHtml.append(attachData.get("type")); returnHtml.append("</td>\n"); returnHtml.append("<td>\n"); returnHtml.append(new Integer(attachData.get("size")) / 1024); returnHtml.append(" KB"); returnHtml.append("</td>\n"); returnHtml.append("</tr>\n"); } returnHtml.append("</table>\n"); returnHtml.append("<hr>"); retString = returnHtml.toString(); } return retString; }