fixing MediaAutoInitializer & fixing bug in AbstractBeanInitializer
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IDescriptionService.java
index aee1ee08e25a767cbd399b39c7d03eb139937d5c..7ff9ad9aa67445de0aa9e168f0ad5983002c2b6d 100644 (file)
@@ -34,7 +34,7 @@ import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;
+import eu.etaxonomy.cdm.persistence.dao.IBeanInitializer;
 import eu.etaxonomy.cdm.persistence.query.OrderHint;
 
 public interface IDescriptionService extends IIdentifiableEntityService<DescriptionBase> {
@@ -65,7 +65,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * <code>propertyPaths</code> parameter.
         * <p>
         * For detailed description and examples <b>please refer to:</b> 
-        * {@link BeanInitializer#initialize(Object, List)}
+        * {@link IBeanInitializer#initialize(Object, List)}
         * 
         * @param uuid the uuid of the DescriptionElement of interest
         * @return a DescriptionElement, or null if the DescriptionElement does not exist
@@ -104,7 +104,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
         * @param orderHints may be null
-        * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager containing DescriptionBase instances
         */
        public Pager<DescriptionBase> page(Class<? extends DescriptionBase> type, Boolean hasMedia, Boolean hasText, Set<Feature> feature, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
@@ -129,7 +129,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param class 
         * @param pageSize The maximum number of description elements returned (can be null for all description elements)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager containing DescriptionElementBase instances
         * 
         * FIXME candidate for harmonization - rename to pageDescriptionElements
@@ -145,7 +145,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param class 
         * @param pageSize The maximum number of description elements returned (can be null for all description elements)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
         * @return a List containing DescriptionElementBase instances
         */
        public List<DescriptionElementBase> listDescriptionElements(DescriptionBase description,Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
@@ -157,7 +157,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param pageSize The maximum number of terms returned (can be null for all annotations)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
         * @param orderHints may be null
-        * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager of Annotation entities
         */
        public Pager<Annotation> getDescriptionElementAnnotations(DescriptionElementBase annotatedObj, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
@@ -171,13 +171,29 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param geographicalScope Restrict the results to those descriptions which have a geographical scope that overlaps with the NamedArea instances passed (can be null or empty)
         * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager containing TaxonDescription instances
         * 
         * FIXME candidate for harmonization - rename to pageTaxonDescriptions
+        * 
+        * @see #pageMarkedTaxonDescriptions(Taxon, Set, Set, Set, Integer, Integer, List)
         */
        public Pager<TaxonDescription> getTaxonDescriptions(Taxon taxon, Set<Scope> scopes, Set<NamedArea> geographicalScope, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
-       
+
+       /**
+        * Returns a List of TaxonDescription instances, optionally filtered by parameters passed to this method
+        * 
+        * @param taxon The taxon which the description refers to (can be null for all TaxonDescription instances)
+        * @param scopes Restrict the results to those descriptions which are scoped by one of the Scope instances passed (can be null or empty)
+        * @param geographicalScope Restrict the results to those descriptions which have a geographical scope that overlaps with the NamedArea instances passed (can be null or empty)
+        * @param markerType Restrict the results to those descriptions which are marked as true by one of the given marker types (can be null or empty)
+        * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
+        * @return a Pager containing TaxonDescription instances
+        */
+       public Pager<TaxonDescription> pageTaxonDescriptions(Taxon taxon, Set<Scope> scopes, Set<NamedArea> geographicalScope, Set<MarkerType> markerTypes, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
        /**
         * @see {@link #getTaxonDescriptions(Taxon, Set, Set, Integer, Integer, List)}
         * 
@@ -191,18 +207,57 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         */
        public List<TaxonDescription> listTaxonDescriptions(Taxon taxon, Set<Scope> scopes, Set<NamedArea> geographicalScope, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
        
+       
+
+       /**
+        * @see {@link #pageMarkedTaxonDescriptions(Taxon, Set, Set, Set, Integer, Integer, List)}
+        * 
+        * @param taxon
+        * @param scopes
+        * @param geographicalScope
+        * @param pageSize
+        * @param pageNumber
+        * @param propertyPaths
+        * @return
+        */
+       public List<TaxonDescription> listTaxonDescriptions(Taxon taxon, Set<Scope> scopes, Set<NamedArea> geographicalScope, Set<MarkerType> markerTypes, Integer pageSize, Integer pageNumber, List<String> propertyPaths); 
+
+       /**
+        * Returns all {@link Media} attached to a taxon via TaxonDescription.elements.media.
+        * @param taxonUuid the taxons uuid, if null media for all taxa are returned
+        * @param limitToGalleries if true only media in TaxonDescriptions with imageGallery flag=true are returned
+        * @param markerTypes only media for TaxonDescriptions with marker of type markerType and marker.flag=true are returned, one matching marker type is sufficient
+        * @param pageSize
+        * @param pageNumber
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
+        * @return
+        */
+       public List<Media> listTaxonDescriptionMedia(UUID taxonUuid, boolean limitToGalleries, Set<MarkerType> markerTypes, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
+       /**
+        * Returns count for all {@link Media} attached to a taxon via TaxonDescription.elements.media.
+        * @param taxonUuid the taxons uuid, if null media for all taxa are returned
+        * @param limitToGalleries if true only media in TaxonDescriptions with imageGallery flag=true are returned
+        * @param markerTypes only media for TaxonDescriptions with marker of type markerType and marker.flag=true are returned, one matching marker type is sufficient
+        * @return
+        */
+       public int countTaxonDescriptionMedia(UUID taxonUuid, boolean limitToGalleries, Set<MarkerType> markerTypes);
+       
+
+       
        /**
         * Returns a List of TaxonNameDescription instances, optionally filtered by the name which they refer to
         * 
         * @param name Restrict the results to those descriptions that refer to a specific name (can be null for all TaxonNameDescription instances)
         * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager containing TaxonNameBase instances
         * 
         * FIXME candidate for harmonization - rename to pageTaxonNameDescriptions
         */
        public Pager<TaxonNameDescription> getTaxonNameDescriptions(TaxonNameBase name, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+                 
        
        /**
         * Returns a List of distinct TaxonDescription instances which have Distribution elements that refer to one of the NamedArea instances passed (optionally
@@ -213,7 +268,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param pageSize The maximum number of descriptions returned (can be null for all descriptions)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
         * @return a Pager containing TaxonDescription instances
         */
        public Pager<TaxonDescription> searchDescriptionByDistribution(Set<NamedArea> namedAreas, PresenceAbsenceTermBase presence, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
@@ -241,7 +296,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param descriptionElement the description element associated with these media
         * @param pageSize The maximum number of media returned (can be null for all related media)
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
-        * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
+        * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
      * @return a Pager containing media instances
      * 
      * FIXME candidate for harmonization - rename to pageMedia
@@ -284,4 +339,5 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         *      old description
         */
        public void moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements, DescriptionBase targetDescription, boolean isPaste);
+       
 }
\ No newline at end of file