Project

General

Profile

Download (10.7 KB) Statistics
| Branch: | Tag: | Revision:
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.RowWrapperDTO;
12
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
13
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
14
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
15
import eu.etaxonomy.cdm.model.description.DescriptionBase;
16
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
17
import eu.etaxonomy.cdm.model.description.DescriptionType;
18
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
19
import eu.etaxonomy.cdm.model.description.DescriptiveSystemRole;
20
import eu.etaxonomy.cdm.model.description.Feature;
21
import eu.etaxonomy.cdm.model.description.PolytomousKey;
22
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
23
import eu.etaxonomy.cdm.model.description.TaxonDescription;
24
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
25
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
26
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
27
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
28
import eu.etaxonomy.cdm.persistence.dto.TermDto;
29
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
30

    
31

    
32
public interface IDescriptiveDataSetService extends IIdentifiableEntityService<DescriptiveDataSet> {
33
	/**
34
	 * Returns a Map of descriptions each with the description elements that match
35
	 * the supplied features (or all description elements if no features are supplied)
36
	 *
37
	 * @param descriptiveDataSet the data set which the descriptions belong to
38
	 * @param features restrict the returned description elements to those which have features in this set
39
	 * @param pageSize The maximum number of descriptions returned (can be null for all descriptions that belong to the data set)
40
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based,
41
	 *                   can be null, equivalent of starting at the beginning of the recordset). Descriptions are sorted by titleCache
42
	 * @param propertyPaths properties to be initialized (applied to the descriptionElements)
43
	 * @return
44
	 */
45
	public Map<DescriptionBase, Set<DescriptionElementBase>> getDescriptionElements(DescriptiveDataSet descriptiveDataSet, Set<Feature> features, Integer pageSize,	Integer pageNumber,	List<String> propertyPaths);
46

    
47
	public <T extends DescriptionElementBase> Map<UuidAndTitleCache, Map<UUID, Set<T>>> getTaxonFeatureDescriptionElementMap(Class<T> clazz, UUID descriptiveDataSetUuid, DescriptiveSystemRole role);
48

    
49
    /**
50
     * Returns a list of {@link UuidAndTitleCache} elements for all {@link DescriptiveDataSet}s in the data base
51
     * @param limitOfInitialElements
52
     * @param pattern
53
     * @return a list of UuidAndTitleCache element
54
     */
55
    public List<UuidAndTitleCache<DescriptiveDataSet>> getDescriptiveDataSetUuidAndTitleCache(Integer limitOfInitialElements, String pattern);
56

    
57
    /**
58
     * Returns a collection of {@link RowWrapperDTO} objects for the given {@link DescriptiveDataSet}.<br>
59
     * A RowWrapper represents on row in the character matrix.
60
     * @param descriptiveDataSetUuid the working set for which the row wrapper objects should be fetched
61
     * @param the progress monitor
62
     * @return a list of row wrapper objects
63
     */
64
    public List<RowWrapperDTO<?>> getRowWrapper(UUID descriptiveDataSetUuid, IProgressMonitor monitor);
65

    
66
    /**
67
     * Loads all available specimens wrapped in a {@link SpecimenNodeWrapper} object for
68
     * a given {@link DescriptiveDataSet} according to the filters set in the working set
69
     * @param descriptiveDataSet the data set for which the specimens should be fetched
70
     * @return a collection of wrapper objects
71
     */
72
    public Collection<SpecimenNodeWrapper> loadSpecimens(DescriptiveDataSet descriptiveDataSet);
73

    
74
    /**
75
     * Lists all taxon nodes that match the filter set defined in the
76
     * {@link DescriptiveDataSet} given.
77
     * @param the data set which defined the taxon node filter
78
     * @return a list of {@link UUID}s from the filtered nodes
79
     *
80
     */
81
    public List<UUID> findFilteredTaxonNodes(DescriptiveDataSet descriptiveDataSet);
82

    
83
    /**
84
     * Creates a {@link SpecimenRowWrapperDTO} from the given SpecimenNodeWrapper.<br>
85
     * This service method is used when adding new specimen to the character matrix resp.
86
     * to the {@link DescriptiveDataSet}.
87
     * @param wrapper the specimen wrapper to use for creating the row wrapper
88
     * @param datasetUuid the target dataset
89
     * @return the result of the operation
90
     */
91
    public UpdateResult addRowWrapperToDataset(Collection<SpecimenRowWrapperDTO> wrapper, UUID datasetUuid);
92

    
93
    /**
94
     * Creates a specimen row wrapper object for the given description
95
     * @param description the specimen description for which the wrapper should be created
96
     * @param descriptiveDataSetUuid the data set it should be used in
97
     * @return the created row wrapper
98
     */
99
    public SpecimenRowWrapperDTO createSpecimenRowWrapper(SpecimenDescription description, UUID descriptiveDataSetUuid);
100

    
101
    /**
102
     * Creates a specimen row wrapper object for the given description
103
     * @param uuid of the specimen for which the wrapper should be created
104
     * @param descriptiveDataSetUuid the data set it should be used in
105
     * @return the created row wrapper
106
     */
107
    public SpecimenRowWrapperDTO createSpecimenRowWrapper(UUID specimenUuid, UUID taxonNodeUuid, UUID descriptiveDataSetUuid);
108

    
109
    /**
110
     * Returns a {@link TaxonDescription} for a given taxon node with corresponding
111
     * features according to the {@link DescriptiveDataSet} and the having the given {@link DescriptionType}.<br>
112
     * @param descriptiveDataSetUuid the uuid of the dataset defining the features
113
     * @param taxonNodeUuid the uuid of the taxon node that links to the taxon
114
     * @param descriptionType the {@link DescriptionType} that the description should have
115
     * @return the found taxon description or <code>null</code>
116
     */
117
    public TaxonDescription findTaxonDescriptionByDescriptionType(UUID dataSetUuid, UUID taxonNodeUuid, DescriptionType descriptionType);
118

    
119
    /**
120
     * Creates a taxon row wrapper object for the given description
121
     * @param taxonDescription the taxon description for which the wrapper should be created
122
     * @param descriptiveDataSet the data set it should be used in
123
     * @return the created row wrapper
124
     */
125
    public TaxonRowWrapperDTO createTaxonRowWrapper(TaxonDescription taxonDescription, UUID descriptiveDataSetUuid);
126

    
127
    /**
128
     * Returns a {@link SpecimenDescription} for a given specimen with corresponding
129
     * features according to the {@link DescriptiveDataSet}.<br>
130
     * If a description is found that matches all features of the data set this description
131
     * will be returned. A new one will be created otherwise.
132
     * @param descriptiveDataSetUuid the uuid of the dataset defining the features
133
     * @param specimenUuid the uuid of the specimen
134
     * @param addDatasetSource if <code>true</code> the source(s) of the descriptive dataset
135
     * will be added to the description <b>if</b> a new one is created
136
     * @return either the found specimen description or a newly created one
137
     */
138
    public SpecimenDescription findSpecimenDescription(UUID descriptiveDataSetUuid, SpecimenOrObservationBase specimenUuid, boolean addDatasetSource);
139

    
140
    /**
141
     * Returns all states for all supportedCategoricalEnumeration of this categorical feature
142
     * @param featureUuid the feature which has to support categorical data
143
     * @return list of all supported states
144
     */
145
    public Map<UUID,List<TermDto>> getSupportedStatesForFeature(Set<UUID> featureUuids);
146

    
147
    /**
148
     * Creates a new taxon description with the features defined in the dataset for the
149
     * taxon associated with the given taxon node.
150
     * @param descriptiveDataSetUuid the uuid of the dataset defining the features
151
     * @param taxonNodeUuid the uuid of the taxon node that links to the taxon
152
     * @param descriptionType the type of the description
153
     * @return a taxon row wrapper of the description with the features defined in the data set
154
     */
155
    public TaxonRowWrapperDTO createTaxonDescription(UUID dataSetUuid, UUID taxonNodeUuid, DescriptionType descriptionType);
156

    
157
    /**
158
     * Loads all taxon nodes that match the filter set defined in the
159
     * {@link DescriptiveDataSet} given.
160
     * @param the data set which defined the taxon node filter
161
     * @return a list of {@link TaxonNode}s from the filtered nodes
162
     *
163
     */
164
    public List<TaxonNode> loadFilteredTaxonNodes(DescriptiveDataSet descriptiveDataSet, List<String> propertyPaths);
165

    
166
    /**
167
     * Generates a {@link PolytomousKey} for the given {@link DescriptiveDataSet} and sets
168
     * the given taxon as the taxonomic scope
169
     * @param datasetUuid the data set
170
     * @param taxonUuid the taxonomic scope of the key
171
     * @return the uuid of the monitor
172
     */
173
    UpdateResult generatePolytomousKey(UUID descriptiveDataSetUuid, UUID taxonUuid);
174

    
175
    /**
176
     * Returns the first {@link TaxonDescription} with {@link DescriptionType#DEFAULT_VALUES_FOR_AGGREGATION}
177
     * found in the taxon node hierarchy of the associated taxon
178
     * @param specimenDescriptionUuid the specimen description
179
     * @param dataSetUuid the data set
180
     * @return the first found default description or <code>null</code>
181
     */
182
    public TaxonDescription findDefaultDescription(UUID specimenDescriptionUuid, UUID dataSetUuid);
183

    
184
    public Collection<SpecimenNodeWrapper> loadSpecimens(UUID descriptiveDataSetUuid);
185

    
186
    /**
187
     * @param datasetUuid
188
     * @param monitor
189
     * @return
190
     */
191
    DeleteResult delete(UUID datasetUuid, DeleteDescriptiveDataSetConfigurator config, IProgressMonitor monitor);
192

    
193
    /**
194
     * Removes the descriptions specified by the given {@link UUID} from the given {@link DescriptiveDataSet}.
195
     * @param descriptionUuid
196
     * @param descriptiveDataSetUuid
197
     * @return
198
     */
199
    DeleteResult removeDescriptions(List<UUID> descriptionUuids, UUID descriptiveDataSetUuid, RemoveDescriptionsFromDescriptiveDataSetConfigurator config);
200

    
201
    /**
202
     * Removes the description specified by the given {@link UUID} from the given {@link DescriptiveDataSet}.
203
     * @param descriptionUuid
204
     * @param descriptiveDataSetUuid
205
     * @param config
206
     * @return
207
     */
208
    DeleteResult removeDescription(UUID descriptionUuid, UUID descriptiveDataSetUuid,
209
            RemoveDescriptionsFromDescriptiveDataSetConfigurator config);
210

    
211
    /**
212
     * @param uuid
213
     * @return
214
     */
215
    DescriptiveDataSetBaseDto getDescriptiveDataSetDtoByUuid(UUID uuid);
216

    
217
}
(29-29/97)