import java.util.UUID;
import eu.etaxonomy.cdm.api.service.pager.Pager;
+import eu.etaxonomy.cdm.api.utility.DescriptionUtility;
import eu.etaxonomy.cdm.model.common.Annotation;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
import eu.etaxonomy.cdm.model.location.NamedArea;
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.IBeanInitializer;
+import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
public interface IDescriptionService extends IIdentifiableEntityService<DescriptionBase> {
*/
public UUID deleteDescriptionElement(DescriptionElementBase descriptionElement);
+ public UUID deleteDescriptionElement(UUID descriptionElementUuid);
+
/**
* List the descriptions of type <T>, filtered using the following parameters
*
public int count(Class<? extends DescriptionBase> type, Boolean hasImages, Boolean hasText, Set<Feature> feature);
/**
- * Returns description elements of type <TYPE>, belonging to a given description, optionally filtered by one or more features
+ * Returns description elements of type <TYPE>, belonging to a given
+ * description, optionally filtered by one or more features
*
- * @param description The description which these description elements belong to (can be null to count all description elements)
- * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)
- * @param type The type of description
- * @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 IBeanInitializer#initialize(Object, List)}
+ * @param description
+ * The description which these description elements belong to
+ * (can be null to count all description elements)
+ * @param descriptionType
+ * A filter DescriptionElements which belong to of a specific
+ * class of Descriptions
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific 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 IBeanInitializer#initialize(Object, List)}
* @return a Pager containing DescriptionElementBase instances
- *
- * FIXME candidate for harmonization - rename to pageDescriptionElements
+
+ * @deprecated use
+ * {@link #pageDescriptionElements(DescriptionBase, Set, Class, Integer, Integer, List)}
+ * instead
*/
+ @Deprecated
public Pager<DescriptionElementBase> getDescriptionElements(DescriptionBase description,Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
/**
- * Returns description elements of type <TYPE>, belonging to a given description, optionally filtered by one or more features
+ * Returns description elements of type <TYPE>, belonging to a given
+ * description, optionally filtered by one or more features
*
- * @param description The description which these description elements belong to (can be null to count all description elements)
- * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)
- * @param type The type of description
- * @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 IBeanInitializer#initialize(Object, List)}
- * @return a List containing DescriptionElementBase instances
+ * @param description
+ * The description which these description elements belong to
+ * (can be null to count all description elements)
+ * @param descriptionType
+ * A filter DescriptionElements which belong to of a specific
+ * class of Descriptions
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific 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 IBeanInitializer#initialize(Object, List)}
+ *
+ * @return a Pager containing DescriptionElementBase instances
+ */
+ public Pager<DescriptionElementBase> pageDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
+ /**
+ * Returns description elements of type <TYPE>, belonging to a given
+ * description, optionally filtered by one or more features
+ *
+ * @param description
+ * The description which these description elements belong to
+ * (can be null to count all description elements)
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific 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 IBeanInitializer#initialize(Object, List)}
+ * @return a List of DescriptionElementBase instances
+ * @deprecated use {@link #listDescriptionElements(DescriptionBase, Class, Set, Class, Integer, Integer, List)} instead
*/
+ @Deprecated
public List<DescriptionElementBase> listDescriptionElements(DescriptionBase description,Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+ /**
+ * Returns description elements of type <TYPE>, belonging to a given
+ * description, optionally filtered by one or more features
+ *
+ * @param description
+ * The description which these description elements belong to
+ * (can be null to count all description elements)
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter DescriptionElements of a for specific 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 IBeanInitializer#initialize(Object, List)}
+ * @return a List of DescriptionElementBase instances
+ */
+ public List<DescriptionElementBase> listDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
/**
* Return a Pager containing Annotation entities belonging to the DescriptionElementBase instance supplied, optionally filtered by MarkerType
* @param annotatedObj The object that "owns" the annotations returned
* @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);
+ public Pager<TaxonDescription> searchDescriptionByDistribution(Set<NamedArea> namedAreas, PresenceAbsenceTerm presence, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* Returns a Paged List of DescriptionElementBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
*/
public Pager<Media> getMedia(DescriptionElementBase descriptionElement, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+ /**
+ * Provides access to all DescriptionElements associated with the given Taxon
+ * via a TaxonDescrition.
+ *
+ * @param taxon
+ * The Taxon to return Description elements for
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific 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 IBeanInitializer#initialize(Object, List)}
+ * @return a List containing all matching DescriptionElementBase instances
+ *
+ * @deprecated use {@link #listDescriptionElementsForTaxon(Taxon, Set, Class, Integer, Integer, List)} instead
+ */
+ @Deprecated
public <T extends DescriptionElementBase> List<T> getDescriptionElementsForTaxon(Taxon taxon, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
- public DistributionTree getOrderedDistributions(Set<TaxonDescription> taxonDescriptions, Set<NamedAreaLevel> levels, List<String> propertyPaths);
+ /**
+ * Provides access to all DescriptionElements associated with the given Taxon
+ * via a TaxonDescrition.
+ *
+ * @param taxon
+ * The Taxon to return Description elements for
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific 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 IBeanInitializer#initialize(Object, List)}
+ * @return a List containing all matching DescriptionElementBase instances
+ *
+ */
+ public <T extends DescriptionElementBase> List<T> listDescriptionElementsForTaxon(Taxon taxon, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
+ /**
+ * Provides access to all DescriptionElements associated with the given Taxon
+ * via a TaxonDescrition.
+ *
+ * @param taxon
+ * The Taxon to return Description elements for
+ * @param features
+ * Restrict the results to those description elements which are
+ * scoped by one of the Features passed (can be null or empty)
+ * @param type
+ * A filter for DescriptionElements of a specific class
+ * @param pageSize
+ * The maximum number of description elements returned
+ * @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 for all matching DescriptionElementBase instances
+ *
+ */
+ public <T extends DescriptionElementBase> Pager<T> pageDescriptionElementsForTaxon(Taxon taxon, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
+
+
+ /**
+ * @param taxonDescriptions
+ * @param subAreaPreference
+ * enables the <b>Sub area preference rule</b> if set to true,
+ * see {@link DescriptionUtility#filterDistributions(Collection,
+ * boolean, boolean}
+
+ * @param statusOrderPreference
+ * enables the <b>Status order preference rule</b> if set to
+ * true, see {@link
+ * DescriptionUtility#filterDistributions(Collection, boolean,
+ * boolean}
+ * @param hideMarkedAreas
+ * distributions where the area has a {@link Marker} with one of
+ * the specified {@link MarkerType}s will be skipped, see
+ * {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
+ * @param omitLevels
+ * A Set NamedArea levels to omit - optional
+ * @param propertyPaths
+ * the initialization strategy
+ *
+ * @return
+ * @deprecated use {@link IEditGeoService#composeDistributionInfoFor()} instead
+ */
+ @Deprecated
+ public DistributionTree getOrderedDistributions(
+ Set<TaxonDescription> taxonDescriptions,
+ boolean subAreaPreference,
+ boolean statusOrderPreference,
+ Set<MarkerType> hideMarkedAreas,
+ Set<NamedAreaLevel> omitLevels, List<String> propertyPaths);
/**
* Generate a string representation of the structured <code>description</code> supplied in natural language
*/
public void moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements, DescriptionBase targetDescription, boolean isPaste);
+ /**
+ * Pager method to get all {@link NamedAreas} instances which are currently used
+ * by {@link Distribution} elements.
+ *
+ * @param pageSize
+ * The maximum number of description elements returned
+ * @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 for all NamedAreas instances which are currently in use.
+ *
+ */
+ public Pager<TermDto> pageNamedAreasInUse(boolean includeAllParents, Integer pageSize,
+ Integer pageNumber);
+
+ public DeleteResult deleteDescription(DescriptionBase description);
+
+ public DeleteResult deleteDescription(UUID descriptionUuid);
+
+ /**
+ * @param sourceTaxon
+ * @param targetTaxon
+ * @return
+ */
+ public UpdateResult moveTaxonDescriptions(Taxon sourceTaxon, Taxon targetTaxon);
+
+ /**
+ * @param sourceTaxonUuid
+ * @param targetTaxonUuid
+ * @return
+ */
+ public UpdateResult moveTaxonDescriptions(UUID sourceTaxonUuid, UUID targetTaxonUuid);
+
}
\ No newline at end of file