1
|
package eu.etaxonomy.cdm.api.service;
|
2
|
|
3
|
import java.util.Collection;
|
4
|
import java.util.List;
|
5
|
import java.util.Map;
|
6
|
import java.util.Set;
|
7
|
import java.util.UUID;
|
8
|
|
9
|
import eu.etaxonomy.cdm.api.service.config.DeleteDescriptiveDataSetConfigurator;
|
10
|
import eu.etaxonomy.cdm.api.service.config.RemoveDescriptionsFromDescriptiveDataSetConfigurator;
|
11
|
import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
|
12
|
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
|
13
|
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
|
14
|
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
|
15
|
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
|
16
|
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
17
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
18
|
import eu.etaxonomy.cdm.model.description.DescriptionType;
|
19
|
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
|
20
|
import eu.etaxonomy.cdm.model.description.DescriptiveSystemRole;
|
21
|
import eu.etaxonomy.cdm.model.description.Feature;
|
22
|
import eu.etaxonomy.cdm.model.description.PolytomousKey;
|
23
|
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
|
24
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
25
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
26
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
27
|
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
|
28
|
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
|
29
|
import eu.etaxonomy.cdm.persistence.dto.TermDto;
|
30
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
31
|
|
32
|
|
33
|
public interface IDescriptiveDataSetService extends IIdentifiableEntityService<DescriptiveDataSet> {
|
34
|
/**
|
35
|
* Returns a Map of descriptions each with the description elements that match
|
36
|
* the supplied features (or all description elements if no features are supplied)
|
37
|
*
|
38
|
* @param descriptiveDataSet the data set which the descriptions belong to
|
39
|
* @param features restrict the returned description elements to those which have features in this set
|
40
|
* @param pageSize The maximum number of descriptions returned (can be null for all descriptions that belong to the data set)
|
41
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based,
|
42
|
* can be null, equivalent of starting at the beginning of the recordset). Descriptions are sorted by titleCache
|
43
|
* @param propertyPaths properties to be initialized (applied to the descriptionElements)
|
44
|
* @return
|
45
|
*/
|
46
|
public Map<DescriptionBase, Set<DescriptionElementBase>> getDescriptionElements(DescriptiveDataSet descriptiveDataSet, Set<Feature> features, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
47
|
|
48
|
public <T extends DescriptionElementBase> Map<UuidAndTitleCache, Map<UUID, Set<T>>> getTaxonFeatureDescriptionElementMap(Class<T> clazz, UUID descriptiveDataSetUuid, DescriptiveSystemRole role);
|
49
|
|
50
|
/**
|
51
|
* Returns a list of {@link UuidAndTitleCache} elements for all {@link DescriptiveDataSet}s in the data base
|
52
|
* @param limitOfInitialElements
|
53
|
* @param pattern
|
54
|
* @return a list of UuidAndTitleCache element
|
55
|
*/
|
56
|
public List<UuidAndTitleCache<DescriptiveDataSet>> getDescriptiveDataSetUuidAndTitleCache(Integer limitOfInitialElements, String pattern);
|
57
|
|
58
|
/**
|
59
|
* Returns a collection of {@link RowWrapperDTO} objects for the given {@link DescriptiveDataSet}.<br>
|
60
|
* A RowWrapper represents on row in the character matrix.
|
61
|
* @param descriptiveDataSetUuid the working set for which the row wrapper objects should be fetched
|
62
|
* @param the progress monitor
|
63
|
* @return a list of row wrapper objects
|
64
|
*/
|
65
|
public List<RowWrapperDTO<?>> getRowWrapper(UUID descriptiveDataSetUuid, IProgressMonitor monitor);
|
66
|
|
67
|
/**
|
68
|
* Loads all available specimens wrapped in a {@link SpecimenNodeWrapper} object for
|
69
|
* a given {@link DescriptiveDataSet} according to the filters set in the working set
|
70
|
* @param descriptiveDataSet the data set for which the specimens should be fetched
|
71
|
* @return a collection of wrapper objects
|
72
|
*/
|
73
|
public Collection<SpecimenNodeWrapper> loadSpecimens(DescriptiveDataSet descriptiveDataSet);
|
74
|
|
75
|
/**
|
76
|
* Lists all taxon nodes that match the filter set defined in the
|
77
|
* {@link DescriptiveDataSet} given.
|
78
|
* @param the data set which defined the taxon node filter
|
79
|
* @return a list of {@link UUID}s from the filtered nodes
|
80
|
*
|
81
|
*/
|
82
|
public List<UUID> findFilteredTaxonNodes(DescriptiveDataSet descriptiveDataSet);
|
83
|
|
84
|
/**
|
85
|
* Creates a {@link SpecimenRowWrapperDTO} from the given SpecimenNodeWrapper.<br>
|
86
|
* This service method is used when adding new specimen to the character matrix resp.
|
87
|
* to the {@link DescriptiveDataSet}.
|
88
|
* @param wrapper the specimen wrapper to use for creating the row wrapper
|
89
|
* @param datasetUuid the target dataset
|
90
|
* @return the result of the operation
|
91
|
*/
|
92
|
public UpdateResult addRowWrapperToDataset(Collection<SpecimenRowWrapperDTO> wrapper, UUID datasetUuid, boolean addDatasetSource);
|
93
|
|
94
|
/**
|
95
|
* Creates a specimen row wrapper object for the given description
|
96
|
* @param description the specimen description for which the wrapper should be created
|
97
|
* @param descriptiveDataSetUuid the data set it should be used in
|
98
|
* @return the created row wrapper
|
99
|
*/
|
100
|
public SpecimenRowWrapperDTO createSpecimenRowWrapper(DescriptionBaseDto description, UUID descriptiveDataSetUuid);
|
101
|
|
102
|
/**
|
103
|
* Creates a specimen row wrapper object for the given description
|
104
|
* @param uuid of the specimen for which the wrapper should be created
|
105
|
* @param descriptiveDataSetUuid the data set it should be used in
|
106
|
* @return the created row wrapper
|
107
|
*/
|
108
|
public SpecimenRowWrapperDTO createSpecimenRowWrapper(UUID specimenUuid, UUID taxonNodeUuid, UUID descriptiveDataSetUuid);
|
109
|
|
110
|
/**
|
111
|
* Returns a {@link TaxonDescription} for a given taxon node with corresponding
|
112
|
* features according to the {@link DescriptiveDataSet} and the having the given {@link DescriptionType}.<br>
|
113
|
* @param descriptiveDataSetUuid the uuid of the dataset defining the features
|
114
|
* @param taxonNodeUuid the uuid of the taxon node that links to the taxon
|
115
|
* @param descriptionType the {@link DescriptionType} that the description should have
|
116
|
* @return the found taxon description or <code>null</code>
|
117
|
*/
|
118
|
// public DescriptionBaseDto findTaxonDescriptionByDescriptionType(UUID dataSetUuid, UUID taxonNodeUuid, DescriptionType descriptionType);
|
119
|
|
120
|
/**
|
121
|
* Creates a taxon row wrapper object for the given description
|
122
|
* @param taxonDescription the taxon description for which the wrapper should be created
|
123
|
* @param descriptiveDataSet the data set it should be used in
|
124
|
* @return the created row wrapper
|
125
|
*/
|
126
|
public TaxonRowWrapperDTO createTaxonRowWrapper(DescriptionBaseDto taxonDescription, UUID descriptiveDataSetUuid);
|
127
|
|
128
|
/**
|
129
|
* Creates a taxon row wrapper object for the given description UUID
|
130
|
* @param taxonDescriptionUUID the taxon description for which the wrapper should be created
|
131
|
* @param descriptiveDataSetUUID the data set it should be used in
|
132
|
* @return the created row wrapper
|
133
|
*/
|
134
|
public TaxonRowWrapperDTO createTaxonRowWrapper(UUID taxonDescriptionUuid, UUID descriptiveDataSetUuid);
|
135
|
|
136
|
|
137
|
/**
|
138
|
* Returns a {@link SpecimenDescription} for a given specimen with corresponding
|
139
|
* features according to the {@link DescriptiveDataSet}.<br>
|
140
|
* If a description is found that matches all features of the data set this description
|
141
|
* will be returned. A new one will be created otherwise.
|
142
|
* @param descriptiveDataSetUuid the uuid of the dataset defining the features
|
143
|
* @param specimenUuid the uuid of the specimen
|
144
|
* @param addDatasetSource if <code>true</code> the source(s) of the descriptive dataset
|
145
|
* will be added to the description <b>if</b> a new one is created
|
146
|
* @return either the found specimen description or a newly created one
|
147
|
*/
|
148
|
public DescriptionBaseDto findSpecimenDescription(UUID descriptiveDataSetUuid, SpecimenOrObservationBase specimenUuid);
|
149
|
|
150
|
/**
|
151
|
* Returns all states for all supportedCategoricalEnumeration of this categorical feature
|
152
|
* @param featureUuid the feature which has to support categorical data
|
153
|
* @return list of all supported states
|
154
|
*/
|
155
|
public Map<UUID,List<TermDto>> getSupportedStatesForFeature(Set<UUID> featureUuids);
|
156
|
|
157
|
/**
|
158
|
* Creates a new taxon description with the features defined in the dataset for the
|
159
|
* taxon associated with the given taxon node.
|
160
|
* @param descriptiveDataSetUuid the uuid of the dataset defining the features
|
161
|
* @param taxonNodeUuid the uuid of the taxon node that links to the taxon
|
162
|
* @param descriptionType the type of the description
|
163
|
* @return a taxon row wrapper of the description with the features defined in the data set
|
164
|
*/
|
165
|
public TaxonRowWrapperDTO createTaxonDescription(UUID dataSetUuid, UUID taxonNodeUuid, DescriptionType descriptionType);
|
166
|
|
167
|
/**
|
168
|
* Loads all taxon nodes that match the filter set defined in the
|
169
|
* {@link DescriptiveDataSet} given.
|
170
|
* @param the data set which defined the taxon node filter
|
171
|
* @return a list of {@link TaxonNode}s from the filtered nodes
|
172
|
*
|
173
|
*/
|
174
|
public List<TaxonNode> loadFilteredTaxonNodes(DescriptiveDataSet descriptiveDataSet, List<String> propertyPaths);
|
175
|
|
176
|
/**
|
177
|
* Generates a {@link PolytomousKey} for the given {@link DescriptiveDataSet} and sets
|
178
|
* the given taxon as the taxonomic scope
|
179
|
* @param datasetUuid the data set
|
180
|
* @param taxonUuid the taxonomic scope of the key
|
181
|
* @return the uuid of the monitor
|
182
|
*/
|
183
|
UpdateResult generatePolytomousKey(UUID descriptiveDataSetUuid, UUID taxonUuid);
|
184
|
|
185
|
/**
|
186
|
* Returns the first {@link TaxonDescription} with {@link DescriptionType#DEFAULT_VALUES_FOR_AGGREGATION}
|
187
|
* found in the taxon node hierarchy of the associated taxon
|
188
|
* @param specimenDescriptionUuid the specimen description
|
189
|
* @param dataSetUuid the data set
|
190
|
* @return the first found default description or <code>null</code>
|
191
|
*/
|
192
|
public DescriptionBaseDto findDefaultDescription(UUID specimenDescriptionUuid, UUID dataSetUuid);
|
193
|
|
194
|
public Collection<SpecimenNodeWrapper> loadSpecimens(UUID descriptiveDataSetUuid);
|
195
|
|
196
|
/**
|
197
|
* @param datasetUuid
|
198
|
* @param monitor
|
199
|
* @return
|
200
|
*/
|
201
|
DeleteResult delete(UUID datasetUuid, DeleteDescriptiveDataSetConfigurator config, IProgressMonitor monitor);
|
202
|
|
203
|
/**
|
204
|
* Removes the descriptions specified by the given {@link UUID} from the given {@link DescriptiveDataSet}.
|
205
|
* @param descriptionUuid
|
206
|
* @param descriptiveDataSetUuid
|
207
|
* @return
|
208
|
*/
|
209
|
DeleteResult removeDescriptions(List<UUID> descriptionUuids, UUID descriptiveDataSetUuid, RemoveDescriptionsFromDescriptiveDataSetConfigurator config);
|
210
|
|
211
|
/**
|
212
|
* Removes the description specified by the given {@link UUID} from the given {@link DescriptiveDataSet}.
|
213
|
* @param descriptionUuid
|
214
|
* @param descriptiveDataSetUuid
|
215
|
* @param config
|
216
|
* @return
|
217
|
*/
|
218
|
DeleteResult removeDescription(UUID descriptionUuid, UUID descriptiveDataSetUuid,
|
219
|
RemoveDescriptionsFromDescriptiveDataSetConfigurator config);
|
220
|
|
221
|
/**
|
222
|
* @param uuid
|
223
|
* @return
|
224
|
*/
|
225
|
DescriptiveDataSetBaseDto getDescriptiveDataSetDtoByUuid(UUID uuid);
|
226
|
|
227
|
/**
|
228
|
* @param dataSet
|
229
|
* @param taxonUuid
|
230
|
* @param descriptionType
|
231
|
* @return
|
232
|
*/
|
233
|
public DescriptionBaseDto getTaxonDescriptionForDescriptiveDataSetAndType(DescriptiveDataSetBaseDto dataSet,
|
234
|
UUID taxonUuid, DescriptionType descriptionType);
|
235
|
|
236
|
}
|