Add service method to find a description for a dataset
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IDescriptiveDataSetService.java
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.dto.RowWrapperDTO;
10 import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
11 import eu.etaxonomy.cdm.model.description.DescriptionBase;
12 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
13 import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
14 import eu.etaxonomy.cdm.model.description.DescriptiveSystemRole;
15 import eu.etaxonomy.cdm.model.description.Feature;
16 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
17 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
18 import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
19 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
20
21
22 public interface IDescriptiveDataSetService extends IIdentifiableEntityService<DescriptiveDataSet> {
23 /**
24 * Returns a Map of descriptions each with the description elements that match
25 * the supplied features (or all description elements if no features are supplied)
26 *
27 * @param descriptiveDataSet the data set which the descriptions belong to
28 * @param features restrict the returned description elements to those which have features in this set
29 * @param pageSize The maximum number of descriptions returned (can be null for all descriptions that belong to the data set)
30 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based,
31 * can be null, equivalent of starting at the beginning of the recordset). Descriptions are sorted by titleCache
32 * @param propertyPaths properties to be initialized (applied to the descriptionElements)
33 * @return
34 */
35 public Map<DescriptionBase, Set<DescriptionElementBase>> getDescriptionElements(DescriptiveDataSet descriptiveDataSet, Set<Feature> features, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
36
37 public <T extends DescriptionElementBase> Map<UuidAndTitleCache, Map<UUID, Set<T>>> getTaxonFeatureDescriptionElementMap(Class<T> clazz, UUID descriptiveDataSetUuid, DescriptiveSystemRole role);
38
39 /**
40 * Returns a list of {@link UuidAndTitleCache} elements for all {@link DescriptiveDataSet}s in the data base
41 * @param limitOfInitialElements
42 * @param pattern
43 * @return a list of UuidAndTitleCache element
44 */
45 public List<UuidAndTitleCache<DescriptiveDataSet>> getDescriptiveDataSetUuidAndTitleCache(Integer limitOfInitialElements, String pattern);
46
47 /**
48 * Returns a collection of {@link RowWrapperDTO} objects for the given {@link DescriptiveDataSet}.<br>
49 * A RowWrapper represents on row in the character matrix.
50 * @param descriptiveDataSet the working set for which the row wrapper objects should be fetched
51 * @param the progress monitor
52 * @return a list of row wrapper objects
53 */
54 public Collection<RowWrapperDTO> getRowWrapper(DescriptiveDataSet descriptiveDataSet, IProgressMonitor monitor);
55
56 /**
57 * Monitored invocation of {@link IDescriptiveDataSetService#getRowWrapper(DescriptiveDataSet, IProgressMonitor)}
58 * @param descriptiveDataSet the working set for which getRowWrapper() is invoked
59 * @return the uuid of the monitor
60 */
61 public UUID monitGetRowWrapper(DescriptiveDataSet descriptiveDataSet);
62
63 /**
64 * Loads all avaliable specimens wrapped in a {@link SpecimenNodeWrapper} object for
65 * a given {@link DescriptiveDataSet} according to the filters set in the working set
66 * @param descriptiveDataSet the working set for which the specimens should be fetched
67 * @return a collection of wrapper objects
68 */
69 public Collection<SpecimenNodeWrapper> loadSpecimens(DescriptiveDataSet descriptiveDataSet);
70
71 /**
72 * Creates a row wrapper object for the given specimen
73 * @param specimen the specimen for which the wrapper should be created
74 * @param descriptiveDataSet the data set it should be used in
75 * @return the created row wrapper
76 */
77 public RowWrapperDTO createRowWrapper(SpecimenOrObservationBase specimen, DescriptiveDataSet descriptiveDataSet);
78
79 /**
80 * Creates a row wrapper object for the given description
81 * @param description the description for which the wrapper should be created
82 * @param descriptiveDataSet the data set it should be used in
83 * @return the created row wrapper
84 */
85 public RowWrapperDTO createRowWrapper(DescriptionBase description, DescriptiveDataSet descriptiveDataSet);
86
87 /**
88 * Returns a {@link SpecimenDescription} for a given specimen with corresponding
89 * features according to the {@link DescriptiveDataSet}.
90 * @param descriptiveDataSetUuid
91 * @param specimenUuid
92 * @return
93 */
94 public SpecimenDescription findDescriptionForDescriptiveDataSet(UUID descriptiveDataSetUuid, UUID specimenUuid);
95 }