Add find- and countByTitle() methods to primer and amplification service
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IAnnotatableService.java
index f7218d3f0657d84b68be6a410d20683db3cf703a..e411a17bcf9f0e06bb6a00589260e005d1c1f9c1 100644 (file)
@@ -14,8 +14,9 @@ import java.util.List;
 import eu.etaxonomy.cdm.api.service.pager.Pager;\r
 import eu.etaxonomy.cdm.model.common.AnnotatableEntity;\r
 import eu.etaxonomy.cdm.model.common.Annotation;\r
+import eu.etaxonomy.cdm.model.common.Marker;\r
 import eu.etaxonomy.cdm.model.common.MarkerType;\r
-import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
+import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
 \r
 public interface IAnnotatableService<T extends AnnotatableEntity> extends IVersionableService<T> {\r
@@ -29,8 +30,46 @@ public interface IAnnotatableService<T extends AnnotatableEntity> extends IVersi
         * @param pageSize The maximum number of terms returned (can be null for all annotations)\r
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
         * @param orderHints may be null\r
-        * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}\r
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}\r
         * @return a Pager of Annotation entities\r
         */\r
        public Pager<Annotation> getAnnotations(T annotatedObj, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Returns a Pager containing Marker entities belonging to the object supplied, optionally filtered by\r
+        * whether they are technical or non-technical markers\r
+        * \r
+        * @param annotatableEntity the entity which is marked\r
+        * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)\r
+        * @param pageSize The maximum number of markers returned (can be null for all markers)\r
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
+        * @param orderHints may be null\r
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}\r
+        * @return a List of Marker instances\r
+        */\r
+       public Pager<Marker> getMarkers(T annotatableEntity, Boolean technical, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Returns a list of arrays representing counts of entities of type clazz, grouped by their markerTypes. The arrays have two elements. \r
+        * The first element is the MarkerType, initialized using the propertyPaths parameter. The second element is the count of all markers of Objects\r
+        * 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\r
+        * titleCache of the markerType, in ascending order.\r
+        * \r
+        * @param clazz optionally restrict the markers to those belonging to this class\r
+        * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)\r
+        * @param pageSize The maximum number of arrays returned (can be null for all arrays)\r
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}\r
+        * @return\r
+        */\r
+       public List<Object[]> groupMarkers(Class<? extends T> clazz, Boolean technical, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * returns a count of all markers belonging to that clazz, optionally filtered to include only technical or only non-technical markers.\r
+        * \r
+        * @param clazz optionally restrict the markers to those belonging to this class\r
+        * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)\r
+        * @return a count of markers\r
+        */\r
+       public int countMarkers(Class<? extends T> clazz, Boolean technical);\r
 } \r