List of usage examples for java.util Collection addAll
boolean addAll(Collection<? extends E> c);
From source file:com.zero.service.impl.BaseServiceImpl.java
@SuppressWarnings({ "unchecked", "rawtypes" }) private void copyProperties(Object source, Object target) throws BeansException { Assert.notNull(source, "Source must not be null"); Assert.notNull(target, "Target must not be null"); PropertyDescriptor[] targetPds = BeanUtils.getPropertyDescriptors(target.getClass()); for (PropertyDescriptor targetPd : targetPds) { if (targetPd.getWriteMethod() != null) { PropertyDescriptor sourcePd = BeanUtils.getPropertyDescriptor(source.getClass(), targetPd.getName()); if (sourcePd != null && sourcePd.getReadMethod() != null) { try { Method readMethod = sourcePd.getReadMethod(); if (!Modifier.isPublic(readMethod.getDeclaringClass().getModifiers())) { readMethod.setAccessible(true); }/*from w w w . j a v a2 s . co m*/ Object sourceValue = readMethod.invoke(source); Object targetValue = readMethod.invoke(target); if (sourceValue != null && targetValue != null && targetValue instanceof Collection) { Collection collection = (Collection) targetValue; collection.clear(); collection.addAll((Collection) sourceValue); } else { Method writeMethod = targetPd.getWriteMethod(); if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers())) { writeMethod.setAccessible(true); } writeMethod.invoke(target, sourceValue); } } catch (Throwable ex) { throw new FatalBeanException("Could not copy properties from source to target", ex); } } } } }
From source file:com.geewhiz.pacify.managers.PropertyResolveManager.java
public Collection<Defect> checkForDuplicateEntry() { Collection<Defect> result = new LinkedHashSet<Defect>(); for (PropertyResolver propertyResolver : propertyResolverList) { result.addAll(propertyResolver.checkForDuplicateEntry()); }//from w ww . j a va2 s . c om return result; }
From source file:se.altrusoft.alfplay.node.NodePossiblePropertiesGet.java
@Override public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { res.setContentEncoding("UTF-8"); Map<String, String> templateArgs = req.getServiceMatch().getTemplateVars(); String nodeId = templateArgs.get("nodeId"); if (nodeId == null) throw new WebScriptException("No nodeId provided"); NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId); if (!this.nodeService.exists(nodeRef)) throw new WebScriptException("No such node: " + nodeId); QName nodeType = this.nodeService.getType(nodeRef); Set<QName> aspects = this.nodeService.getAspects(nodeRef); Collection<PropertyDefinition> props = new ArrayList<PropertyDefinition>(); ClassDefinition nodeTypeDefiniton = this.dictionaryServiceExtras.getClassDefinition(nodeType); props.addAll(this.dictionaryServiceExtras.getPropertyDefinitions(nodeTypeDefiniton)); for (QName aspect : aspects) { nodeTypeDefiniton = this.dictionaryServiceExtras.getClassDefinition(aspect); props.addAll(this.dictionaryServiceExtras.getPropertyDefinitions(nodeTypeDefiniton)); }/*from w w w . j ava 2s .c o m*/ JSONObject jsonResult = new JSONObject(); try { JSONArray jsonAspects = new JSONArray(); for (QName aspect : aspects) { jsonAspects.put(this.dictionaryServiceExtras.getSimpleQName(aspect).toString()); } JSONArray jsonProps = new JSONArray(); for (PropertyDefinition prop : props) { JSONObject jsonProperty = new JSONObject(); jsonProperty.put("name", this.dictionaryServiceExtras.getSimpleQName(prop.getName()).toString()); jsonProperty.put("value", prop.getDataType()); jsonProperty.put("defaultValue", prop.getDefaultValue()); jsonProperty.put("isMandatory", prop.isMandatory()); jsonProps.put(jsonProperty); } jsonResult.put("nodeId", nodeId); jsonResult.put("type", this.dictionaryServiceExtras.getSimpleQName(nodeType).toString()); jsonResult.put("aspects", jsonAspects); jsonResult.put("properties", jsonProps); String jsonString = jsonResult.toString(4); res.getWriter().write(jsonString); } catch (JSONException e) { throw new WebScriptException("Unable to serialize JSON"); } }
From source file:de.extra.client.core.responce.impl.ResponseData.java
@Override public Collection<ISingleResponseData> getResponses() { Collection<ISingleResponseData> allResponsesList = new ArrayList<ISingleResponseData>(); for (Collection<ISingleResponseData> reponseDatalist : responseDatenMap.values()) { allResponsesList.addAll(reponseDatalist); }/*from ww w .j av a2 s. c o m*/ return allResponsesList; }
From source file:edu.uci.ics.jung.graph.SparseMultigraph.java
public Collection<V> getNeighbors(V vertex) { if (!containsVertex(vertex)) return null; Collection<V> out = new HashSet<V>(); out.addAll(this.getPredecessors(vertex)); out.addAll(this.getSuccessors(vertex)); return out;//from ww w . j a v a 2 s . c o m }
From source file:edu.uci.ics.jung.graph.SparseMultigraph.java
public Collection<E> getIncidentEdges(V vertex) { if (!containsVertex(vertex)) return null; Collection<E> out = new HashSet<E>(); out.addAll(this.getInEdges(vertex)); out.addAll(this.getOutEdges(vertex)); return out;/* w ww. ja va2s . co m*/ }
From source file:com.comcast.video.dawg.controller.house.mocks.MockParkService.java
@SuppressWarnings("unchecked") @Override//from w w w. j a v a 2 s.c om public Collection<String> getAllTags() { Map<String, Object>[] stbs = findAll(); Collection<String> tags = new HashSet<String>(); for (Map<String, Object> stb : stbs) { Collection<String> stbTags = (Collection<String>) stb.get(MetaStb.TAGS); tags.addAll(stbTags); } return tags; }
From source file:org.training.storefront.breadcrumb.impl.SearchBreadcrumbBuilder.java
public List<Breadcrumb> getBreadcrumbs(final String categoryCode, final String searchText, final boolean emptyBreadcrumbs) throws IllegalArgumentException { final List<Breadcrumb> breadcrumbs = new ArrayList<>(); if (categoryCode == null) { final Breadcrumb breadcrumb = new Breadcrumb("/search?text=" + getEncodedUrl(searchText), StringEscapeUtils.escapeHtml(searchText), (emptyBreadcrumbs ? LAST_LINK_CLASS : "")); breadcrumbs.add(breadcrumb);//from w ww . jav a 2s.co m } else { // Create category hierarchy path for breadcrumb final List<Breadcrumb> categoryBreadcrumbs = new ArrayList<>(); final Collection<CategoryModel> categoryModels = new ArrayList<>(); final CategoryModel lastCategoryModel = getCommerceCategoryService().getCategoryForCode(categoryCode); categoryModels.addAll(lastCategoryModel.getSupercategories()); categoryBreadcrumbs .add(getCategoryBreadcrumb(lastCategoryModel, (!emptyBreadcrumbs ? LAST_LINK_CLASS : ""))); while (!categoryModels.isEmpty()) { final CategoryModel categoryModel = categoryModels.iterator().next(); if (!(categoryModel instanceof ClassificationClassModel)) { if (categoryModel != null) { categoryBreadcrumbs.add(getCategoryBreadcrumb(categoryModel)); categoryModels.clear(); categoryModels.addAll(categoryModel.getSupercategories()); } } else { categoryModels.remove(categoryModel); } } Collections.reverse(categoryBreadcrumbs); breadcrumbs.addAll(categoryBreadcrumbs); } return breadcrumbs; }
From source file:com.assemblade.server.model.AbstractFolder.java
@Override public Collection<String> getAttributeNames() { Collection<String> attributeNames = super.getAttributeNames(); attributeNames.addAll(Arrays.asList("cn", "description", "asb-type", "aclRights", "aci")); return attributeNames; }