Project

General

Profile

Download (3.08 KB) Statistics
| Branch: | Tag: | Revision:
1 b7fa2296 Andreas Kohlbecker
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.persistence.dto;
10
11 9fc2a8a0 Andreas Kohlbecker
import java.util.UUID;
12
13 b7fa2296 Andreas Kohlbecker
import eu.etaxonomy.cdm.model.name.Rank;
14
15
public class TaxonNameParts {
16
17 9fc2a8a0 Andreas Kohlbecker
    protected Integer taxonNameId;
18 b7fa2296 Andreas Kohlbecker
19 9fc2a8a0 Andreas Kohlbecker
    protected UUID taxonNameUuid;
20 b7fa2296 Andreas Kohlbecker
21 9fc2a8a0 Andreas Kohlbecker
    protected Rank rank;
22 b7fa2296 Andreas Kohlbecker
23 9fc2a8a0 Andreas Kohlbecker
    protected String genusOrUninomial;
24 b7fa2296 Andreas Kohlbecker
25 9fc2a8a0 Andreas Kohlbecker
    protected String infraGenericEpithet;
26 b7fa2296 Andreas Kohlbecker
27 9fc2a8a0 Andreas Kohlbecker
    protected String specificEpithet;
28 b7fa2296 Andreas Kohlbecker
29 9fc2a8a0 Andreas Kohlbecker
    protected String infraSpecificEpithet;
30 b7fa2296 Andreas Kohlbecker
31 97eff560 Andreas Müller
//************ CONSTRUCTOR ***********************/
32
33
    public TaxonNameParts() {
34
    }
35
36
    public TaxonNameParts(Integer taxonNameId, UUID taxonNameUuid, Rank rank, String genusOrUninomial, String infraGenericEpithet,
37
            String specificEpithet, String infraSpecificEpithet) {
38
        super();
39
        this.taxonNameId = taxonNameId;
40
        this.taxonNameUuid = taxonNameUuid;
41
        this.rank = rank;
42
        this.genusOrUninomial = genusOrUninomial;
43
        this.infraGenericEpithet = infraGenericEpithet;
44
        this.specificEpithet = specificEpithet;
45
        this.infraSpecificEpithet = infraSpecificEpithet;
46 9fc2a8a0 Andreas Kohlbecker
    }
47
48 97eff560 Andreas Müller
//***************** GETTER / SETTER ********************************/
49 9fc2a8a0 Andreas Kohlbecker
50 97eff560 Andreas Müller
    public UUID getTaxonNameUuid() {
51
        return taxonNameUuid;
52
    }
53
54
    public Integer getTaxonNameId() {
55
        return taxonNameId;
56
    }
57 9fc2a8a0 Andreas Kohlbecker
    public void setTaxonNameId(Integer taxonNameId) {
58
        this.taxonNameId = taxonNameId;
59
    }
60
61
    public Rank getRank() {
62
        return rank;
63
    }
64
    public void setRank(Rank rank) {
65
        this.rank = rank;
66
    }
67
68
    public String getGenusOrUninomial() {
69
        return genusOrUninomial;
70
    }
71
    public void setGenusOrUninomial(String genusOrUninomial) {
72
        this.genusOrUninomial = genusOrUninomial;
73
    }
74
75
    public String getInfraGenericEpithet() {
76
        return infraGenericEpithet;
77
    }
78
    public void setInfraGenericEpithet(String infraGenericEpithet) {
79
        this.infraGenericEpithet = infraGenericEpithet;
80
    }
81
82
    public String getSpecificEpithet() {
83
        return specificEpithet;
84
    }
85
    public void setSpecificEpithet(String specificEpithet) {
86
        this.specificEpithet = specificEpithet;
87
    }
88
89
    public String getInfraSpecificEpithet() {
90
        return infraSpecificEpithet;
91
    }
92
    public void setInfraSpecificEpithet(String infraSpecificEpithet) {
93
        this.infraSpecificEpithet = infraSpecificEpithet;
94
    }
95 b7fa2296 Andreas Kohlbecker
96 97eff560 Andreas Müller
// ******************* METHODS *************************************/
97 b7fa2296 Andreas Kohlbecker
98 9fc2a8a0 Andreas Kohlbecker
    public String rankSpecificNamePart() {
99 6d804466 Andreas Kohlbecker
        if(rank.isGenus() || rank.isSupraGeneric()){
100 9fc2a8a0 Andreas Kohlbecker
            return getGenusOrUninomial();
101 b7fa2296 Andreas Kohlbecker
        }
102
        if(rank.isInfraGeneric()){
103 9fc2a8a0 Andreas Kohlbecker
            return getInfraGenericEpithet();
104 b7fa2296 Andreas Kohlbecker
        }
105 9fc2a8a0 Andreas Kohlbecker
        if(rank.isSpecies()){
106
            return getSpecificEpithet();
107 b7fa2296 Andreas Kohlbecker
        }
108
        if(rank.isInfraSpecific()){
109 9fc2a8a0 Andreas Kohlbecker
            return getInfraSpecificEpithet();
110 b7fa2296 Andreas Kohlbecker
        }
111 9fc2a8a0 Andreas Kohlbecker
        return "-- ERROR: INVALID OR UNSUPPORTED RANK (" + rank.getLabel() + ") --";
112 b7fa2296 Andreas Kohlbecker
    }
113
}