ResultHolder resultHolder = createResultHolder();
for (AggregationMode mode : getConfig().getAggregationModes()){
if (mode == AggregationMode.ToParent){
- Set<TaxonDescription> excludedDescriptions = new HashSet<>();
-// excludedDescriptions.add(targetDescription); //not possible because aggregating from children
- aggregateToParentTaxon(taxonNode, resultHolder, excludedDescriptions);
+ aggregateToParentTaxon(taxonNode, resultHolder, new HashSet<>()); ////excludedDescriptions because aggregating from children
} else if (mode == AggregationMode.WithinTaxon){
Set<TaxonDescription> excludedDescriptions = new HashSet<>();
excludedDescriptions.add(targetDescription);
// TODO consider using the TermHierarchyLookup (only in local branch a.kohlbecker)
Set<NamedArea> subAreas = getSubAreasFor(superArea);
for(NamedArea subArea : subAreas){
- if(logger.isTraceEnabled()){
- logger.trace("accumulateByArea() - \t\t" + termToString(subArea));
- }
+ if(logger.isTraceEnabled()){logger.trace("accumulateByArea() - \t\t" + termToString(subArea));}
// step through all distributions for the given subArea
for(Distribution distribution : distributions){
//TODO AM is the status handling here correct? The mapping to CDM handled
if(subArea.equals(distribution.getArea()) && distribution.getStatus() != null) {
PresenceAbsenceTerm status = distribution.getStatus();
- if(logger.isTraceEnabled()){
- logger.trace("accumulateByArea() - \t\t" + termToString(subArea) + ": " + termToString(status));
- }
+ if(logger.isTraceEnabled()){logger.trace("accumulateByArea() - \t\t" + termToString(subArea) + ": " + termToString(status));}
// skip all having a status value in the ignore list
if (status == null || getByAreaIgnoreStatusList().contains(status)
|| (getConfig().isIgnoreAbsentStatusByArea() && status.isAbsenceTerm())){
public void addSources(Set<DescriptionElementSource> sources) {
addSourcesDeduplicated(this.sources, sources);
}
+
+ @Override
+ public String toString() {
+ return "StatusAndSources [status=" + status + ", sources=" + sources.size() + "]";
+ }
}
@Override
private Set<TaxonDescription> descriptionsFor(Taxon taxon, Set<TaxonDescription> excludedDescriptions) {
Set<TaxonDescription> result = new HashSet<>();
for(TaxonDescription description: taxon.getDescriptions()) {
-// readOnlyIfInSession(description); //not needed for tests anymore
- if (!excludedDescriptions.contains(description)){
+// readOnlyIfInSession(description); //not needed for tests anymore
+ if (excludedDescriptions == null || !excludedDescriptions.contains(description)){
result.add(description);
}
}
@DataSet(value="/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml"),
@DataSet(value="DistributionAggregationTest.xml"),
})
- public void testArea_rank_and_area_1() throws JvmLimitsException {
+ public void testArea_rank_and_area_1() {
//Lapsana communis alpina
List<Distribution> distributions_LCA = new ArrayList<>();
UUID lapsanaDescriptionUuid = lapsanaAggregatedDescription.getUuid();
UUID yugDistributionUuid = null;
UUID yug_mn_DistributionUuid = null;
+
for (DescriptionElementBase element : lapsanaAggregatedDescription.getElements()){
Distribution lapsanaDistribution = (Distribution)element;
if(lapsanaDistribution.getArea().equals(yug)){
/**
* Creates a new description for the taxon identified by the UUIDs
- * @return
*/
private TaxonDescription addDistributions(UUID taxonUuid, Collection<Distribution> distributions) {
Taxon taxon = (Taxon) taxonService.load(taxonUuid);