List of usage examples for java.util List iterator
Iterator<E> iterator();
From source file:de.pixida.logtest.automatondefinitions.SomeTestAutomaton.java
private static void checkEdges(final List<? extends INodeDefinition> nodes, final List<? extends IEdgeDefinition> edges, final String version) { checkEdgesLinkNodesCorrectly(nodes, edges); final Iterator<? extends IEdgeDefinition> edgesIt = edges.iterator(); IEdgeDefinition edge = edgesIt.next(); Assert.assertEquals("to_failing", edge.getId()); checkInventedAttributeAfterVersion(edge.getName(), "to_failing_name", "1.0.2", version); Assert.assertNull(edge.getRegExp()); Assert.assertEquals("x % 2 == 0", edge.getCheckExp()); Assert.assertNull(edge.getTriggerAlways()); Assert.assertEquals(//from ww w . j a va 2 s. co m "engine.info(\"info msg\"); engine.debug(\"debug msg\"); engine.reject(\"We\'re finished\"); engine.getLogEntry();", edge.getOnWalk()); Assert.assertNull(edge.getTriggerOnEof()); Assert.assertEquals(IEdgeDefinition.RequiredConditions.ONE, edge.getRequiredConditions()); checkTimeInterval(edge); Assert.assertEquals(IEdgeDefinition.DEFAULT_CHANNEL, edge.getChannel()); Assert.assertNull(edge.getTimeIntervalSinceLastTransition()); Assert.assertNull(edge.getTimeIntervalSinceAutomatonStart()); Assert.assertNull(edge.getTimeIntervalForEvent()); Assert.assertEquals("edge_description", edge.getDescription()); edge = edgesIt.next(); Assert.assertEquals("to_success", edge.getId()); checkInventedAttributeAfterVersion(edge.getName(), "to_success_name", "1.0.2", version); Assert.assertEquals("[A-Z]*", edge.getRegExp()); Assert.assertNull(edge.getCheckExp()); Assert.assertNull(edge.getTriggerAlways()); Assert.assertNull(edge.getOnWalk()); Assert.assertFalse(BooleanUtils.toBoolean(edge.getTriggerOnEof())); Assert.assertNull(edge.getRequiredConditions()); Assert.assertNull(edge.getTimeIntervalSinceLastMicrotransition()); Assert.assertEquals(IEdgeDefinition.DEFAULT_CHANNEL, edge.getChannel()); Assert.assertNotNull(edge.getTimeIntervalSinceLastTransition()); Assert.assertNotNull(edge.getTimeIntervalSinceAutomatonStart()); Assert.assertNotNull(edge.getTimeIntervalForEvent()); Assert.assertNull(edge.getDescription()); edge = edgesIt.next(); Assert.assertEquals("several_criteria", edge.getId()); Assert.assertNull(edge.getName()); Assert.assertNull(edge.getDescription()); Assert.assertEquals("[^A-Z]", edge.getRegExp()); Assert.assertNull(edge.getCheckExp()); Assert.assertTrue(edge.getTriggerAlways()); Assert.assertNull(edge.getOnWalk()); Assert.assertTrue(edge.getTriggerOnEof()); Assert.assertEquals(IEdgeDefinition.RequiredConditions.ALL, edge.getRequiredConditions()); Assert.assertNull(edge.getTimeIntervalSinceLastMicrotransition()); Assert.assertEquals("chan", edge.getChannel()); Assert.assertNull(edge.getTimeIntervalSinceLastTransition()); Assert.assertNull(edge.getTimeIntervalSinceAutomatonStart()); Assert.assertNull(edge.getTimeIntervalForEvent()); Assert.assertNull(edge.getDescription()); Assert.assertFalse(edgesIt.hasNext()); }
From source file:es.pode.soporte.auditoria.registrar.Interceptor.java
/** * Comprobacin de si hay que interceptar la clase servicio web a partir del fichero xml de configuracin * /*w w w . java2 s .c o m*/ * @param servicioClass Nombre de la clase * @param serviciosWebIterator Lista de servicios web (Iterator) con los que hay que comparar * @return el Se devuelve el elemento que coincide con la clase */ public static Element esInterceptadoServicioWeb(String servicioClass, List serviciosWeb) { Iterator serviciosWebIterator = serviciosWeb.iterator(); if (serviciosWebIterator != null) { while (serviciosWebIterator.hasNext()) { Element el = (Element) serviciosWebIterator.next(); if (log.isDebugEnabled()) log.debug( "Servicio web (XML) a comparar: " + el.getAttributeValue(RegistroCtes.ATTRIBUTE_NAME)); if (el.getAttributeValue(RegistroCtes.ATTRIBUTE_NAME).equals(servicioClass)) { if (log.isDebugEnabled()) log.debug("Servicio web que se intercepta: " + servicioClass); return el; } } } return null; }
From source file:edu.umd.cs.marmoset.utilities.MarmosetUtilities.java
public static String commandToString(List<String> args) { StringBuffer buf = new StringBuffer(); for (Iterator<String> i = args.iterator(); i.hasNext();) { String arg = i.next();//from w ww .ja v a2 s .co m if (buf.length() > 0) buf.append(' '); buf.append(arg); } return buf.toString(); }
From source file:imageLines.ImageHelpers.java
public static String getCookie(String urlString) throws MalformedURLException, IOException { URL url = new URL(urlString); URLConnection conn = url.openConnection(); conn.connect();/* w w w. j a v a 2 s .c o m*/ Map<String, List<String>> headers = conn.getHeaderFields(); List<String> values = headers.get("Set-Cookie"); String cookieValue = null; for (Iterator iter = values.iterator(); iter.hasNext();) { String v = iter.next().toString(); return v; } return ""; }
From source file:com.adito.networkplaces.NetworkPlaceUtil.java
/** * Get a list of {@link NetworkPlaceItem} objects that may be used by the user * of the given session.//from ww w . j ava2s.c o m * * @param session * @return network place items * @throws DAVBundleActionMessageException * @throws Exception */ public static List<NetworkPlaceItem> refreshNetworkMounts(VFSRepository repository, SessionInfo session) throws DAVBundleActionMessageException, Exception { List<NetworkPlaceItem> networkPlaceItems = new ArrayList<NetworkPlaceItem>(); List granted = ResourceUtil.getGrantedResource(session, NetworkPlacePlugin.NETWORK_PLACE_RESOURCE_TYPE); for (Iterator i = granted.iterator(); i.hasNext();) { NetworkPlace np = (NetworkPlace) i.next(); try { VFSProvider provider = VFSProviderManager.getInstance().getProvider(np.getScheme()); if (provider == null) { if (np.getScheme().equals("")) { URI uri = createURIForPath(np.getPath()); provider = VFSProviderManager.getInstance().getProvider(uri.getScheme()); } if (provider == null) throw new Exception("No provider for network place URI " + np.getPath()); } if (np.getType() != NetworkPlace.TYPE_HIDDEN) { // Create a store so we can get the mount path VFSStore store = repository.getStore(provider.getScheme()); NetworkPlaceItem npi = new NetworkPlaceItem( np, store.getMountPath(np.getResourceName()), PolicyDatabaseFactory.getInstance() .getPoliciesAttachedToResource(np, session.getUser().getRealm()), np.sessionPasswordRequired(session)); networkPlaceItems.add(npi); } } catch (Exception e) { log.warn("Failed to register " + np.getResourceName() + " with store.", e); } } return networkPlaceItems; }
From source file:com.krawler.esp.handlers.fileUploader.java
public static void parseRequest(HttpServletRequest request, HashMap<String, String> arrParam, ArrayList<FileItem> fi, boolean fileUpload) throws ServiceException { DiskFileUpload fu = new DiskFileUpload(); FileItem fi1 = null;//from w w w.j a v a 2 s. co m List fileItems = null; try { fileItems = fu.parseRequest(request); } catch (FileUploadException e) { throw ServiceException.FAILURE("Admin.createUser", e); } for (Iterator k = fileItems.iterator(); k.hasNext();) { fi1 = (FileItem) k.next(); if (fi1.isFormField()) { arrParam.put(fi1.getFieldName(), fi1.getString()); } else { try { String fileName = new String(fi1.getName().getBytes(), "UTF8"); if (fi1.getSize() != 0) { fi.add(fi1); fileUpload = true; } } catch (UnsupportedEncodingException ex) { } } } }
From source file:it.eng.spagobi.commons.utilities.PortletUtilities.java
/** * Gets the first uploaded file from a portlet request. This method creates a new file upload handler, * parses the request, processes the uploaded items and then returns the first file as an * <code>UploadedFile</code> object. * @param portletRequest The input portlet request * @return The first uploaded file object. *//*from w ww. ja va 2 s .c om*/ public static UploadedFile getFirstUploadedFile(PortletRequest portletRequest) { UploadedFile uploadedFile = null; try { DiskFileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler PortletFileUpload upload = new PortletFileUpload(factory); // Parse the request List /* FileItem */ items = upload.parseRequest((ActionRequest) portletRequest); // Process the uploaded items Iterator iter = items.iterator(); boolean endLoop = false; while (iter.hasNext() && !endLoop) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { //serviceRequest.setAttribute(item.getFieldName(), item.getString()); } else { uploadedFile = new UploadedFile(); uploadedFile.setFileContent(item.get()); uploadedFile.setFieldNameInForm(item.getFieldName()); uploadedFile.setSizeInBytes(item.getSize()); uploadedFile.setFileName(item.getName()); endLoop = true; } } } catch (Exception e) { logger.error("Cannot parse multipart request", e); } return uploadedFile; }
From source file:net.sf.jvifm.util.AutoCompleteUtil.java
@SuppressWarnings("all") public static String[] getBookmarkFileOptions(String name) { ArrayList result = new ArrayList(); BookmarkManager bookmarkManager = BookmarkManager.getInstance(); boolean lowerCase = false; if (name.toLowerCase().equals(name)) { lowerCase = true;//from w ww .j a va 2 s . c o m } List bookmarkList = bookmarkManager.getAll(); if (bookmarkList != null) { for (Iterator it = bookmarkList.iterator(); it.hasNext();) { Bookmark bookmark = (Bookmark) it.next(); String bookmarkName = bookmark.getName(); if (lowerCase) { bookmarkName = bookmarkName.toLowerCase(); } if (FilenameUtils.wildcardMatch(bookmarkName, name, IOCase.INSENSITIVE) || bookmarkName.startsWith(name)) { result.add(bookmark.getPath()); } } } if (result.size() <= 0) return null; String[] resultArray = new String[result.size()]; for (int i = 0; i < resultArray.length; i++) { resultArray[i] = (String) result.get(i); } return resultArray; }
From source file:com.teamsun.framework.util.ConvertUtil.java
/** * List?Map// w w w .j a v a 2s.c o m * * @param list * @return Map java.util */ public static Map convertListToMap(List list) { Map map = new LinkedHashMap(); for (Iterator it = list.iterator(); it.hasNext();) { LabelValue option = (LabelValue) it.next(); map.put(option.getLabel(), option.getValue()); } return map; }
From source file:com.qualogy.qafe.business.integration.adapter.Adapter.java
/** * Method to prepare a list of objects for actual adaption to do's, * uses Adapter.prepare(Object, Parameter), so actually a convinience * method that loops through the list and calls prepare. * //from w ww . ja v a 2 s . com * upon the objects * @param serviceOutcome * @param param * @return */ private static Object prepareList(List serviceOutcome, Parameter param) { List result = null; if (!serviceOutcome.isEmpty()) { result = new ArrayList(); for (Iterator iter = serviceOutcome.iterator(); iter.hasNext();) { result.add(prepare(iter.next(), param)); } } return result; }