Project

General

Profile

Revision 624126f1

ID624126f1b00597a3483f1a53ee5949db2ec4af8a
Parent dea59ff1
Child 951f636d

Added by Andreas Müller about 4 years ago

ref #6369 Add interfaces for TaxonNameBase and NonViralName

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java
150 150
@Table(appliesTo="TaxonNameBase", indexes = { @org.hibernate.annotations.Index(name = "taxonNameBaseTitleCacheIndex", columnNames = { "titleCache" }),  @org.hibernate.annotations.Index(name = "taxonNameBaseNameCacheIndex", columnNames = { "nameCache" }) })
151 151
public abstract class TaxonNameBase<T extends TaxonNameBase<?,?>, S extends INameCacheStrategy>
152 152
            extends IdentifiableEntity<S>
153
            implements ITaxonNameBase<T>, IParsable, IRelated, IMatchable, Cloneable {
153
            implements ITaxonNameBase<T>, INonViralName<T>,
154
                IParsable, IRelated, IMatchable, Cloneable {
154 155

  
155 156
    private static final long serialVersionUID = -4530368639601532116L;
156 157
    private static final Logger logger = Logger.getLogger(TaxonNameBase.class);
......
705 706
     * @return  the boolean value of the protectedNameCache flag
706 707
     * @see     #getNameCache()
707 708
     */
709
    @Override
708 710
    public boolean isProtectedNameCache() {
709 711
        return protectedNameCache;
710 712
    }
......
712 714
    /**
713 715
     * @see     #isProtectedNameCache()
714 716
     */
717
    @Override
715 718
    public void setProtectedNameCache(boolean protectedNameCache) {
716 719
        this.protectedNameCache = protectedNameCache;
717 720
    }
......
725 728
     * @return  the string containing the suprageneric name, the genus name or the genus part of <i>this</i> non viral taxon name
726 729
     * @see     #getNameCache()
727 730
     */
731
    @Override
728 732
    public String getGenusOrUninomial() {
729 733
        return genusOrUninomial;
730 734
    }
......
732 736
    /**
733 737
     * @see  #getGenusOrUninomial()
734 738
     */
739
    @Override
735 740
    public void setGenusOrUninomial(String genusOrUninomial) {
736 741
        this.genusOrUninomial = StringUtils.isBlank(genusOrUninomial) ? null : genusOrUninomial;
737 742
    }
......
745 750
     * @return  the string containing the infrageneric part of <i>this</i> non viral taxon name
746 751
     * @see     #getNameCache()
747 752
     */
753
    @Override
748 754
    public String getInfraGenericEpithet(){
749 755
        return this.infraGenericEpithet;
750 756
    }
......
752 758
    /**
753 759
     * @see  #getInfraGenericEpithet()
754 760
     */
761
    @Override
755 762
    public void setInfraGenericEpithet(String infraGenericEpithet){
756 763
        this.infraGenericEpithet = StringUtils.isBlank(infraGenericEpithet)? null : infraGenericEpithet;
757 764
    }
......
764 771
     * @return  the string containing the species epithet of <i>this</i> non viral taxon name
765 772
     * @see     #getNameCache()
766 773
     */
774
    @Override
767 775
    public String getSpecificEpithet(){
768 776
        return this.specificEpithet;
769 777
    }
......
771 779
    /**
772 780
     * @see  #getSpecificEpithet()
773 781
     */
782
    @Override
774 783
    public void setSpecificEpithet(String specificEpithet){
775 784
        this.specificEpithet = StringUtils.isBlank(specificEpithet) ? null : specificEpithet;
776 785
    }
......
784 793
     * @return  the string containing the infraspecific part of <i>this</i> non viral taxon name
785 794
     * @see     #getNameCache()
786 795
     */
796
    @Override
787 797
    public String getInfraSpecificEpithet(){
788 798
        return this.infraSpecificEpithet;
789 799
    }
......
791 801
    /**
792 802
     * @see  #getInfraSpecificEpithet()
793 803
     */
804
    @Override
794 805
    public void setInfraSpecificEpithet(String infraSpecificEpithet){
795 806
        this.infraSpecificEpithet = StringUtils.isBlank(infraSpecificEpithet)?null : infraSpecificEpithet;
796 807
    }
......
803 814
     * @see     eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
804 815
     * @see     eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
805 816
     */
817
    @Override
806 818
    public TeamOrPersonBase<?> getCombinationAuthorship(){
807 819
        return this.combinationAuthorship;
808 820
    }
......
810 822
    /**
811 823
     * @see  #getCombinationAuthorship()
812 824
     */
825
    @Override
813 826
    public void setCombinationAuthorship(TeamOrPersonBase<?> combinationAuthorship){
814 827
        this.combinationAuthorship = combinationAuthorship;
815 828
    }
......
837 850
     * @see     eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
838 851
     * @see     eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
839 852
     */
853
    @Override
840 854
    public TeamOrPersonBase<?> getExCombinationAuthorship(){
841 855
        return this.exCombinationAuthorship;
842 856
    }
......
844 858
    /**
845 859
     * @see  #getExCombinationAuthorship()
846 860
     */
861
    @Override
847 862
    public void setExCombinationAuthorship(TeamOrPersonBase<?> exCombinationAuthorship){
848 863
        this.exCombinationAuthorship = exCombinationAuthorship;
849 864
    }
......
859 874
     * @see     eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
860 875
     * @see     eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
861 876
     */
877
    @Override
862 878
    public TeamOrPersonBase<?> getBasionymAuthorship(){
863 879
        return basionymAuthorship;
864 880
    }
......
866 882
    /**
867 883
     * @see  #getBasionymAuthorship()
868 884
     */
885
    @Override
869 886
    public void setBasionymAuthorship(TeamOrPersonBase<?> basionymAuthorship) {
870 887
        this.basionymAuthorship = basionymAuthorship;
871 888
    }
......
886 903
     * @see     eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
887 904
     * @see     eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
888 905
     */
906
    @Override
889 907
    public TeamOrPersonBase<?> getExBasionymAuthorship(){
890 908
        return exBasionymAuthorship;
891 909
    }
......
893 911
    /**
894 912
     * @see  #getExBasionymAuthorship()
895 913
     */
914
    @Override
896 915
    public void setExBasionymAuthorship(TeamOrPersonBase<?> exBasionymAuthorship) {
897 916
        this.exBasionymAuthorship = exBasionymAuthorship;
898 917
    }
......
905 924
     * @return  the boolean value of the protectedAuthorshipCache flag
906 925
     * @see     #getAuthorshipCache()
907 926
     */
927
    @Override
908 928
    public boolean isProtectedAuthorshipCache() {
909 929
        return protectedAuthorshipCache;
910 930
    }
......
913 933
     * @see     #isProtectedAuthorshipCache()
914 934
     * @see     #getAuthorshipCache()
915 935
     */
936
    @Override
916 937
    public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
917 938
        this.protectedAuthorshipCache = protectedAuthorshipCache;
918 939
    }
......
925 946
     * @see    #getChildRelationships()
926 947
     * @see    HybridRelationshipType
927 948
     */
949
    @Override
928 950
    public Set<HybridRelationship> getHybridParentRelations() {
929 951
        if(hybridParentRelations == null) {
930 952
            this.hybridParentRelations = new HashSet<>();
......
945 967
     * @see    #getParentRelationships()
946 968
     * @see    HybridRelationshipType
947 969
     */
970
    @Override
948 971
    public Set<HybridRelationship> getHybridChildRelations() {
949 972
        if(hybridChildRelations == null) {
950 973
            this.hybridChildRelations = new HashSet<>();
......
980 1003
     * @see     #isBinomHybrid()
981 1004
     * @see     #isTrinomHybrid()
982 1005
     */
1006
    @Override
983 1007
    public boolean isHybridFormula(){
984 1008
        return this.hybridFormula;
985 1009
    }
......
987 1011
    /**
988 1012
     * @see  #isHybridFormula()
989 1013
     */
1014
    @Override
990 1015
    public void setHybridFormula(boolean hybridFormula){
991 1016
        this.hybridFormula = hybridFormula;
992 1017
    }
......
1002 1027
     * @see     #isBinomHybrid()
1003 1028
     * @see     #isTrinomHybrid()
1004 1029
     */
1030
    @Override
1005 1031
    public boolean isMonomHybrid(){
1006 1032
        return this.monomHybrid;
1007 1033
    }
......
1011 1037
     * @see  #isBinomHybrid()
1012 1038
     * @see  #isTrinomHybrid()
1013 1039
     */
1040
    @Override
1014 1041
    public void setMonomHybrid(boolean monomHybrid){
1015 1042
        this.monomHybrid = monomHybrid;
1016 1043
    }
......
1026 1053
     * @see     #isMonomHybrid()
1027 1054
     * @see     #isTrinomHybrid()
1028 1055
     */
1056
    @Override
1029 1057
    public boolean isBinomHybrid(){
1030 1058
        return this.binomHybrid;
1031 1059
    }
......
1035 1063
     * @see  #isMonomHybrid()
1036 1064
     * @see  #isTrinomHybrid()
1037 1065
     */
1066
    @Override
1038 1067
    public void setBinomHybrid(boolean binomHybrid){
1039 1068
        this.binomHybrid = binomHybrid;
1040 1069
    }
......
1051 1080
     * @see     #isMonomHybrid()
1052 1081
     * @see     #isBinomHybrid()
1053 1082
     */
1083
    @Override
1054 1084
    public boolean isTrinomHybrid(){
1055 1085
        return this.trinomHybrid;
1056 1086
    }
......
1060 1090
     * @see  #isBinomHybrid()
1061 1091
     * @see  #isMonomHybrid()
1062 1092
     */
1093
    @Override
1063 1094
    public void setTrinomHybrid(boolean trinomHybrid){
1064 1095
        this.trinomHybrid = trinomHybrid;
1065 1096
    }
......
1105 1136
     * @param  relationship  the hybrid relationship which should be deleted from the corresponding sets
1106 1137
     * @see                  #getHybridRelationships()
1107 1138
     */
1139
    @Override
1108 1140
    public void removeHybridRelationship(HybridRelationship hybridRelation) {
1109 1141
        if (hybridRelation == null) {
1110 1142
            return;
......
1154 1186
    /**
1155 1187
      * Needs to be implemented by those classes that handle autonyms (e.g. botanical names).
1156 1188
      **/
1189
    @Override
1157 1190
    @Transient
1158 1191
    public boolean isAutonym(){
1159 1192
        return false;
......
1222 1255
     * @return  the string with the concatenated and formated authorteams for <i>this</i> non viral taxon name
1223 1256
     * @see     #generateAuthorship()
1224 1257
     */
1258
    @Override
1225 1259
    @Transient
1226 1260
    public String getAuthorshipCache() {
1227 1261
        if (protectedAuthorshipCache){
......
1263 1297
     * @param  authorshipCache  the string which identifies the complete authorship of <i>this</i> non viral taxon name
1264 1298
     * @see    #getAuthorshipCache()
1265 1299
     */
1300
    @Override
1266 1301
    public void setAuthorshipCache(String authorshipCache) {
1267 1302
        setAuthorshipCache(authorshipCache, true);
1268 1303
    }
......
1276 1311
     * the flag is set to <code>false</code>.
1277 1312
     * @see    #getAuthorshipCache()
1278 1313
     */
1314
    @Override
1279 1315
    public void setAuthorshipCache(String authorshipCache, boolean protectedAuthorshipCache) {
1280 1316
        this.authorshipCache = authorshipCache;
1281 1317
        this.setProtectedAuthorshipCache(protectedAuthorshipCache);
......
1290 1326
     * @return  the string with the concatenated and formatted author teams for <i>this</i> taxon name
1291 1327
     * @see     eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(TaxonNameBase)
1292 1328
     */
1329
    @Override
1293 1330
    public String generateAuthorship(){
1294 1331
        if (cacheStrategy == null){
1295 1332
            logger.warn("No CacheStrategy defined for taxon name: " + this.getUuid());
......
1305 1342
     * Tests if the given name has any authors.
1306 1343
     * @return false if no author ((ex)combination or (ex)basionym) exists, true otherwise
1307 1344
     */
1345
    @Override
1308 1346
    public boolean hasAuthors() {
1309 1347
        return (this.getCombinationAuthorship() != null ||
1310 1348
                this.getExCombinationAuthorship() != null ||
......
1316 1354
     * Shortcut. Returns the combination authors title cache. Returns null if no combination author exists.
1317 1355
     * @return
1318 1356
     */
1357
    @Override
1319 1358
    public String computeCombinationAuthorNomenclaturalTitle() {
1320 1359
        return computeNomenclaturalTitle(this.getCombinationAuthorship());
1321 1360
    }
......
1324 1363
     * Shortcut. Returns the basionym authors title cache. Returns null if no basionym author exists.
1325 1364
     * @return
1326 1365
     */
1366
    @Override
1327 1367
    public String computeBasionymAuthorNomenclaturalTitle() {
1328 1368
        return computeNomenclaturalTitle(this.getBasionymAuthorship());
1329 1369
    }
......
1333 1373
     * Shortcut. Returns the ex-combination authors title cache. Returns null if no ex-combination author exists.
1334 1374
     * @return
1335 1375
     */
1376
    @Override
1336 1377
    public String computeExCombinationAuthorNomenclaturalTitle() {
1337 1378
        return computeNomenclaturalTitle(this.getExCombinationAuthorship());
1338 1379
    }
......
1341 1382
     * Shortcut. Returns the ex-basionym authors title cache. Returns null if no exbasionym author exists.
1342 1383
     * @return
1343 1384
     */
1385
    @Override
1344 1386
    public String computeExBasionymAuthorNomenclaturalTitle() {
1345 1387
        return computeNomenclaturalTitle(this.getExBasionymAuthorship());
1346 1388
    }
......
1670 1712
     * @return  the string which identifies <i>this</i> non viral taxon name (without authors or year)
1671 1713
     * @see     #generateNameCache()
1672 1714
     */
1715
    @Override
1673 1716
    @Transient
1674 1717
    public String getNameCache() {
1675 1718
        if (protectedNameCache){
......
1689 1732
     * @param  nameCache  the string which identifies <i>this</i> non viral taxon name (without authors or year)
1690 1733
     * @see    #getNameCache()
1691 1734
     */
1735
    @Override
1692 1736
    public void setNameCache(String nameCache){
1693 1737
        setNameCache(nameCache, true);
1694 1738
    }
......
1702 1746
     * <code>false</code>
1703 1747
     * @see    #getNameCache()
1704 1748
     */
1749
    @Override
1705 1750
    public void setNameCache(String nameCache, boolean protectedNameCache){
1706 1751
        this.nameCache = nameCache;
1707 1752
        this.setProtectedNameCache(protectedNameCache);
......
2470 2515
     * by title cache of the related names.
2471 2516
     * @see #getHybridParentRelations()
2472 2517
     */
2518
    @Override
2473 2519
    @Transient
2474 2520
    public List<HybridRelationship> getOrderedChildRelationships(){
2475 2521
        List<HybridRelationship> result = new ArrayList<HybridRelationship>();
......
2498 2544
     * @see                   #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
2499 2545
     * @see                   #addNameRelationship(NameRelationship)
2500 2546
     */
2547
    @Override
2501 2548
    public HybridRelationship addHybridParent(NonViralName parentName, HybridRelationshipType type, String ruleConsidered){
2502 2549
        return new HybridRelationship(this, parentName, type, ruleConsidered);
2503 2550
    }
......
2519 2566
     * @see                   #addRelationshipFromName(TaxonNameBase, NameRelationshipType, String)
2520 2567
     * @see                   #addNameRelationship(NameRelationship)
2521 2568
     */
2569
    @Override
2522 2570
    public HybridRelationship addHybridChild(NonViralName childName, HybridRelationshipType type, String ruleConsidered){
2523 2571
        return new HybridRelationship(childName, this, type, ruleConsidered);
2524 2572
    }
2525 2573

  
2574
    @Override
2526 2575
    public void removeHybridChild(NonViralName child) {
2527 2576
        Set<HybridRelationship> hybridRelationships = new HashSet<HybridRelationship>();
2528 2577
        hybridRelationships.addAll(this.getHybridChildRelations());
......
2535 2584
        }
2536 2585
    }
2537 2586

  
2587
    @Override
2538 2588
    public void removeHybridParent(NonViralName parent) {
2539 2589
        Set<HybridRelationship> hybridRelationships = new HashSet<HybridRelationship>();
2540 2590
        hybridRelationships.addAll(this.getHybridChildRelations());
......
2991 3041
     * considering the above order.
2992 3042
     * @return the first not blank name part in reverse order
2993 3043
     */
3044
    @Override
2994 3045
    public String getLastNamePart() {
2995 3046
        String result =
2996 3047
                StringUtils.isNotBlank(this.getInfraSpecificEpithet())?

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)