Project

General

Profile

« Previous | Next » 

Revision 1ffd1c27

Added by Andreas Müller over 3 years ago

ref #9322 remove invalid designation relationship from cdmlib

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/Taxon.java
859 859
        return count;
860 860
    }
861 861

  
862
    /**
863
     * Returns the boolean value indicating whether <i>this</i> taxon is a invalid designation
864
     * for at least one other taxon.
865
     */
866
    // TODO cache as for #hasTaxonomicChildren
867
    @Transient
868
    public boolean isInvalidDesignation(){
869
        return computeInvalidDesignationRelations() > 0;
870
    }
871

  
872
    /**
873
     * Counts the number of invalid designation relationships where this taxon represents the
874
     * invalid designation for another taxon.
875
     * @return
876
     */
877
    private int computeInvalidDesignationRelations(){
878
        int count = 0;
879
        for (TaxonRelationship rel: this.getRelationsFromThisTaxon()){
880
            if (rel.getType().isInvalidDesignation()){
881
                count++;
882
            }
883
        }
884
        return count;
885
    }
886

  
887 862
    /**
888 863
     * Returns the boolean value indicating whether <i>this</i> taxon is a related
889 864
     * concept for at least one other taxon.
......
1596 1571
        return result;
1597 1572
    }
1598 1573

  
1599
    /**
1600
     * @see     #getSynonymsGroups()
1601
     */
1602
    @Transient
1603
    public List<Taxon> getInvalidDesignations(){
1604
        List<Taxon> result = new ArrayList<>();
1605
        for (TaxonRelationship rel : this.getRelationsToThisTaxon()){
1606
            if (rel.getType().isInvalidDesignation()){
1607
                result.add(rel.getFromTaxon());
1608
            }
1609
        }
1610
        sortBySimpleTitleCacheComparator(result);
1611
        return result;
1612
    }
1613 1574

  
1614 1575
    /**
1615 1576
     * @see     #getSynonymsGroups()

Also available in: Unified diff