List of usage examples for java.util Hashtable keySet
Set keySet
To view the source code for java.util Hashtable keySet.
Click Source Link
From source file:Main.java
public static void setButtonStyles(Hashtable<Integer, Button> buttonHash, Boolean undo) { int color = (undo) ? Color.RED : Color.BLUE; for (Integer bID : buttonHash.keySet()) { buttonHash.get(bID).setTextColor(color); }//from www . jav a 2 s . c o m }
From source file:org.grouter.common.jndi.JNDIUtils.java
/** * Print out all JNDI variables for provided Context. * * @param ctx Context//from w w w .j a v a 2 s. co m * @param alogger if null it will usethis class logger */ public static void printJNDI(Context ctx, Logger alogger) { Hashtable table; try { table = ctx.getEnvironment(); Set set = table.keySet(); Iterator it = set.iterator(); alogger.info("Context contains key value pairs:"); while (it.hasNext()) { String key = (String) it.next(); alogger.info("(key,value) = (" + key + "," + (table.get(key)) + ")"); } } catch (NamingException ex) { logger.error("Retrieving the environment in effect for this context failed."); } }
From source file:org.grouter.common.jndi.JNDIUtils.java
/** * Print out all JNDI variables for provided Context. * * @param ctx Context/*from ww w . j ava 2s. c om*/ * @param alogger if null it will usethis class logger */ public static void printJNDI(Context ctx, final Log alogger) { Hashtable table; try { table = ctx.getEnvironment(); Set set = table.keySet(); Iterator it = set.iterator(); alogger.info("Context contains key value pairs:"); while (it.hasNext()) { String key = (String) it.next(); alogger.info("(key,value) = (" + key + "," + (table.get(key)) + ")"); } } catch (NamingException ex) { logger.error("Retrieving the environment in effect for this context failed."); } }
From source file:org.wso2.carbon.custom.connector.EJBUtil.java
/** * @param messageContext message contest * @param operationName name of the operation * @return extract the value's from properties and make its as hashable *//* w w w. j av a 2 s.c o m*/ public static Object[] buildArguments(MessageContext messageContext, String operationName) { Hashtable<String, String> argValues = getParameters(messageContext, operationName); Set<String> argSet = argValues.keySet(); Object[] args = new Object[argValues.size()]; int i = 0; for (String aSet : argSet) { args[i] = argValues.get(aSet); i++; } return args; }
From source file:com.googlecode.flyway.ant.MigrateTask.java
/** * Adds the additional placeholders contained in these properties to the existing list. * * @param placeholders The existing list of placeholders. * @param properties The properties containing additional placeholders. *//*ww w .j av a2s . c o m*/ private static void addPlaceholdersFromProperties(Map<String, String> placeholders, Hashtable properties) { for (Object property : properties.keySet()) { String propertyName = (String) property; if (propertyName.startsWith(PLACEHOLDERS_PROPERTY_PREFIX) && propertyName.length() > PLACEHOLDERS_PROPERTY_PREFIX.length()) { String placeholderName = propertyName.substring(PLACEHOLDERS_PROPERTY_PREFIX.length()); String placeholderValue = (String) properties.get(propertyName); placeholders.put(placeholderName, placeholderValue); } } }
From source file:unalcol.termites.boxplots.HybridGlobalInfoReport.java
private static void createChart(Hashtable<String, XYSeriesCollection> dataCollected) { System.out.println("dc" + dataCollected); for (String key : dataCollected.keySet()) { JFreeChart chart = ChartFactory.createXYLineChart(key, "Round number", "GlobalInfo", dataCollected.get(key), PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) chart.getPlot(); NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis(); domain.setRange(0.0, 10000.0);//from w w w . ja v a 2s . c o m FileOutputStream output; try { System.out.println("Key: " + key); output = new FileOutputStream(key + mazeMode + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:ext.tmt.utils.LWCUtil.java
/** * ?Key,Value?/* w w w . jav a 2s. c om*/ * @param key IBA * @param value IBA * @param type * @return */ public static List<Persistable> getObjectByIBA(Map<String, String> ibaValues, String type) { Debug.P("---getObjectByIBA: ibaValues:" + ibaValues); List<Persistable> result = null; String sql = null; if (ibaValues != null && ibaValues.size() > 0) { StringBuffer bf = new StringBuffer(); List<String> paramList = new ArrayList<String>(); bf.append("and ("); //IBA? for (Iterator<?> ite = ibaValues.keySet().iterator(); ite.hasNext();) { String key = (String) ite.next(); bf.append("d1.name=?"); paramList.add(key); String value = ibaValues.get(key); if (StringUtils.isEmpty(value)) { bf.append("and ").append("v1.value is Null"); } else { bf.append("and ").append("v1.value=?"); paramList.add(value); } } bf.append(")"); //IBA? String queryIBACond = bf.toString(); Debug.P("--->>Query IBA Param:" + queryIBACond); if ("wt.part.WTPart".contains(type)) {// sql = "select M1.NAME,M1.WTPARTNUMBER as OBJECTNUMBER FROM STRINGVALUE v1 ,STRINGDEFINITION d1,WTPART p1,WTPARTMASTER m1 where D1.IDA2A2=v1.ida3a6 and v1.IDA3A4=p1.IDA2A2 and p1.IDA3MASTERREFERENCE=M1.IDA2A2 and d1.name=? and v1.value=?"; } else if ("wt.epm.EPMDocument".contains(type)) { sql = "select M1.NAME,M1.DOCUMENTNUMBER as OBJECTNUMBER FROM STRINGVALUE v1 ,STRINGDEFINITION d1,EPMDOCUMENT e1,EPMDOCUMENTMASTER m1 where D1.IDA2A2=v1.ida3a6 and v1.IDA3A4=e1.IDA2A2 and e1.IDA3MASTERREFERENCE=M1.IDA2A2 and d1.name=? and v1.value=? "; } else if ("wt.doc.WTDocument".contains(type)) { sql = "select M1.NAME,M1.WTDOCUMENTNUMBER as OBJECTNUMBER FROM STRINGVALUE v1 ,STRINGDEFINITION d1,WTDOCUMENT t1,WTDOCUMENTMASTER m1 where D1.IDA2A2=v1.ida3a6 and v1.IDA3A4=t1.IDA2A2 and t1.IDA3MASTERREFERENCE=M1.IDA2A2 and d1.name=? and v1.value=?"; } String[] params = new String[paramList.size()]; params = paramList.toArray(params); Debug.P("---->>>SQL:" + sql); Debug.P("------>>>>SQL param:" + paramList); try { List<Hashtable<String, String>> datas = UserDefQueryUtil.commonQuery(sql, params); if (datas != null && datas.size() > 0) { Debug.P("---->>getObjectIBA Size:" + datas.size()); result = new ArrayList<Persistable>(); for (int i = 0; i < datas.size(); i++) { Hashtable<String, String> data_rows = datas.get(i); for (Iterator<?> ite = data_rows.keySet().iterator(); ite.hasNext();) { String keyStr = (String) ite.next(); if (keyStr.equalsIgnoreCase("OBJECTNUMBER")) { String valueStr = data_rows.get("OBJECTNUMBER"); Persistable object = GenericUtil.getObjectByNumber(valueStr); result.add(object); } } } } } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } return result; }
From source file:edu.ucsb.nceas.metacat.util.RequestUtil.java
private static String paramsToQuery(Hashtable<String, String[]> params) { String query = ""; if (params != null) { boolean firstParam = true; for (String paramName : params.keySet()) { if (firstParam) { firstParam = false;/*ww w. ja va2s.c om*/ } else { query += "&"; } query += paramName + "=" + params.get(paramName)[0]; } } return query; }
From source file:org.ariadne.oai.utils.HarvesterUtils.java
public static HashMap<String, String> getPropertiesStartingWith(String startString) { HashMap<String, String> props = new HashMap<String, String>(); Hashtable table = PropertiesManager.getInstance().getPropertyStartingWith(startString + "."); Collection propsCollection = table.keySet(); Iterator propIter = propsCollection.iterator(); while (propIter.hasNext()) { String key = (String) propIter.next(); String newKey = key.replaceFirst(startString + ".", ""); props.put(newKey, (String) table.get(key)); }//from ww w .j a v a 2 s .co m return props; }
From source file:Main.java
public static void addApp(String file, String name, Hashtable<String, String> attri) throws Exception { DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance(); DocumentBuilder dombuilder = domfac.newDocumentBuilder(); FileInputStream is = new FileInputStream(file); Document doc = dombuilder.parse(is); NodeList nodeList = doc.getElementsByTagName("app"); if (nodeList != null && nodeList.getLength() >= 1) { Node deviceNode = nodeList.item(0); Element device = doc.createElement("aut"); device.setTextContent(name);/*www . j a v a 2s . c o m*/ for (Iterator itrName = attri.keySet().iterator(); itrName.hasNext();) { String attriKey = (String) itrName.next(); String attriValue = (String) attri.get(attriKey); device.setAttribute(attriKey, attriValue); } deviceNode.appendChild(device); } //save TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(); Properties props = t.getOutputProperties(); props.setProperty(OutputKeys.ENCODING, "GB2312"); t.setOutputProperties(props); DOMSource dom = new DOMSource(doc); StreamResult sr = new StreamResult(file); t.transform(dom, sr); }