List of usage examples for java.util Enumeration nextElement
E nextElement();
From source file:com.modeln.build.ctrl.charts.CMnBuildChart.java
/** * Validate the data submitted by the user and return any error codes. * * @param req HTTP request/* ww w . ja va2 s . c o m*/ * @param res HTTP response * * @return Error code if any errors were found. */ public static final JFreeChart getMetricChart(CMnDbBuildData build) { JFreeChart chart = null; DefaultPieDataset pieData = new DefaultPieDataset(); if ((build.getMetrics() != null) && (build.getMetrics().size() > 0)) { Enumeration metrics = build.getMetrics().elements(); while (metrics.hasMoreElements()) { CMnDbMetricData currentMetric = (CMnDbMetricData) metrics.nextElement(); String name = currentMetric.getMetricType(currentMetric.getType()); // Get elapsed time in "minutes" Long value = new Long(currentMetric.getElapsedTime() / (1000 * 60)); pieData.setValue(name, value); } } // API: ChartFactory.createPieChart(title, data, legend, tooltips, urls) chart = ChartFactory.createPieChart("Build Metrics", pieData, true, true, false); // get a reference to the plot for further customization... PiePlot plot = (PiePlot) chart.getPlot(); chartFormatter.formatMetricChart(plot, "min"); return chart; }
From source file:com.manydesigns.elements.servlet.ServletUtils.java
public static void dumpRequestAttributes(HttpServletRequest request) { Enumeration attNames = request.getAttributeNames(); while (attNames.hasMoreElements()) { String attrName = (String) attNames.nextElement(); Object attrValue = request.getAttribute(attrName); logger.info("{} = {}", attrName, attrValue); }/*from ww w . ja v a2 s . c o m*/ }
From source file:Main.java
/** * Returns a semicolumn separated list of keys and values in the dictionary. * /*from w w w. j a v a2s. c om*/ * Here is an example of returned String "key1 = value1; key2 = value2;" * * * * @param dict * Dictionary<Object,Object> * @return : String. */ public static String dictionaryToString(Dictionary<Object, Object> dict) { Enumeration<Object> keys = dict.keys(); Object key, value; StringBuffer result = new StringBuffer(); while (keys.hasMoreElements()) { key = keys.nextElement(); value = dict.get(key); result.append(key.toString()); result.append(" = "); result.append(value.toString()); result.append("; "); } return result.toString(); }
From source file:doc.action.SelectedDocsUtils.java
public static Collection saveSelectedDocsIDs(HttpServletRequest request) { //System.out.println("start"); Collection documents = (Collection) request.getSession().getAttribute(Constant.SELECTED_PRESIDENTS); //System.out.println(documents); if (documents == null) { documents = new ArrayList(); request.getSession().setAttribute(Constant.SELECTED_PRESIDENTS, documents); }//from w w w . jav a 2 s .c o m Enumeration parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { String parameterName = (String) parameterNames.nextElement(); if (parameterName.startsWith("chkbx_")) { String docId = StringUtils.substringAfter(parameterName, "chkbx_"); String parameterValue = request.getParameter(parameterName); if (parameterValue.equals(Constant.SELECTED)) { if (!documents.contains(docId)) { documents.add(docId); } } else { documents.remove(docId); } } } return documents; }
From source file:com.dustindoloff.s3websitedeploy.Main.java
private static boolean upload(final AmazonS3 s3Client, final String bucket, final ZipFile zipFile) { boolean failed = false; final ObjectMetadata data = new ObjectMetadata(); final Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { final ZipEntry entry = entries.nextElement(); data.setContentLength(entry.getSize()); try {//from w ww. ja v a 2 s .c o m s3Client.putObject(bucket, entry.getName(), zipFile.getInputStream(entry), data); } catch (final AmazonClientException | IOException e) { failed = true; } } return !failed; }
From source file:com.glaf.core.config.Environment.java
public static Properties getSystemPropertiesByName(String name) { Properties props = systemProperties.get(name); Properties p = new Properties(); Enumeration<?> e = props.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = props.getProperty(key); p.put(key, value);//from www . j av a 2 s .c o m } return p; }
From source file:com.zergiu.tvman.TVMan.java
private static void configureLoggers(TVManOptions options) { if (options.isDebug()) { org.apache.log4j.Logger log4JLogging = org.apache.log4j.Logger.getLogger("com.zergiu.tvman"); log4JLogging.setLevel(Level.DEBUG); }//from www. j a v a2s. co m if (options.isQuiet()) { org.apache.log4j.Logger log4JLogging = org.apache.log4j.Logger.getRootLogger(); Enumeration<?> loggers = log4JLogging.getLoggerRepository().getCurrentLoggers(); while (loggers.hasMoreElements()) { org.apache.log4j.Logger logger = (org.apache.log4j.Logger) loggers.nextElement(); logger.setLevel(Level.ERROR); } log4JLogging.setLevel(Level.ERROR); } }
From source file:com.servoy.j2db.server.ngclient.startup.resourceprovider.ComponentResourcesExporter.java
/** * Used in war export to create a services.properties file, which is needed to load services specs in the war. * @return the locations of services folders relative to the war dir. *//*from ww w. j av a2s.co m*/ public static String getServicesDirectoryNames() { StringBuilder locations = new StringBuilder(); Enumeration<String> paths = Activator.getContext().getBundle().getEntryPaths("/war/"); while (paths.hasMoreElements()) { String name = paths.nextElement().replace("war/", ""); if (name.endsWith("services/")) locations.append("/" + name + ";"); } if (locations.length() > 0) locations.deleteCharAt(locations.length() - 1); return locations.toString(); }
From source file:br.msf.commons.netbeans.util.FileObjectUtils.java
public static Collection<FileObject> getFiles(final FileObject rootDir, final boolean recursive, final FileType... types) { assert rootDir != null && rootDir.isFolder() && !ArrayUtils.contains(types, FileType.OTHER); Collection<FileObject> fileObjects = new ArrayList<FileObject>(); Enumeration<FileObject> entries = (Enumeration<FileObject>) rootDir.getChildren(recursive); while (entries.hasMoreElements()) { FileObject curr = entries.nextElement(); if (curr.isData()) { FileType t = FileType.parse(curr.getExt()); if (ArrayUtils.isEmpty(types) || ArrayUtils.contains(types, t)) { fileObjects.add(curr);//from w ww.j a va 2 s. c om } } } return fileObjects; }
From source file:com.servoy.j2db.server.ngclient.startup.resourceprovider.ComponentResourcesExporter.java
/** * Used in war export to create a components.properties file which is needed to load the components specs in war. * @return the locations of components folders relative to the war dir. *///from www . j a v a2 s .c o m public static String getComponentDirectoryNames() { StringBuilder locations = new StringBuilder(); Enumeration<String> paths = Activator.getContext().getBundle().getEntryPaths("/war/"); while (paths.hasMoreElements()) { String name = paths.nextElement().replace("war/", ""); if (name.endsWith("/") && !name.equals("js/") && !name.equals("css/") && !name.equals("templates/") && !name.endsWith("services/")) { locations.append("/" + name + ";"); } } locations.deleteCharAt(locations.length() - 1); return locations.toString(); }