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> {
* <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
* @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);
* @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
*/
public Pager<DescriptionElementBase> getDescriptionElements(DescriptionBase description,Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
* @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);
* @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);
* @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)}
*
*/
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
* @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);
* @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
*/
public Pager<Media> getMedia(DescriptionElementBase descriptionElement, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
- public List<DescriptionElementBase> getDescriptionElementsForTaxon(Taxon taxon, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+ public <T extends DescriptionElementBase> List<T> getDescriptionElementsForTaxon(Taxon taxon, Set<Feature> features, Class<? extends T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
public DistributionTree getOrderedDistributions(Set<TaxonDescription> taxonDescriptions, Set<NamedAreaLevel> levels, List<String> propertyPaths);
/**
* Preliminary method to test whether a description contains structured data.
- * @deprecated The means of determining this fact may change soon, so this method is annotated a beeing deprecated.
+ * @deprecated The means of determining this fact may change soon, so this method is
+ annotated as being deprecated.
* @param description
* @return
*/
@Deprecated
public boolean hasStructuredData(DescriptionBase<?> description);
+
+ /**
+ * Add the collection of {@link DescriptionElementBase description elements} to the <code>targetDescription</code>.
+ * Remove the description elements from the description they are currently associated with.
+ *
+ * @param descriptionElements
+ * @param targetDescription
+ * @param isPaste if true, the elements are only copied (cloned) and not removed from the
+ * old description
+ */
+ public void moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements, DescriptionBase targetDescription, boolean isPaste);
+
}
\ No newline at end of file