Merge branch 'release/5.45.0'
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / dao / common / IAnnotatableDao.java
1 /**
2 * Copyright (C) 2007 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
10 package eu.etaxonomy.cdm.persistence.dao.common;
11
12 import java.util.List;
13
14 import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
15 import eu.etaxonomy.cdm.model.common.Annotation;
16 import eu.etaxonomy.cdm.model.common.Marker;
17 import eu.etaxonomy.cdm.model.common.MarkerType;
18 import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
19 import eu.etaxonomy.cdm.persistence.query.OrderHint;
20
21 /**
22 * @author n.hoffmann
23 * @since 24.09.2008
24 */
25 public interface IAnnotatableDao<T extends AnnotatableEntity> extends IVersionableDao<T>{
26
27 /**
28 * Returns a List of Annotations belonging to the supplied AnnotatableEntity
29 *
30 * @param annotatableEntity the entity which is annotated
31 * @param status The status of the annotations (null to return annotations regardless of status)
32 * @param pageSize The maximum number of annotations returned (can be null for all annotations)
33 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
34 * @param orderHints may be null
35 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
36 * @return a List of Annotation instances
37 */
38 public List<Annotation> getAnnotations(T annotatableEntity, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
39
40 /**
41 * Returns a count of Annotations belonging to the supplied AnnotatableEntity
42 *
43 * @param annotatableEntity the entity which is annotated
44 * @param status The status of the annotations (null to count all annotations regardless of status)
45 * @return a count of Annotation instances
46 */
47 public long countAnnotations(T annotatableEntity, MarkerType status);
48
49 /**
50 * Returns a count of Markers belonging to the supplied AnnotatableEntity
51 *
52 * @param annotatableEntity the entity which is marked
53 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
54 * @return a count of Marker instances
55 */
56 public long countMarkers(T annotatableEntity, Boolean technical);
57
58 /**
59 *
60 * @param annotatableEntity the entity which is marked
61 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
62 * @param pageSize The maximum number of markers returned (can be null for all markers)
63 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
64 * @param orderHints may be null
65 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
66 * @return a List of Marker instances
67 */
68 public List<Marker> getMarkers(T annotatableEntity, Boolean technical, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
69 /**
70 * Returns a list of arrays representing counts of entities of type clazz, grouped by their markerTypes. The arrays have two elements.
71 * The first element is the MarkerType, initialized using the propertyPaths parameter. The second element is the count of all markers of Objects
72 * of type clazz with that MarkerType. The boolean technical can be used to choose only technical or only non-technical marker types. The list is sorted by
73 * titleCache of the markerType, in ascending order.
74 *
75 * @param clazz optionally restrict the markers to those belonging to this class
76 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
77 * @param pageSize The maximum number of arrays returned (can be null for all arrays)
78 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
79 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
80 * @return
81 */
82 public List<Object[]> groupMarkers(Class<? extends T> clazz, Boolean technical, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
83
84 /**
85 * returns a count of all markers belonging to that clazz, optionally filtered to include only technical or only non-technical markers.
86 *
87 * @param clazz optionally restrict the markers to those belonging to this class
88 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
89 * @return a count of markers
90 */
91 public int countMarkers(Class<? extends T> clazz, Boolean technical);
92
93
94 }