List of usage examples for java.util Collection addAll
boolean addAll(Collection<? extends E> c);
From source file:io.hops.transaction.context.BlockInfoContext.java
@Override public void prepare(TransactionLocks tlm) throws TransactionContextException, StorageException { if (foundByInode && !(tlm.getLock(Lock.Type.Block) instanceof BlockLock) && !(tlm.getLock(Lock.Type.Block) instanceof LastTwoBlocksLock) && !(tlm.getLock(Lock.Type.Block) instanceof SqlBatchedBlocksLock)) { throw new TransactionContextException( "You can't call find ByINodeId(s) when taking the lock only on one block"); }//from w w w. j a va2 s . c om Collection<BlockInfoContiguous> removed = new ArrayList<>(getRemoved()); removed.addAll(concatRemovedBlks); dataAccess.prepare(removed, getAdded(), getModified()); }
From source file:com.autentia.wuija.widget.SelectManyLists.java
public Collection<T> getAllItems() { final Collection<T> items = allowedValuesList.getItems(); items.addAll(selectedValuesList.getItems()); return items; }
From source file:gobblin.data.management.retention.profile.MultiDatasetFinder.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public MultiDatasetFinder(FileSystem fs, Properties jobProps) { this.jobProps = jobProps; try {//from w w w. java 2 s .com this.datasetFinders = Lists.newArrayList(); if (jobProps.containsKey(datasetFinderClassKey())) { try { log.info(String.format("Instantiating datasetfinder %s ", jobProps.getProperty(datasetFinderClassKey()))); this.datasetFinders.add((DatasetsFinder) ConstructorUtils.invokeConstructor( Class.forName(jobProps.getProperty(datasetFinderClassKey())), fs, jobProps)); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException | ClassNotFoundException e) { log.error(String.format("Retention ignored could not instantiate datasetfinder %s.", jobProps.getProperty(datasetFinderClassKey())), e); Throwables.propagate(e); } } else if (jobProps.containsKey(datasetFinderImportedByKey())) { log.info("Instatiating dataset finders using tag " + jobProps.getProperty(datasetFinderImportedByKey())); ConfigClient client = ConfigClientCache.getClient(VersionStabilityPolicy.STRONG_LOCAL_STABILITY); Collection<URI> importedBys = Lists.newArrayList(); for (String tag : TAGS_SPLITTER.split(jobProps.getProperty(datasetFinderImportedByKey()))) { log.info("Looking for datasets that import tag " + tag); importedBys.addAll(client.getImportedBy(new URI(tag), false)); } for (URI importedBy : importedBys) { Config datasetClassConfig = client.getConfig(importedBy); try { this.datasetFinders.add((DatasetsFinder) GobblinConstructorUtils.invokeFirstConstructor( Class.forName(datasetClassConfig.getString(datasetFinderClassKey())), ImmutableList.of(fs, jobProps, datasetClassConfig), ImmutableList.of(fs, jobProps))); log.info(String.format("Instantiated datasetfinder %s for %s.", datasetClassConfig.getString(datasetFinderClassKey()), importedBy)); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { log.error(String.format("Retention ignored for %s. Could not instantiate datasetfinder %s.", importedBy, datasetClassConfig.getString(datasetFinderClassKey())), e); Throwables.propagate(e); } } } else { log.warn(String.format( "NO DATASET_FINDERS FOUND. Either specify dataset finder class at %s or specify the imported tags at %s", datasetFinderClassKey(), datasetFinderImportedByKey())); } } catch (IllegalArgumentException | VersionDoesNotExistException | ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | URISyntaxException e) { Throwables.propagate(e); } }
From source file:com.openshift.internal.restclient.ApiTypeMapper.java
private synchronized void init() { if (resourceEndpoints != null) { return;/* www .ja va 2 s . c om*/ } List<VersionedApiResource> resourceEndpoints = new ArrayList<>(); Collection<ApiGroup> groups = getLegacyGroups(); groups.addAll(getApiGroups()); groups.forEach(g -> { Collection<String> versions = g.getVersions(); versions.forEach(v -> { Collection<ModelNode> resources = getResources(g, v); addEndpoints(resourceEndpoints, g.getPrefix(), g.getName(), v, resources); }); }); this.resourceEndpoints = resourceEndpoints; }
From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.ApprovementMobilityCertificate.java
final private void mapCycles(final SortedSet<ICurriculumEntry> entries) { final Collection<CycleCurriculumGroup> cycles = new TreeSet<CycleCurriculumGroup>( CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID); cycles.addAll(getDocumentRequest().getRegistration().getLastStudentCurricularPlan() .getInternalCycleCurriculumGrops()); for (final CycleCurriculumGroup cycle : cycles) { if (!cycle.isConclusionProcessed() || isDEARegistration()) { final ApprovementMobilityCertificateRequest request = (getDocumentRequest()); final Curriculum curriculum = cycle.getCurriculum(request.getFilteringDate()); ApprovementMobilityCertificateRequest.filterEntries(entries, request, curriculum); }/* w w w .ja va 2 s . co m*/ } }
From source file:org.openmrs.module.custommessage.CustomMessageSource.java
/** * @see MutableMessageSource#getPresentations() *//*from w w w .j av a2s . co m*/ @Override public Collection<PresentationMessage> getPresentations() { Collection<PresentationMessage> ret = new ArrayList<PresentationMessage>(); for (PresentationMessageMap pmm : getCachedMessages().values()) { ret.addAll(pmm.values()); } return ret; }
From source file:com.esri.geoevent.processor.serviceareacalculator.ServiceAreaCalculator.java
public MapGeometry getAreaAroundPoint(MapGeometry point) { ArcGISServerConnection agsConnection = agsConnectionManager.getArcGISServerConnection(naConnectionName); Collection<KeyValue> params = new ArrayList<KeyValue>(); params.addAll(agsConnection.getDefaultParamsForRequest()); params.add(new KeyValue("facilities", generateFacilitiesJson(point))); params.add(new KeyValue("defaultBreaks", (new Integer(driveTime)).toString())); params.add(new KeyValue("travelDirection", "esriNATravelDirectionFromFacility")); if (!Validator.isEmpty(outputPolygonType)) params.add(new KeyValue("outputPolygons", outputPolygonType)); try (GeoEventHttpClient http = httpService.createNewClient()) { StringBuffer urlString = new StringBuffer(); urlString.append(agsConnection.getUrl().toExternalForm()); urlString.append(serviceAreaSolverPath); URL url = new URL(urlString.toString()); HttpPost postRequest = http.createPostRequest(url, params); postRequest.addHeader("Referer", agsConnection.getReferer()); String responseString = http.executeAndReturnBody(postRequest, GeoEventHttpClient.DEFAULT_TIMEOUT); return parseAreaSolverReply(responseString); } catch (Exception e) { LOGGER.debug("SERVICE_AREA_UNABLE_ERROR1", e.getMessage()); LOGGER.info(e.getMessage(), e);// w w w .ja va 2s . com } return null; }
From source file:fr.gouv.culture.thesaurus.service.rdf.LocalizedStrings.java
/** * Renvoie l'ensemble des valeurs connues pour les langues spcifies. * L'ordre des langues est respecte.// ww w. j a va 2 s. c om * * @param languages * Langues des valeurs rcuprer (une valeur <code>null</code> * correspond la langue neutre) * @return Ensemble des valeurs demandes (jamais <code>null</code>) */ public Collection<LocalizedString> getValues(final String... languages) { if (languages == null) { throw new NullArgumentException("languages"); } final Collection<LocalizedString> values = new ArrayList<LocalizedString>(); for (final String language : languages) { final Collection<LocalizedString> localizedStrings = internalMap.get(language); if (localizedStrings != null) { values.addAll(localizedStrings); } } return values; }
From source file:com.anrisoftware.prefdialog.fields.listbox.AbstractListBoxField.java
/** * Sets the values as the selected values of the list. * /*from w w w . j av a2 s .co m*/ * @param values * the values array. * * @throws PropertyVetoException */ @SuppressWarnings({ "rawtypes", "unchecked" }) public void setValues(Object[] values) throws PropertyVetoException { Object value = getValue(); if (value.getClass().isArray()) { setValue(values); } else if (value instanceof Collection) { Collection collection = (Collection) value; collection.clear(); collection.addAll(asList(values)); setValue(collection); } }
From source file:be.wimsymons.intellij.polopolyimport.PPImporter.java
private void doImportMultiple(final VirtualFile[] virtualFiles) { progressIndicator.setIndeterminate(true); // build list of files to process Collection<VirtualFile> filesToProcess = new LinkedHashSet<VirtualFile>(); for (VirtualFile virtualFile : virtualFiles) { filesToProcess.addAll(getFileList(virtualFile)); }/*from w w w. j a va 2s .c o m*/ progressIndicator.setIndeterminate(false); progressIndicator.setFraction(0.0D); totalCount = filesToProcess.size(); int counter = 0; for (VirtualFile file : filesToProcess) { if (progressIndicator.isCanceled()) { break; } counter++; progressIndicator.setFraction((double) counter / (double) totalCount); progressIndicator.setText("Importing " + file.getName() + " ..."); LOGGER.info("Importing file " + (counter + 1) + "/" + totalCount); doImportSingleFile(file); } }