List of usage examples for java.util Collection addAll
boolean addAll(Collection<? extends E> c);
From source file:edu.cornell.mannlib.vitro.webapp.auth.identifier.factory.HasProfileOrIsBlacklistedFactory.java
/** * Get all Individuals associated with the current user as SELF. */// w w w.j a va 2 s .c om private Collection<Individual> getAssociatedIndividuals(UserAccount user) { Collection<Individual> individuals = new ArrayList<Individual>(); if (user == null) { log.debug("No Associated Individuals: not logged in."); return individuals; } SelfEditingConfiguration sec = SelfEditingConfiguration.getBean(ctx); individuals.addAll(sec.getAssociatedIndividuals(indDao, user)); return individuals; }
From source file:mp.platform.cyclone.webservices.accounts.AccountWebServiceImpl.java
public List<TransferTypeVO> searchTransferTypes(final TransferTypeSearchParameters params) { final ServiceClient client = WebServiceContext.getClient(); final Collection<TransferType> transferTypePermissions = new ArrayList<TransferType>(); transferTypePermissions.addAll(client.getDoPaymentTypes()); transferTypePermissions.addAll(client.getReceivePaymentTypes()); final TransferTypeQuery query = accountHelper.toQuery(params); final List<TransferType> transferTypes = transferTypeService.search(query); final List<TransferTypeVO> vos = new ArrayList<TransferTypeVO>(transferTypes.size()); for (final TransferType transferType : transferTypes) { if (transferTypePermissions.contains(transferType)) { vos.add(accountHelper.toVO(transferType)); }//from w w w. j ava 2s . c om } return vos; }
From source file:net.cliseau.composer.javatarget.InstrumentationException.java
/** * Return list of dependencies for unit startup. * * This method returns a list of JAR files that the unit startup program * depends on. That is, whenever the template for the startup program is * modified to make use of additional external packages, this method has to * be adapted accordingly./*from ww w . ja v a 2 s .c o m*/ * * @param destDir Alternate directory for files (use null for actual directory). * @return Collection of paths to JAR files of the unit startup dependencies. * @see JavaConfig#getJavaDependencyPaths() * @todo Currently, both getInlinedDependencies and getStartupDependencies * refer to getInstantiationJARs(), even though not all of these JARs * might actually be used by both. Maybe introducing a proper split * betwen those JARs used for the INT+ENF parts and those for the * COR+POL part should be made. */ private Collection<String> getStartupDependencies(String destDir) throws InvalidConfigurationException { Collection<String> deps = new ArrayList<String>(); deps.addAll(Arrays.asList(new String[] { // CliSeAu units' classes (e.g., Coordinator) are obviously required config.getCliSeAuJavaRuntime() })); // the startup unit creates an object of the instantiation's LocalPolicy // subclass and might therefore require some of its dependencies deps.addAll(config.getJavaInstantiationJARs()); deps.addAll(config.getJavaDependencyPaths()); if (destDir != null) { deps = relativizePaths(deps, destDir); } return deps; }
From source file:net.cliseau.composer.javatarget.InstrumentationException.java
/** * Return list of dependencies inlined into the target. * * This method returns a list of JAR files that the instrumented target * additionally depends on. In addition to the AspectJ runtime this comprises * all packages (not in the standard Java API) that are used by the advice * which are inlined into the target. That is, whenever the template for * advice is modified to make use of additional external packages, this * method has to be adapted accordingly. * * @param destDir Alternate directory for files (use null for actual directory). * @return Collection of paths to JAR files of the inlined dependencies. * @see net.cliseau.composer.config.target.AspectJConfig#getAspectJAdviceTemplate() * @todo We actually don't need to add all "InstantiationJARs" as dependencies * but only those relevant for interceptor and enforcer; this particularly * excludes the local policy and related data types ("DRs"). *//*from ww w . j a v a 2s . c om*/ private Collection<String> getInlinedDependencies(String destDir) throws InvalidConfigurationException { Collection<String> deps = new ArrayList<String>(); deps.addAll(Arrays.asList(new String[] { // the AspectJ runtime is always (?) needed at runtime config.getAspectJRuntimeClasspath(), // aspect requires, e.g., EnforcementDecision and CriticalEventFactory config.getCliSeAuJavaRuntime() })); // aspect requires, e.g., the CriticalEventFactory instantiation and its // dependencies deps.addAll(config.getJavaInstantiationJARs()); if (destDir != null) { deps = relativizePaths(deps, destDir); } return deps; }
From source file:graph.DependencyDirectedSparceMultiGraph.java
public Collection<E> getIncidentEdges(V vertex) { Collection<E> incident = new HashSet<E>(); incident.addAll(getIncoming_internal(vertex)); incident.addAll(getOutgoing_internal(vertex)); return incident; }
From source file:dk.statsbiblioteket.doms.domsutil.surveillance.logappender.CachingLogRegistry.java
/** * Returns all log messages received since the given date. * * @param time Only messages strictly after the given date are returned. * @return A status containing list of log messages. *//* w ww. j a va 2 s. c om*/ public Status getStatusSince(long time) { synchronized (lock) { log.trace("Enter getStatusSince(" + time + ")"); Collection<Collection<StatusMessage>> listCollection = logStatusMessages .subMap(time, false, Long.MAX_VALUE, true).values(); Collection<StatusMessage> statusMessages = new ArrayList<StatusMessage>(); for (Collection<StatusMessage> collection : listCollection) { statusMessages.addAll(collection); } Status status = new Status(); status.setName(name); status.getMessages().addAll(statusMessages); return status; } }
From source file:com.sunsprinter.diffunit.core.translators.AbstractPropertyDrivenTranslator.java
protected Collection<PropertyDescriptor> retrieveAllProperties(final T object) throws TranslationException { try {/* w w w .ja va2 s . co m*/ final Collection<PropertyDescriptor> properties = new TreeSet<PropertyDescriptor>( createPropertyDescriptorComparator()); properties.addAll(Arrays.asList(Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors())); return properties; } catch (final IntrospectionException e) { throw new TranslationException(object, String.format("Unable to retrieve properties for object '%s'.", getInstanceTracker().getObjectId(object))); } }
From source file:org.talend.license.LicenseRetriver.java
public void updateLicense() { File userHome = new File(System.getProperty("user.home")); File licenseRoot = new File(userHome, "licenses"); File history = new File(licenseRoot, ".history"); if (!licenseRoot.exists()) { licenseRoot.mkdirs();//from w w w.j a v a2 s . c om history.mkdirs(); } final Collection<File> files = new ArrayList<File>(); for (String version : versions) { Collection<File> fs = updateLicense(version, licenseRoot); if (null != fs) files.addAll(fs); } File[] his = licenseRoot.listFiles(new FileFilter() { public boolean accept(File f) { return f.isFile() && !files.contains(f); } }); if (null != his && his.length > 0) { for (File file : his) { file.renameTo(new File(history, file.getName())); } } }
From source file:demo.config.PropertyConverter.java
/** * Returns a collection with all values contained in the specified object. * This method is used for instance by the {@code addProperty()} * implementation of the default configurations to gather all values of the * property to add. Depending on the type of the passed in object the * following things happen:/*www. j a va 2 s . c o m*/ * <ul> * <li>Strings are checked for delimiter characters and split if necessary.</li> * <li>For objects implementing the {@code Iterable} interface, the * corresponding {@code Iterator} is obtained, and contained elements are * added to the resulting collection.</li> * <li>Arrays are treated as {@code Iterable} objects.</li> * <li>All other types are directly inserted.</li> * <li>Recursive combinations are supported, e.g. a collection containing an * array that contains strings: The resulting collection will only contain * primitive objects (hence the name "flatten").</li> * </ul> * * @param value * the value to be processed * @param delimiter * the delimiter for String values * @return a "flat" collection containing all primitive values of * the passed in object */ private static Collection<?> flatten(Object value, char delimiter) { if (value instanceof String) { String s = (String) value; if (s.indexOf(delimiter) > -1) { return split(s, delimiter); } } Collection<Object> result = new LinkedList<Object>(); if (value instanceof Iterable) { flattenIterator(result, ((Iterable<?>) value).iterator(), delimiter); } else if (value instanceof Iterator) { flattenIterator(result, (Iterator<?>) value, delimiter); } else if (value != null) { if (value.getClass().isArray()) { for (int len = Array.getLength(value), idx = 0; idx < len; idx++) { result.addAll(flatten(Array.get(value, idx), delimiter)); } } else { result.add(value); } } return result; }
From source file:lodsve.core.config.properties.PropertyConverter.java
/** * Returns a collection with all values contained in the specified object. * This method is used for instance by the {@code addProperty()} * implementation of the default configurations to gather all values of the * property to add. Depending on the type of the passed in object the * following things happen:/* w w w. ja v a 2 s.c om*/ * <ul> * <li>Strings are checked for delimiter characters and split if necessary.</li> * <li>For objects implementing the {@code Iterable} interface, the * corresponding {@code Iterator} is obtained, and contained elements are * added to the resulting collection.</li> * <li>Arrays are treated as {@code Iterable} objects.</li> * <li>All other types are directly inserted.</li> * <li>Recursive combinations are supported, e.g. a collection containing an * array that contains strings: The resulting collection will only contain * primitive objects (hence the name "flatten").</li> * </ul> * * @param value * the value to be processed * @param delimiter * the delimiter for String values * @return a "flat" collection containing all primitive values of * the passed in object */ private static Collection<?> flatten(Object value, char delimiter) { if (value instanceof String) { String s = (String) value; if (s.indexOf(delimiter) > 0) { return split(s, delimiter); } } Collection<Object> result = new LinkedList<Object>(); if (value instanceof Iterable) { flattenIterator(result, ((Iterable<?>) value).iterator(), delimiter); } else if (value instanceof Iterator) { flattenIterator(result, (Iterator<?>) value, delimiter); } else if (value != null) { if (value.getClass().isArray()) { for (int len = Array.getLength(value), idx = 0; idx < len; idx++) { result.addAll(flatten(Array.get(value, idx), delimiter)); } } else { result.add(value); } } return result; }