List of usage examples for java.util ArrayList iterator
public Iterator<E> iterator()
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.RegistryObjectImpl.java
/** * Gets all Concepts classifying this object that have specified path as prefix. * Used in RegistryObjectsTableModel.getValueAt via reflections API if so configured. *///from w w w .j a v a 2 s .c o m public Collection<Concept> getClassificationConceptsByPath(String pathPrefix) throws JAXRException { Collection<Concept> matchingClassificationConcepts = new ArrayList<Concept>(); ArrayList<RegistryObject> _classifications = getClassifications(); Iterator<RegistryObject> iter = _classifications.iterator(); while (iter.hasNext()) { Classification cl = (Classification) iter.next(); Concept concept = cl.getConcept(); String conceptPath = concept.getPath(); if (conceptPath.startsWith(pathPrefix)) { matchingClassificationConcepts.add(concept); } } return matchingClassificationConcepts; }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
/**************************************************************************** * TARGET SYSTEMS/*w ww .ja va 2s . com*/ ****************************************************************************/ public boolean setTargetSystems(ArrayList<String> systems) { removeAppInfos("X_TargetSystem");//$NON-NLS-1$ for (Iterator<String> iter = systems.iterator(); iter.hasNext();) { String role = iter.next(); addAppInfo("X_TargetSystem", role);//$NON-NLS-1$ } hasChanged = true; return true; }
From source file:com.icesoft.faces.context.BridgeFacesContext.java
/** * gets all FacesMessages whether or not associatted with clientId. * * @return list of FacesMessages// w w w . ja v a 2s. c o m */ public Iterator getMessages() { //ICE-1900 RequestStateManagerDelegate.clearMessages(this); // Jira #1358 The hashmap contains vectors of FacesMessages, not FacesMessages // See following method. ArrayList buffer = new ArrayList(); if (faceMessages.values() == null) return Collections.EMPTY_LIST.iterator(); Iterator i = faceMessages.values().iterator(); while (i.hasNext()) { buffer.addAll((Vector) i.next()); } return buffer.iterator(); }
From source file:it.cnr.icar.eric.client.xml.registry.infomodel.RegistryObjectImpl.java
public void removeExternalLinks(@SuppressWarnings("rawtypes") Collection extLinks) throws JAXRException { getExternalLinks();/* w w w . j a va2s . c o m*/ //Avoid ConcurrentModificationException @SuppressWarnings({ "rawtypes", "unchecked" }) ArrayList _extLinks = new ArrayList(extLinks); Iterator<?> iter = _extLinks.iterator(); while (iter.hasNext()) { ExternalLink extLink = (ExternalLink) iter.next(); removeExternalLink(extLink); } //No need to call setModified(true) since RIM modified object is an Assoociation } }
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
/**************************************************************************** * DOCUMENTATION// ww w . j a v a 2 s .c o m ****************************************************************************/ private Element getDocumentationElement() { Element documentation = null; ArrayList<Element> list = new ArrayList<Element>(); list.addAll(annotation.getUserInformation()); for (Iterator<Element> iter = list.iterator(); iter.hasNext();) { Element ann = iter.next(); String name = ann.getLocalName(); if ("documentation".equals(name.toLowerCase())) {//$NON-NLS-1$ documentation = ann; break; } } return documentation; }
From source file:jp.or.openid.eiwg.scim.operation.Operation.java
/** * // ww w. j a v a2 s .c om * * @param context * @param request * @param attributes * @param requestJson */ public LinkedHashMap<String, Object> updateUserInfo(ServletContext context, HttpServletRequest request, String targetId, String attributes, String requestJson) { LinkedHashMap<String, Object> result = null; Set<String> returnAttributeNameSet = new HashSet<>(); // ? setError(0, null, null); // ?? if (attributes != null && !attributes.isEmpty()) { // String[] tempList = attributes.split(","); for (int i = 0; i < tempList.length; i++) { String attributeName = tempList[i].trim(); // ??????? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, true); if (attributeSchema != null && !attributeSchema.isEmpty()) { returnAttributeNameSet.add(attributeName); } else { // ??????? String message = String.format(MessageConstants.ERROR_INVALID_ATTRIBUTES, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } } } // id? LinkedHashMap<String, Object> targetInfo = null; @SuppressWarnings("unchecked") ArrayList<LinkedHashMap<String, Object>> users = (ArrayList<LinkedHashMap<String, Object>>) context .getAttribute("Users"); Iterator<LinkedHashMap<String, Object>> usersIt = null; if (users != null && !users.isEmpty()) { usersIt = users.iterator(); while (usersIt.hasNext()) { LinkedHashMap<String, Object> userInfo = usersIt.next(); Object id = SCIMUtil.getAttribute(userInfo, "id"); if (id != null && id instanceof String) { if (targetId.equals(id.toString())) { targetInfo = userInfo; break; } } } } if (targetInfo == null) { setError(HttpServletResponse.SC_NOT_FOUND, null, MessageConstants.ERROR_NOT_FOUND); return result; } // ? if (requestJson == null || requestJson.isEmpty()) { // setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST); return result; } // (JSON)? ObjectMapper mapper = new ObjectMapper(); LinkedHashMap<String, Object> requestObject = null; try { requestObject = mapper.readValue(requestJson, new TypeReference<LinkedHashMap<String, Object>>() { }); } catch (JsonParseException e) { String datailMessage = e.getMessage(); datailMessage = datailMessage.substring(0, datailMessage.indexOf('\n')); setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST + "(" + datailMessage + ")"); return result; } catch (JsonMappingException e) { String datailMessage = e.getMessage(); datailMessage = datailMessage.substring(0, datailMessage.indexOf('\n')); setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST + "(" + datailMessage + ")"); return result; } catch (IOException e) { setError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null, MessageConstants.ERROR_UNKNOWN); return result; } // ? if (requestObject != null && !requestObject.isEmpty()) { Iterator<String> attributeIt = requestObject.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, false); if (attributeSchema != null) { // ???? Object mutability = attributeSchema.get("mutability"); if (mutability != null && mutability.toString().equalsIgnoreCase("readOnly")) { // readOnly String message = String.format(MessageConstants.ERROR_READONLY_ATTRIBUTE, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } // ?? // () } else { if (!attributeName.equalsIgnoreCase("schemas") && !attributeName.equalsIgnoreCase("id") && !attributeName.equalsIgnoreCase("meta")) { // ???? String message = String.format(MessageConstants.ERROR_UNKNOWN_ATTRIBUTE, attributeName); setError(HttpServletResponse.SC_BAD_REQUEST, null, message); return result; } } } } else { // setError(HttpServletResponse.SC_BAD_REQUEST, null, MessageConstants.ERROR_INVALID_REQUEST); return result; } // ? // () LinkedHashMap<String, Object> updateUserInfo = new LinkedHashMap<String, Object>(); // updateUserInfo.put("id", targetId); Iterator<String> attributeIt = requestObject.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? Object attributeValue = requestObject.get(attributeName); updateUserInfo.put(attributeName, attributeValue); } // meta Object metaObject = targetInfo.get("meta"); @SuppressWarnings("unchecked") LinkedHashMap<String, Object> metaValues = (LinkedHashMap<String, Object>) metaObject; // meta.lastModified SimpleDateFormat xsdDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'"); xsdDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); metaValues.put("lastModified", xsdDateTime.format(new Date())); updateUserInfo.put("meta", metaValues); // (??) usersIt.remove(); users.add(updateUserInfo); context.setAttribute("Users", users); // ?? result = new LinkedHashMap<String, Object>(); attributeIt = updateUserInfo.keySet().iterator(); while (attributeIt.hasNext()) { // ??? String attributeName = attributeIt.next(); // ? LinkedHashMap<String, Object> attributeSchema = SCIMUtil.getUserAttributeInfo(context, attributeName, true); Object returned = attributeSchema.get("returned"); if (returned != null && returned.toString().equalsIgnoreCase("never")) { continue; } // ? Object attributeValue = updateUserInfo.get(attributeName); result.put(attributeName, attributeValue); } return result; }
From source file:it.cnr.icar.eric.server.lcm.LifeCycleManagerImpl.java
/** * Processes Associations looking for Associations that already exist and * are being submitted by source or target owner and are identical in state * to existing Association in registry./*from w w w . j a va 2 s . c o m*/ * * ebXML Registry 3.0 hasber discarded association confirmation in favour of * Role Based access control. However, freebXML Registry supports it in an * impl specific manner as this is required by JAXR 1.0 API. This SHOULD be * removed once JAXR 2.0 no longer requires it for ebXML Registry in future. * * The processing updates the Association to add a special Impl specific * slot to remember the confirmation state change. * * TODO: Need to do unconfirm when src or target owner removes an * Association they had previously confirmed. */ private void processConfirmationAssociations(ServerRequestContext context) throws RegistryException { try { // Make a copy to avoid ConcurrentModificationException ArrayList<?> topLevelObjects = new ArrayList<Object>( (context).getTopLevelRegistryObjectTypeMap().values()); Iterator<?> iter = topLevelObjects.iterator(); while (iter.hasNext()) { Object obj = iter.next(); if (obj instanceof AssociationType1) { AssociationType1 ass = (AssociationType1) obj; HashMap<String, Serializable> slotsMap = bu.getSlotsFromRegistryObject(ass); @SuppressWarnings("static-access") String beingConfirmed = (String) slotsMap.remove(bu.IMPL_SLOT_ASSOCIATION_IS_BEING_CONFIRMED); if ((beingConfirmed != null) && (beingConfirmed.equalsIgnoreCase("true"))) { // Need to set slotMap again ass.getSlot().clear(); bu.addSlotsToRegistryObject(ass, slotsMap); (context).getConfirmationAssociations().put(ass.getId(), ass); } } } } catch (javax.xml.bind.JAXBException e) { throw new RegistryException(e); } }
From source file:jdbc.pool.CConnectionPoolManager.java
/** * Returns an iterator for a collection of statistics for all the pools. * // ww w .j av a2 s. com * @return Iterator */ public Iterator<CPoolStatisticsBean> getAllPoolStatistics() { ArrayList<CPoolStatisticsBean> alist = new ArrayList<CPoolStatisticsBean>(mapPools_.size()); for (Entry<String, ConnectionPool> entry : mapPools_.entrySet()) { alist.add(entry.getValue().getStatistics()); } return alist.iterator(); }
From source file:com.day.cq.wcm.foundation.List.java
/** * Returns the list items as pages, respecting both starting index and * maximum number of list items if specified. * @return The pages/*from w w w . j a v a 2 s. c o m*/ */ public Iterator<Page> getPages() { if (init() && pages.size() > 0) { ArrayList<Page> plist = new ArrayList<Page>(); int c = 0; for (int i = 0; i < pages.size(); i++) { if (i < pageStart) { continue; } plist.add(pages.get(i)); c++; if (pageMaximum > 0 && c == pageMaximum) { break; } } return plist.iterator(); } else { return null; } }
From source file:com.jeeframework.util.xml.XMLProperties.java
/** * Return all values who's path matches the given property * name as a String array, or an empty array if the if there * are no children. This allows you to retrieve several values * with the same property name. For example, consider the * XML file entry://from w w w . j av a 2 s .c o m * <pre> * <foo> * <bar> * <prop>some value</prop> * <prop>other value</prop> * <prop>last value</prop> * </bar> * </foo> * </pre> * If you call getProperties("foo.bar.prop") will return a string array containing * {"some value", "other value", "last value"}. * * @param name the name of the property to retrieve * @return all child property values for the given node name. */ public Iterator getChildProperties(String name) { String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML hierarchy, // stopping one short. Element element = document.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.element(propName[i]); if (element == null) { // This node doesn't match this part of the property name which // indicates this property doesn't exist so return empty array. return Collections.EMPTY_LIST.iterator(); } } // We found matching property, return values of the children. Iterator<Element> iter = element.elementIterator(propName[propName.length - 1]); ArrayList<String> props = new ArrayList<String>(); Element prop; String value; while (iter.hasNext()) { prop = iter.next(); value = prop.getText(); // check to see if the property is marked as encrypted if (Boolean.parseBoolean(prop.attribute(ENCRYPTED_ATTRIBUTE).getText())) { value = EncryptUtil.desDecrypt(encryptKey, value); } props.add(value); } return props.iterator(); }