List of usage examples for java.util List removeAll
boolean removeAll(Collection<?> c);
From source file:services.echannel.EchannelServiceImpl.java
@Override public DataSyndicationAgreement submitAgreementNoSlave(String refId, String name, Date startDate, Date endDate, List<Long> agreementItemIds, String partnerEmail) throws EchannelException { SubmitDataSyndicationAgreementNoSlaveRequest submitAgreementNoSlaveRequest = new SubmitDataSyndicationAgreementNoSlaveRequest(); submitAgreementNoSlaveRequest.refId = refId; submitAgreementNoSlaveRequest.name = name; submitAgreementNoSlaveRequest.startDate = startDate; submitAgreementNoSlaveRequest.endDate = endDate; agreementItemIds.removeAll(Collections.singleton(null)); submitAgreementNoSlaveRequest.agreementItemIds = agreementItemIds; submitAgreementNoSlaveRequest.partnerEmail = partnerEmail; JsonNode content = getMapper().valueToTree(submitAgreementNoSlaveRequest); JsonNode response = this.call(HttpMethod.POST, DATA_SYNDICATION_AGREEMENT_ACTION + "/submit/no-slave", null, content);//from w w w . j ava 2 s. c o m return getMapper().convertValue(response, DataSyndicationAgreement.class); }
From source file:fr.gouv.vitam.mdbes.MongoDbAccess.java
/** * Update the links//from w w w. j a va 2 s .c om * * @param obj1 * @param vtReloaded * @param relation * @param src * @return the update part */ protected final BasicDBObject updateLinks(final VitamType obj1, final VitamType vtReloaded, final VitamLinks relation, final boolean src) { // DBCollection coll = (src ? relation.col1.collection : relation.col2.collection); final String fieldname = (src ? relation.field1to2 : relation.field2to1); // VitamType vt = (VitamType) coll.findOne(new BasicDBObject("_id", obj1.get("_id"))); if (vtReloaded != null) { @SuppressWarnings("unchecked") final List<String> srcList = (List<String>) vtReloaded.remove(fieldname); @SuppressWarnings("unchecked") final List<String> targetList = (List<String>) obj1.get(fieldname); if (srcList != null && targetList != null) { targetList.removeAll(srcList); } else if (targetList != null) { // srcList empty } else { // targetList empty obj1.put(fieldname, srcList); } if (targetList != null && !targetList.isEmpty()) { // need to add $addToSet return new BasicDBObject(fieldname, new BasicDBObject("$each", targetList)); } } else { // nothing since save will be done just after, except checking array exists if (!obj1.containsField(fieldname)) { obj1.put(fieldname, new ArrayList<>()); } } return null; }
From source file:com.codejumble.opentube.Main.java
private List<String> renderDownloadQueue(File importedFile) throws IOException { logger.error("Rendering the download page..."); List<String> lines = Files.readAllLines(Paths.get(importedFile.getAbsolutePath()), Charset.defaultCharset()); List<String> linesToRemove = new ArrayList<String>(); for (String line : lines) { if (!urlValidator.isValid(line)) { linesToRemove.add(line);/*from www.j av a2s .c o m*/ } } lines.removeAll(linesToRemove); logger.error("Valid urls found: {}", lines.size()); return lines; }
From source file:com.glaf.base.modules.sys.service.mybatis.SysUserRoleServiceImpl.java
public List<SysUser> getUnAuthorizedUser(SysUser user) { if (user == null) { return new java.util.ArrayList<SysUser>(); }/*from w ww .ja va2 s . c o m*/ logger.info("name:" + user.getName()); user = sysUserService.findById(user.getId()); // ?,? SysDepartment dept = user.getDepartment(); logger.info("dept:" + dept.getName()); List<SysUser> list = sysUserService.getSysUserList((int) dept.getId()); // ?? List<SysDepartment> deptList = sysDepartmentService.getSysDepartmentList((int) dept.getId()); Iterator<SysDepartment> iter = deptList.iterator(); while (iter.hasNext()) { SysDepartment dept2 = (SysDepartment) iter.next(); logger.info("dept:" + dept2.getName()); list.addAll(sysUserService.getSysUserList((int) dept2.getId())); } // list.remove(user); // ? list.removeAll(getAuthorizedUser(user)); return list; }
From source file:edu.msu.cme.rdp.graph.utils.ContigMerger.java
private static List<MergedContig> mergeContigs(Map<String, Sequence> leftContigs, Map<String, Sequence> rightContigs, String kmer, String gene, ProfileHMM hmm) { List<MergedContig> finalized = new ArrayList(); List<MergedContig> candidates = new ArrayList(); int k = kmer.length(); Map<String, Set<MergedContig>> contigToMerges = new HashMap(); for (Sequence leftContig : leftContigs.values()) { String leftSeq = leftContig.getSeqString(); leftSeq = leftSeq.substring(0, leftSeq.length() - k); for (Sequence rightContig : rightContigs.values()) { String seq = leftSeq + rightContig.getSeqString(); MergedContig mergedContig = new MergedContig(); if (hmm.getAlphabet() == SequenceType.Protein) { mergedContig.nuclSeq = seq; seq = mergedContig.protSeq = ProteinUtils.getInstance().translateToProtein(seq, true, 11); } else if (hmm.getAlphabet() == SequenceType.Nucleotide) { mergedContig.nuclSeq = seq; } else { throw new IllegalStateException("Cannot handle hmm alpha " + hmm.getAlphabet()); }/*from w w w. j a v a2s . c om*/ mergedContig.score = ForwardScorer.scoreSequence(hmm, seq); mergedContig.leftContig = leftContig.getSeqName(); mergedContig.rightContig = rightContig.getSeqName(); mergedContig.length = seq.length(); mergedContig.gene = gene; candidates.add(mergedContig); for (String seqid : new String[] { mergedContig.leftContig, mergedContig.rightContig }) { if (!contigToMerges.containsKey(seqid)) { contigToMerges.put(seqid, new HashSet()); } contigToMerges.get(seqid).add(mergedContig); } } } Collections.sort(candidates); while (candidates.size() > 0) { MergedContig mc = candidates.remove(0); candidates.removeAll(contigToMerges.get(mc.leftContig)); candidates.removeAll(contigToMerges.get(mc.rightContig)); finalized.add(mc); } return finalized; }
From source file:com.opensymphony.able.action.EmbeddedCollectionActionBean.java
/** * Lets save the current list of entities */// w w w . j a v a2s . c o m public Resolution save() { if (getContext().getValidationErrors().isEmpty()) { List<E> ownerCollection = getOwnedEntities(); List<E> formSubmittedEntities = getEntities(); Map<Object, E> set = new HashMap<Object, E>(formSubmittedEntities.size()); for (E formSubmittedEntity : formSubmittedEntities) { Object id = getEntityInfo().getIdValue(formSubmittedEntity); set.put(id, formSubmittedEntity); } Set ids = new HashSet(); Iterator<E> iter = ownerCollection.iterator(); while (iter.hasNext()) { E entity = iter.next(); Object id = getEntityInfo().getIdValue(entity); if (set.remove(id) == null) { iter.remove(); } ids.add(id); } ownerCollection.addAll(set.values()); ownerCollection.addAll(getAdd()); ownerCollection.removeAll(getDelete()); TransactionOutcome.shouldCommit(); } // TODO // getContext().addMsg( "saved " + getEntityName(); ); return new RedirectResolution(getHomeUri()); }
From source file:gov.medicaid.binders.FacilityCapacityFormBinder.java
/** * Captures the error messages related to the form. * @param enrollment the enrollment that was validated * @param messages the messages to select from * * @return the list of errors related to the form *//*w w w.ja v a2s.c o m*/ protected List<FormError> selectErrors(EnrollmentType enrollment, StatusMessagesType messages) { List<FormError> errors = new ArrayList<FormError>(); List<StatusMessageType> ruleErrors = messages.getStatusMessage(); List<StatusMessageType> caughtMessages = new ArrayList<StatusMessageType>(); synchronized (ruleErrors) { for (StatusMessageType ruleError : ruleErrors) { int count = errors.size(); String path = ruleError.getRelatedElementPath(); if (path == null) { continue; } if (path.equals("/ProviderInformation/FacilityCredentials/NumberOfBeds")) { errors.add(createError("numberOfBeds", ruleError.getMessage())); } else if (path.equals("/ProviderInformation/FacilityCredentials/NumberOfBedsEffectiveDate")) { errors.add(createError("effectiveDate", ruleError.getMessage())); } if (errors.size() > count) { // caught caughtMessages.add(ruleError); } } // so it does not get processed anywhere again ruleErrors.removeAll(caughtMessages); } return errors.isEmpty() ? NO_ERRORS : errors; }
From source file:nl.minbzk.dwr.zoeken.enricher.processor.UIMAInjector.java
private void filterGeo(final ProcessorContent processorOutput, final Map<String, List<String>> annotationsWithLocations) { for (Entry<String, List<String>> annotationWithLocations : annotationsWithLocations.entrySet()) { List<String> geoValues = annotationWithLocations.getValue(); List<String> geoValuesRemove = new ArrayList<String>(); // XXX: Add an additional field containing the geo-names for (int i = 0; i < geoValues.size(); i++) { if (!StringUtils.hasText(geoValues.get(i)) || geoValues.get(i).equals(GEO_LOCATION_UNKNOWN)) { logger.info("[GEO] Dropping geo-location '" + geoValues.get(i) + "' - location could not be resolved"); geoValuesRemove.add(geoValues.get(i)); }/*w w w. j a v a 2 s.co m*/ } geoValues.removeAll(geoValuesRemove); // Now split it up, and add it as a field containing just the coordinate as well as one containing the name + separator + geohash List<String> geoValuesCoordinates = new ArrayList<String>(geoValues.size()); for (String geoValue : geoValues) if (geoValue.lastIndexOf(GEO_LOCATION_SEPARATOR) == -1) logger.error("Invalid name / geohash combination '" + geoValue + "' given - should have been removed"); else { Point geoPoint = GeohashUtils.decode( geoValue.substring(geoValue.lastIndexOf(GEO_LOCATION_SEPARATOR) + 1), SpatialContext.GEO); // Add as lat,lon geoValuesCoordinates.add(geoPoint.getY() + "," + geoPoint.getX()); } // And add it to the final result logger.info("[GEO] " + annotationWithLocations.getKey() + " : " + geoValuesCoordinates + " (" + annotationWithLocations.getKey() + GEO_LOCATION_HASH_SUFFIX + " : " + geoValues + ")"); processorOutput.getMetadata().put(annotationWithLocations.getKey(), geoValuesCoordinates); processorOutput.getMetadata().put(annotationWithLocations.getKey() + GEO_LOCATION_HASH_SUFFIX, geoValues); } }
From source file:com.all.client.model.LocalPlaylist.java
public final void _moveTracks(List<Track> movedTracks, int row) { int currentRow = row; List<Track> tracks = null; if (!isSmartPlaylist()) { tracks = new ArrayList<Track>(getTracks()); } else {//from w w w.ja v a2s. c o m tracks = getTracks(); } for (Track track : movedTracks) { int indexOf = tracks.indexOf(track); if (indexOf >= 0 && indexOf <= currentRow) { currentRow--; } } tracks.removeAll(movedTracks); tracks.addAll(currentRow, movedTracks); if (!isSmartPlaylist()) { int i = 0; for (Track track : tracks) { PlaylistTrack playlistTrack = getPlaylistTrack(track); playlistTrack.setTrackPosition(i); i++; } } }
From source file:de.acosix.alfresco.site.hierarchy.repo.service.SiteHierarchyServiceImpl.java
/** * * {@inheritDoc}/*from w w w . ja v a2 s . c o m*/ */ @Override public List<SiteInfo> listChildSites(final String parentSite, final boolean respectShowInHierarchyMode) { ParameterCheck.mandatoryString("parentSite", parentSite); final SiteInfo parentSiteInfo = this.siteService.getSite(parentSite); if (parentSiteInfo == null) { throw new SiteDoesNotExistException(parentSite); } LOGGER.debug("Listing child sites for parent {}", parentSite); final List<ChildAssociationRef> childSiteAssocs = this.nodeService.getChildAssocs( parentSiteInfo.getNodeRef(), SiteHierarchyModel.ASSOC_CHILD_SITE, RegexQNamePattern.MATCH_ALL); if (respectShowInHierarchyMode) { final List<ChildAssociationRef> childSiteAssocsNeverToShow = this.nodeService .getChildAssocsByPropertyValue(parentSiteInfo.getNodeRef(), SiteHierarchyModel.PROP_SHOW_IN_HIERARCHY_MODE, SiteHierarchyModel.CONSTRAINT_SHOW_IN_HIERARCHY_MODES_NEVER); childSiteAssocs.removeAll(childSiteAssocsNeverToShow); } final List<SiteInfo> childSites = new ArrayList<>(childSiteAssocs.size()); childSiteAssocs.forEach(childSiteAssoc -> { final SiteInfo site = this.siteService.getSite(childSiteAssoc.getChildRef()); if (site != null) { childSites.add(site); } }); final Collator collator = Collator.getInstance(I18NUtil.getLocale()); Collections.sort(childSites, (siteA, siteB) -> { final int titleCompareResult = collator.compare(siteA.getTitle(), siteB.getTitle()); return titleCompareResult; }); LOGGER.debug("Listed child sites {} for parent {}", childSites, parentSite); return childSites; }