ref #10322 add wfoIdentifier to webservice
[cdmlib.git] / cdmlib-api / src / main / java / eu / etaxonomy / cdm / api / dto / portal / config / TaxonPageDtoConfiguration.java
1 /**
2 * Copyright (C) 2023 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.dto.portal.config;
10
11 import java.io.Serializable;
12 import java.util.ArrayList;
13 import java.util.Arrays;
14 import java.util.EnumSet;
15 import java.util.HashMap;
16 import java.util.HashSet;
17 import java.util.List;
18 import java.util.Locale;
19 import java.util.Map;
20 import java.util.Set;
21 import java.util.UUID;
22
23 import eu.etaxonomy.cdm.api.filter.TaxonOccurrenceRelationType;
24 import eu.etaxonomy.cdm.model.common.AnnotationType;
25 import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
26 import eu.etaxonomy.cdm.model.term.IdentifierType;
27
28 /**
29 * @author a.mueller
30 * @date 07.01.2023
31 */
32 public class TaxonPageDtoConfiguration implements ISourceableLoaderConfiguration, Serializable {
33
34 private static final long serialVersionUID = -3017154740995350103L;
35
36 //TODO should this be part of the configuration??
37 private UUID taxonUuid;
38
39 private boolean useDtoLoading = false;
40
41 //data
42 private boolean withFacts = true;
43 private boolean withSynonyms = true;
44 private boolean withSpecimens = true;
45 private boolean withKeys = true;
46 private boolean withMedia = true;
47 private boolean withTaxonNodes = true;
48
49 private boolean includeUnpublished = false;
50
51 private EnumSet<TaxonOccurrenceRelationType> specimenAssociationFilter;
52
53 private Set<UUID> annotationTypes = new HashSet<>(
54 Arrays.asList(new UUID[] {AnnotationType.uuidEditorial}));
55 private Set<UUID> markerTypes = new HashSet<>();
56 private Set<UUID> identifierTypes = new HashSet<>(Arrays.asList(new UUID[] {IdentifierType.uuidWfoNameIdentifier}));
57
58 private Set<UUID> directNameRelTyes = null;
59 private Set<UUID> inverseNameRelTyes = null;
60
61
62 //synonymy
63 //TODO taxonrelations
64 //should withSynonyms includeProparte and misapplications
65 // => yes as long as there are no specific parameters in dataportals to handle them differently
66 private boolean withTaxonRelationships = true;
67 private UUID taxonRelationshipTypeTree = null;
68
69 //facts
70 private UUID featureTree = null;
71 private DistributionInfoConfiguration distributionInfoConfiguration = new DistributionInfoConfiguration();
72
73 private Map<UUID,DistributionInfoConfiguration> perFeatureDistributionInfoConfiguration = new HashMap<>();
74
75 //supplemental data
76 private EnumSet<OriginalSourceType> sourceTypes = OriginalSourceType.allPublicTypes();
77
78 //formatting
79 private List<Locale> locales = new ArrayList<>(); //is this data or formatting??
80
81 private Integer etAlPosition;
82
83
84 // ******************************* GETTER / SETTER ***********************************/
85
86 public DistributionInfoConfiguration getDistributionInfoConfiguration() {
87 return distributionInfoConfiguration;
88 }
89 public void setDistributionInfoConfiguration(DistributionInfoConfiguration distributionInfoConfiguration) {
90 this.distributionInfoConfiguration = distributionInfoConfiguration;
91 }
92
93 public DistributionInfoConfiguration putDistributionInfoConfiguration(UUID featureUuid, DistributionInfoConfiguration config) {
94 return perFeatureDistributionInfoConfiguration.put(featureUuid, config);
95 }
96 public DistributionInfoConfiguration getDistributionInfoConfiguration(UUID featureUuid) {
97 DistributionInfoConfiguration result = perFeatureDistributionInfoConfiguration.get(featureUuid);
98 if (result == null) {
99 result = distributionInfoConfiguration;
100 }
101 return result;
102 }
103
104 public UUID getTaxonUuid() {
105 return taxonUuid;
106 }
107 public void setTaxonUuid(UUID taxonUuid) {
108 this.taxonUuid = taxonUuid;
109 }
110
111 public boolean isWithFacts() {
112 return withFacts;
113 }
114 public void setWithFacts(boolean withFacts) {
115 this.withFacts = withFacts;
116 }
117
118 public boolean isWithSynonyms() {
119 return withSynonyms;
120 }
121 public void setWithSynonyms(boolean withSynonyms) {
122 this.withSynonyms = withSynonyms;
123 }
124
125 public boolean isWithSpecimens() {
126 return withSpecimens;
127 }
128 public void setWithSpecimens(boolean withSpecimens) {
129 this.withSpecimens = withSpecimens;
130 }
131
132 public boolean isWithKeys() {
133 return withKeys;
134 }
135 public void setWithKeys(boolean withKeys) {
136 this.withKeys = withKeys;
137 }
138
139 public boolean isWithMedia() {
140 return withMedia;
141 }
142 public void setWithMedia(boolean withMedia) {
143 this.withMedia = withMedia;
144 }
145
146 public boolean isWithTaxonNodes() {
147 return withTaxonNodes;
148 }
149 public void setWithTaxonNodes(boolean withTaxonNodes) {
150 this.withTaxonNodes = withTaxonNodes;
151 }
152 public boolean isWithTaxonRelationships() {
153 return withTaxonRelationships;
154 }
155 public void setWithTaxonRelationships(boolean withTaxonRelationships) {
156 this.withTaxonRelationships = withTaxonRelationships;
157 }
158 public UUID getTaxonRelationshipTypeTree() {
159 return taxonRelationshipTypeTree;
160 }
161 public void setTaxonRelationshipTypeTree(UUID taxonRelationshipTypeTree) {
162 this.taxonRelationshipTypeTree = taxonRelationshipTypeTree;
163 }
164
165 public UUID getFeatureTree() {
166 return featureTree;
167 }
168 public void setFeatureTree(UUID featureTree) {
169 this.featureTree = featureTree;
170 }
171
172 public List<Locale> getLocales() {
173 return locales;
174 }
175 public void setLocales(List<Locale> locales) {
176 this.locales = locales;
177 }
178
179 public Integer getEtAlPosition() {
180 return etAlPosition;
181 }
182 public void setEtAlPosition(Integer etAlPosition) {
183 this.etAlPosition = etAlPosition;
184 }
185
186 public boolean isIncludeUnpublished() {
187 return includeUnpublished;
188 }
189 public void setIncludeUnpublished(boolean includeUnpublished) {
190 this.includeUnpublished = includeUnpublished;
191 }
192
193 public EnumSet<TaxonOccurrenceRelationType> getSpecimenAssociationFilter() {
194 return specimenAssociationFilter;
195 }
196 public void setSpecimenAssociationFilter(EnumSet<TaxonOccurrenceRelationType> specimenAssociationFilter) {
197 this.specimenAssociationFilter = specimenAssociationFilter;
198 }
199
200 @Override
201 public EnumSet<OriginalSourceType> getSourceTypes() {
202 return sourceTypes;
203 }
204 public void setSourceTypes(EnumSet<OriginalSourceType> sourceTypes) {
205 this.sourceTypes = sourceTypes;
206 this.distributionInfoConfiguration.setSourceTypes(sourceTypes);
207 }
208
209 @Override
210 public Set<UUID> getMarkerTypes() {
211 return markerTypes;
212 }
213 /**
214 * Note: this method also sets the marker type filter
215 * for the included distributionInfoConfiguration. If the latter
216 * needs a separate filter this has to be set afterwards.
217 */
218 public void setMarkerTypes(Set<UUID> markerTypes) {
219 this.markerTypes = markerTypes;
220 this.distributionInfoConfiguration.setMarkerTypes(markerTypes);
221 }
222
223 @Override
224 public Set<UUID> getAnnotationTypes() {
225 return annotationTypes;
226 }
227 /**
228 * Note: this method also sets the annotation type filter
229 * for the included distributionInfoConfiguration. If the latter
230 * needs a separate filter this has to be set afterwards.
231 */
232 public void setAnnotationTypes(Set<UUID> annotationTypes) {
233 this.annotationTypes = annotationTypes;
234 this.distributionInfoConfiguration.setAnnotationTypes(annotationTypes);
235 }
236 public void addAnnotationType(UUID annotationType) {
237 if (this.annotationTypes == null) {
238 this.annotationTypes = new HashSet<>();
239 }
240 this.annotationTypes.add(annotationType);
241 this.distributionInfoConfiguration.addAnnotationType(annotationType);
242 }
243
244 @Override
245 public Set<UUID> getIdentifierTypes() {
246 return identifierTypes;
247 }
248
249 //name relationship types
250 public Set<UUID> getDirectNameRelTyes() {
251 return directNameRelTyes;
252 }
253 public void setDirectNameRelTyes(Set<UUID> directNameRelTyes) {
254 this.directNameRelTyes = directNameRelTyes;
255 }
256
257 public Set<UUID> getInverseNameRelTyes() {
258 return inverseNameRelTyes;
259 }
260 public void setInverseNameRelTyes(Set<UUID> inverseNameRelTyes) {
261 this.inverseNameRelTyes = inverseNameRelTyes;
262 }
263
264 public boolean isUseDtoLoading() {
265 return useDtoLoading;
266 }
267 public void setUseDtoLoading(boolean useDtoLoading) {
268 this.useDtoLoading = useDtoLoading;
269 }
270 }