Java Code Examples for org.apache.commons.collections4.ListUtils#union()
The following examples show how to use
org.apache.commons.collections4.ListUtils#union() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoveragePerContigCollection.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
public CoveragePerContigCollection(final LocatableMetadata metadata, final List<CoveragePerContig> coveragePerContigs, final List<String> contigs) { super( metadata, coveragePerContigs, new TableColumnCollection(ListUtils.union(Collections.singletonList(SAMPLE_NAME_TABLE_COLUMN), contigs)), dataLine -> new CoveragePerContig( dataLine.get(SAMPLE_NAME_TABLE_COLUMN), contigs.stream().collect(Collectors.toMap( Function.identity(), dataLine::getInt, (u, v) -> { throw new GATKException.ShouldNeverReachHereException("Cannot have duplicate contigs."); }, //contigs should already be distinct LinkedHashMap::new))), (coveragePerContig, dataLine) -> { dataLine.append(coveragePerContig.getSampleName()); contigs.stream().map(coveragePerContig::getCoverage).forEach(dataLine::append); }); }
Example 2
Source File: RecipientReportServiceImpl.java From openemm with GNU Affero General Public License v3.0 | 5 votes |
@Override public List<ComRecipientHistory> getStatusHistory(int recipientId, int companyId) { List<RecipientBindingHistory> recipientBindingHistory = getBindingHistory(recipientId, companyId); List<ComRecipientHistory> convertedBindingHistory = recipientHistoryConverter.convert(recipientBindingHistory); List<ComRecipientHistory> recipientProfileHistory = getProfileHistory(recipientId, companyId); List<ComRecipientHistory> unitedList = ListUtils.union(convertedBindingHistory, recipientProfileHistory); unitedList.sort(Comparator.comparing(ComRecipientHistory::getChangeDate, Comparator.nullsFirst(Comparator.naturalOrder())).reversed()); return unitedList; }
Example 3
Source File: ScalarHMMSegmenter.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 5 votes |
public ScalarHMMSegmenter(final List<SimpleInterval> positions, final List<DATA> data, final List<Double> constantHiddenStates, final List<Double> initialNonConstantHiddenStates) { super(positions, data, ListUtils.union(constantHiddenStates, initialNonConstantHiddenStates), uniformWeights(constantHiddenStates.size() + initialNonConstantHiddenStates.size()), DEFAULT_INITIAL_CONCENTRATION, DEFAULT_MEMORY_LENGTH); numConstantStates = constantHiddenStates.size(); }
Example 4
Source File: DeployedMtaDetector.java From multiapps-controller with Apache License 2.0 | 5 votes |
/** * Extra step required for backwards compatibility (see {@link DeployedMtaEnvDetector}) * * @param mtasByMetadata * @param mtasByEnv * @return */ private List<DeployedMta> combineMetadataAndEnvMtas(List<DeployedMta> mtasByMetadata, List<DeployedMta> mtasByEnv) { List<DeployedMta> missedMtas = mtasByEnv.stream() .filter(mta -> !mtasByMetadata.contains(mta)) .collect(Collectors.toList()); return ListUtils.union(mtasByMetadata, missedMtas); }
Example 5
Source File: BaseAction.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
void delete_item(Business business, Process process, boolean onlyRemoveNotCompleted) throws Exception { List<String> jobs = business.work().listJobWithProcess(process.getId()); if (!onlyRemoveNotCompleted) { jobs = ListUtils.union(jobs, business.workCompleted().listJobWithProcess(process.getId())); } EntityManagerContainer emc = business.entityManagerContainer(); for (String job : jobs) { emc.beginTransaction(Item.class); for (Item o : business.item().listObjectWithJob(job)) { emc.remove(o); } emc.commit(); } }
Example 6
Source File: ActionDelete.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private void delete_dataItem(Business business, Application application, boolean onlyRemoveNotCompleted) throws Exception { List<String> jobs = business.work().listJobWithApplication(application.getId()); if (!onlyRemoveNotCompleted) { jobs = ListUtils.union(jobs, business.workCompleted().listJobWithApplication(application.getId())); } EntityManagerContainer emc = business.entityManagerContainer(); for (String job : jobs) { emc.beginTransaction(Item.class); for (Item o : business.item().listObjectWithJob(job)) { emc.remove(o); } emc.commit(); } }
Example 7
Source File: ArtificialAnnotationUtils.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static AlleleLikelihoods<GATKRead, Allele> makeLikelihoods(final String sample, final List<GATKRead> refReads, final List<GATKRead> altReads, final List<GATKRead> uninformativeReads, final double refReadAltLikelihood, final double altReadRefLikelihood, final double badReadAltLikelihood, final Allele refAllele, final Allele altAllele) { final List<GATKRead> reads = ListUtils.union(ListUtils.union(refReads, altReads), uninformativeReads); final AlleleLikelihoods<GATKRead, Allele> likelihoods = initializeReadLikelihoods(sample, new IndexedAlleleList<>(Arrays.asList(refAllele, altAllele)), reads); final LikelihoodMatrix<GATKRead, Allele> matrix = likelihoods.sampleMatrix(0); int readIndex = 0; for (int i = 0; i < refReads.size(); i++) { matrix.set(0, readIndex, MATCH_LIKELIHOOD); matrix.set(1, readIndex, refReadAltLikelihood); readIndex++; } for (int i = 0; i < altReads.size(); i++) { matrix.set(0, readIndex, altReadRefLikelihood); matrix.set(1, readIndex, MATCH_LIKELIHOOD); readIndex++; } for (int i = 0; i < uninformativeReads.size(); i++) { matrix.set(0, readIndex, MATCH_LIKELIHOOD); matrix.set(1, readIndex, badReadAltLikelihood); readIndex++; } return likelihoods; }
Example 8
Source File: ActionUpdateContentCallback.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
ActionResult<Wo<WoObject>> execute(EffectivePerson effectivePerson, String id, String callback, byte[] bytes, FormDataContentDisposition disposition) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo<WoObject>> result = new ActionResult<>(); Attachment attachment = emc.find(id, Attachment.class); if (null == attachment) { throw new ExceptionAttachmentNotExistCallback(callback, id); } if ((!StringUtils.equals(effectivePerson.getDistinguishedName(), attachment.getPerson())) && (!attachment.getEditorList().contains(effectivePerson.getDistinguishedName()))) { throw new ExceptionAttachmentAccessDeniedCallback(effectivePerson, callback, attachment); } StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, attachment.getStorage()); if (null == mapping) { throw new ExceptionStorageNotExistCallback(callback, attachment.getStorage()); } attachment.setLastUpdatePerson(effectivePerson.getDistinguishedName()); /** 禁止不带扩展名的文件上传 */ /** 文件名编码转换 */ String fileName = new String(disposition.getFileName().getBytes(DefaultCharset.charset_iso_8859_1), DefaultCharset.charset); fileName = FilenameUtils.getName(fileName); if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) { throw new ExceptionEmptyExtensionCallback(callback, fileName); } /** 不允许不同的扩展名上传 */ if (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)), attachment.getExtension())) { throw new ExceptionExtensionNotMatchCallback(callback, fileName, attachment.getExtension()); } emc.beginTransaction(Attachment.class); attachment.updateContent(mapping, bytes); emc.check(attachment, CheckPersistType.all); emc.commit(); /** 通知所有的共享和共享编辑人员 */ List<String> people = new ArrayList<>(); people = ListUtils.union(attachment.getShareList(), attachment.getEditorList()); people.add(attachment.getPerson()); for (String o : ListTools.trim(people, true, true)) { if (!StringUtils.equals(o, effectivePerson.getDistinguishedName())) { this.message_send_attachment_editorModify(attachment, effectivePerson.getDistinguishedName(), o); } } ApplicationCache.notify(Attachment.class, attachment.getId()); WoObject woObject = new WoObject(); woObject.setId(attachment.getId()); Wo<WoObject> wo = new Wo<>(callback, woObject); result.setData(wo); return result; } }
Example 9
Source File: ActionUpdateContent.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, byte[] bytes, FormDataContentDisposition disposition) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo> result = new ActionResult<>(); Attachment attachment = emc.find(id, Attachment.class); if (null == attachment) { throw new ExceptionAttachmentNotExist(id); } if ((!StringUtils.equals(effectivePerson.getDistinguishedName(), attachment.getPerson())) && (!attachment.getEditorList().contains(effectivePerson.getDistinguishedName()))) { throw new ExceptionAttachmentAccessDenied(effectivePerson, attachment); } StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, attachment.getStorage()); if (null == mapping) { throw new ExceptionStorageNotExist(attachment.getStorage()); } attachment.setLastUpdatePerson(effectivePerson.getDistinguishedName()); /** 禁止不带扩展名的文件上传 */ /** 文件名编码转换 */ String fileName = new String(disposition.getFileName().getBytes(DefaultCharset.charset_iso_8859_1), DefaultCharset.charset); fileName = FilenameUtils.getName(fileName); if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) { throw new ExceptionEmptyExtension(fileName); } /** 不允许不同的扩展名上传 */ if (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)), attachment.getExtension())) { throw new ExceptionExtensionNotMatch(fileName, attachment.getExtension()); } emc.beginTransaction(Attachment.class); attachment.updateContent(mapping, bytes); emc.check(attachment, CheckPersistType.all); emc.commit(); /** 通知所有的共享和共享编辑人员 */ List<String> people = new ArrayList<>(); people = ListUtils.union(attachment.getShareList(), attachment.getEditorList()); people.add(attachment.getPerson()); for (String o : ListTools.trim(people, true, true)) { if (!StringUtils.equals(o, effectivePerson.getDistinguishedName())) { this.message_send_attachment_editorModify(attachment, effectivePerson.getDistinguishedName(), o); } } ApplicationCache.notify(Attachment.class, attachment.getId()); Wo wo = new Wo(); wo.setId(attachment.getId()); result.setData(wo); return result; } }
Example 10
Source File: AnnotatedIntervalCollection.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static TableColumnCollection getColumns(final List<AnnotationKey<?>> annotationKeys) { return new TableColumnCollection( ListUtils.union( AnnotatedIntervalTableColumn.STANDARD_COLUMNS.names(), annotationKeys.stream().map(AnnotationKey::getName).collect(Collectors.toList()))); }
Example 11
Source File: ActionUpdateContent.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, byte[] bytes, FormDataContentDisposition disposition) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo> result = new ActionResult<>(); Attachment attachment = emc.find(id, Attachment.class); if (null == attachment) { throw new ExceptionAttachmentNotExist(id); } if ((!StringUtils.equals(effectivePerson.getDistinguishedName(), attachment.getPerson())) && (!attachment.getEditorList().contains(effectivePerson.getDistinguishedName()))) { throw new ExceptionAttachmentAccessDenied(effectivePerson, attachment); } StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, attachment.getStorage()); if (null == mapping) { throw new ExceptionStorageNotExist(attachment.getStorage()); } attachment.setLastUpdatePerson(effectivePerson.getDistinguishedName()); /** 禁止不带扩展名的文件上传 */ /** 文件名编码转换 */ String fileName = new String(disposition.getFileName().getBytes(DefaultCharset.charset_iso_8859_1), DefaultCharset.charset); fileName = FilenameUtils.getName(fileName); if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) { throw new ExceptionEmptyExtension(fileName); } /** 不允许不同的扩展名上传 */ if (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)), attachment.getExtension())) { throw new ExceptionExtensionNotMatch(fileName, attachment.getExtension()); } emc.beginTransaction(Attachment.class); attachment.updateContent(mapping, bytes); emc.check(attachment, CheckPersistType.all); emc.commit(); /** 通知所有的共享和共享编辑人员 */ List<String> people = new ArrayList<>(); people = ListUtils.union(attachment.getShareList(), attachment.getEditorList()); people.add(attachment.getPerson()); for (String o : ListTools.trim(people, true, true)) { if (!StringUtils.equals(o, effectivePerson.getDistinguishedName())) { this.message_send_attachment_editorModify(attachment, effectivePerson.getDistinguishedName(), o); } } ApplicationCache.notify(Attachment.class, attachment.getId()); Wo wo = new Wo(); wo.setId(attachment.getId()); result.setData(wo); return result; } }
Example 12
Source File: ThreatTriageFunctions.java From metron with Apache License 2.0 | 4 votes |
@Override public Object apply(List<Object> args, Context context) throws ParseException { SensorEnrichmentConfig config = getSensorEnrichmentConfig(args, 0); ThreatIntelConfig tiConfig = (ThreatIntelConfig) getConfig(config, EnrichmentConfigFunctions.Type.THREAT_INTEL); if(tiConfig == null) { tiConfig = new ThreatIntelConfig(); config.setThreatIntel(tiConfig); } org.apache.metron.common.configuration.enrichment.threatintel.ThreatTriageConfig triageConfig = tiConfig.getTriageConfig(); if(triageConfig == null) { triageConfig = new org.apache.metron.common.configuration.enrichment.threatintel.ThreatTriageConfig(); tiConfig.setTriageConfig(triageConfig); } // build the new rules List<RiskLevelRule> newRules = new ArrayList<>(); for(Map<String, Object> newRule : getNewRuleDefinitions(args)) { if(newRule != null && newRule.containsKey("rule") && newRule.containsKey("score")) { // create the rule RiskLevelRule ruleToAdd = new RiskLevelRule(); ruleToAdd.setRule((String) newRule.get(RULE_EXPR_KEY)); ruleToAdd.setScoreExpression(newRule.get(RULE_SCORE_KEY)); // add optional rule fields if (newRule.containsKey(RULE_NAME_KEY)) { ruleToAdd.setName((String) newRule.get(RULE_NAME_KEY)); } if (newRule.containsKey(RULE_COMMENT_KEY)) { ruleToAdd.setComment((String) newRule.get(RULE_COMMENT_KEY)); } if (newRule.containsKey(RULE_REASON_KEY)) { ruleToAdd.setReason((String) newRule.get(RULE_REASON_KEY)); } newRules.add(ruleToAdd); } } // combine the new and existing rules List<RiskLevelRule> allRules = ListUtils.union(triageConfig.getRiskLevelRules(), newRules); triageConfig.setRiskLevelRules(allRules); return toJSON(config); }
Example 13
Source File: ActionUpdateContentCallback.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
ActionResult<Wo<WoObject>> execute(EffectivePerson effectivePerson, String id, String callback, byte[] bytes, FormDataContentDisposition disposition) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo<WoObject>> result = new ActionResult<>(); Attachment attachment = emc.find(id, Attachment.class); if (null == attachment) { throw new ExceptionAttachmentNotExistCallback(callback, id); } if ((!StringUtils.equals(effectivePerson.getDistinguishedName(), attachment.getPerson())) && (!attachment.getEditorList().contains(effectivePerson.getDistinguishedName()))) { throw new ExceptionAttachmentAccessDeniedCallback(effectivePerson, callback, attachment); } StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, attachment.getStorage()); if (null == mapping) { throw new ExceptionStorageNotExistCallback(callback, attachment.getStorage()); } attachment.setLastUpdatePerson(effectivePerson.getDistinguishedName()); /** 禁止不带扩展名的文件上传 */ /** 文件名编码转换 */ String fileName = new String(disposition.getFileName().getBytes(DefaultCharset.charset_iso_8859_1), DefaultCharset.charset); fileName = FilenameUtils.getName(fileName); if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) { throw new ExceptionEmptyExtensionCallback(callback, fileName); } /** 不允许不同的扩展名上传 */ if (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)), attachment.getExtension())) { throw new ExceptionExtensionNotMatchCallback(callback, fileName, attachment.getExtension()); } emc.beginTransaction(Attachment.class); attachment.updateContent(mapping, bytes); emc.check(attachment, CheckPersistType.all); emc.commit(); /** 通知所有的共享和共享编辑人员 */ List<String> people = new ArrayList<>(); people = ListUtils.union(attachment.getShareList(), attachment.getEditorList()); people.add(attachment.getPerson()); for (String o : ListTools.trim(people, true, true)) { if (!StringUtils.equals(o, effectivePerson.getDistinguishedName())) { this.message_send_attachment_editorModify(attachment, effectivePerson.getDistinguishedName(), o); } } ApplicationCache.notify(Attachment.class, attachment.getId()); WoObject woObject = new WoObject(); woObject.setId(attachment.getId()); Wo<WoObject> wo = new Wo<>(callback, woObject); result.setData(wo); return result; } }
Example 14
Source File: ActionUpdateContent.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, byte[] bytes, FormDataContentDisposition disposition) throws Exception { try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { ActionResult<Wo> result = new ActionResult<>(); Attachment attachment = emc.find(id, Attachment.class); if (null == attachment) { throw new ExceptionAttachmentNotExist(id); } if ((!StringUtils.equals(effectivePerson.getDistinguishedName(), attachment.getPerson())) && (!attachment.getEditorList().contains(effectivePerson.getDistinguishedName()))) { throw new ExceptionAttachmentAccessDenied(effectivePerson, attachment); } StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class, attachment.getStorage()); if (null == mapping) { throw new ExceptionStorageNotExist(attachment.getStorage()); } attachment.setLastUpdatePerson(effectivePerson.getDistinguishedName()); /** 禁止不带扩展名的文件上传 */ /** 文件名编码转换 */ String fileName = new String(disposition.getFileName().getBytes(DefaultCharset.charset_iso_8859_1), DefaultCharset.charset); fileName = FilenameUtils.getName(fileName); if (StringUtils.isEmpty(FilenameUtils.getExtension(fileName))) { throw new ExceptionEmptyExtension(fileName); } /** 不允许不同的扩展名上传 */ if (!Objects.equals(StringUtils.lowerCase(FilenameUtils.getExtension(fileName)), attachment.getExtension())) { throw new ExceptionExtensionNotMatch(fileName, attachment.getExtension()); } emc.beginTransaction(Attachment.class); attachment.updateContent(mapping, bytes); emc.check(attachment, CheckPersistType.all); emc.commit(); /** 通知所有的共享和共享编辑人员 */ List<String> people = new ArrayList<>(); people = ListUtils.union(attachment.getShareList(), attachment.getEditorList()); people.add(attachment.getPerson()); for (String o : ListTools.trim(people, true, true)) { if (!StringUtils.equals(o, effectivePerson.getDistinguishedName())) { this.message_send_attachment_editorModify(attachment, effectivePerson.getDistinguishedName(), o); } } ApplicationCache.notify(Attachment.class, attachment.getId()); Wo wo = new Wo(); wo.setId(attachment.getId()); result.setData(wo); return result; } }
Example 15
Source File: CombiningLists.java From tutorials with MIT License | 4 votes |
public static List<Object> usingApacheCommons(List<Object> first, List<Object> second) { List<Object> combined = ListUtils.union(first, second); return combined; }
Example 16
Source File: CreateOrUpdateStepWithExistingAppTest.java From multiapps-controller with Apache License 2.0 | 4 votes |
private List<String> prepareServicesToBind() { if (input.application.shouldKeepServiceBindings) { return ListUtils.union(input.application.services, input.existingApplication.services); } return input.application.services; }
Example 17
Source File: DmgsList.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public List<? extends DmgMessage> getMessages() { return ListUtils.union(ListUtils.union(this.lists, this.inscriptions), ListUtils.union(this.closures, this.extensions)); }
Example 18
Source File: HaplotypeCallerGenotypingEngine.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 4 votes |
private VariantContext addNonRefSymbolicAllele(final VariantContext mergedVC) { final List<Allele> alleleList = ListUtils.union(mergedVC.getAlleles(), Arrays.asList(GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE)); return new VariantContextBuilder(mergedVC).alleles(alleleList).make(); }
Example 19
Source File: ReferenceConfidenceUtils.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static VariantContext addNonRefSymbolicAllele(final VariantContext mergedVC) { final List<Allele> alleleList = ListUtils.union(mergedVC.getAlleles(), Arrays.asList(Allele.NON_REF_ALLELE)); return new VariantContextBuilder(mergedVC).alleles(alleleList).make(); }
Example 20
Source File: AgnTagUtils.java From openemm with GNU Affero General Public License v3.0 | 4 votes |
public static List<String> getParametersForTag(final String tagName) { return ListUtils.union(getMandatoryParametersForTag(tagName), getOptionalParametersForTag(tagName)); }