ref #7611 implementing typeDesignation media service and MediaDTO
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / dto / DerivateDTO.java
1 /**
2 * Copyright (C) 2015 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.api.service.dto;
10
11 import java.util.Comparator;
12 import java.util.TreeSet;
13
14 import org.hibernate.envers.tools.Pair;
15
16 /**
17 * @author pplitzner
18 * @since Mar 27, 2015
19 *
20 */
21 public abstract class DerivateDTO {
22
23 private TreeSet<Pair<String, String>> characterData;
24 private DerivateDataDTO derivateDataDTO;
25 // protected String taxonName;
26 protected String citation;
27 protected boolean hasDetailImage;
28 private boolean hasCharacterData;
29 private boolean hasDna;
30 private boolean hasSpecimenScan;
31
32 /**
33 * @return the derivateDataDTO
34 */
35 public DerivateDataDTO getDerivateDataDTO() {
36 return derivateDataDTO;
37 }
38
39 /**
40 * @param derivateDataDTO the derivateDataDTO to set
41 */
42 public void setDerivateDataDTO(DerivateDataDTO derivateDataDTO) {
43 this.derivateDataDTO = derivateDataDTO;
44 }
45
46 /**
47 * @return the characterData
48 */
49 public TreeSet<Pair<String, String>> getCharacterData() {
50 return characterData;
51 }
52
53 public void addCharacterData(String character, String state){
54 if(characterData==null){
55 characterData = new TreeSet<Pair<String,String>>(new Comparator<Pair<String,String>>() {
56
57 @Override
58 public int compare(Pair<String, String> o1, Pair<String, String> o2) {
59 if(o1==null && o2!=null){
60 return -1;
61 }
62 if(o1!=null && o2==null){
63 return 1;
64 }
65 if(o1!=null && o2!=null){
66 return o1.getFirst().compareTo(o2.getFirst());
67 }
68 return 0;
69 }
70 });
71 }
72 characterData.add(new Pair<String, String>(character, state));
73 }
74
75 /**
76 * @return the hasCharacterData
77 */
78 public boolean isHasCharacterData() {
79 return hasCharacterData;
80 }
81
82 /**
83 * @param hasCharacterData the hasCharacterData to set
84 */
85 public void setHasCharacterData(boolean hasCharacterData) {
86 this.hasCharacterData = hasCharacterData;
87 }
88
89 /**
90 * @return the hasDna
91 */
92 public boolean isHasDna() {
93 return hasDna;
94 }
95
96 /**
97 * @param hasDna the hasDna to set
98 */
99 public void setHasDna(boolean hasDna) {
100 this.hasDna = hasDna;
101 }
102
103 /**
104 * @return the hasDetailImage
105 */
106 public boolean isHasDetailImage() {
107 return hasDetailImage;
108 }
109
110 /**
111 * @param hasDetailImage the hasDetailImage to set
112 */
113 public void setHasDetailImage(boolean hasDetailImage) {
114 this.hasDetailImage = hasDetailImage;
115 }
116
117 /**
118 * @return the hasSpecimenScan
119 */
120 public boolean isHasSpecimenScan() {
121 return hasSpecimenScan;
122 }
123
124 /**
125 * @param hasSpecimenScan the hasSpecimenScan to set
126 */
127 public void setHasSpecimenScan(boolean hasSpecimenScan) {
128 this.hasSpecimenScan = hasSpecimenScan;
129 }
130 /**
131 * @return the citation
132 */
133 public String getCitation() {
134 return citation;
135 }
136 /**
137 * @param citation the citation to set
138 */
139 public void setCitation(String citation) {
140 this.citation = citation;
141 }
142
143
144 }