compile errors in descriptionServiceImpl -> Needs to be fixed by Maxime
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / INameService.java
index a53214bcbf4106072e5e9492231afe1c092a512e..68a3e98bc2c4b13c29aaa8961b5f6e82299d4c15 100644 (file)
@@ -13,60 +13,45 @@ package eu.etaxonomy.cdm.api.service;
 import java.util.Collection;\r
 import java.util.List;\r
 import java.util.Map;\r
+import java.util.Set;\r
 import java.util.UUID;\r
 \r
+import org.hibernate.criterion.Criterion;\r
+\r
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
-import eu.etaxonomy.cdm.api.service.config.INameServiceConfigurator;\r
-import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;\r
 import eu.etaxonomy.cdm.api.service.pager.Pager;\r
 import eu.etaxonomy.cdm.model.common.CdmBase;\r
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;\r
 import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;\r
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;\r
 import eu.etaxonomy.cdm.model.common.RelationshipBase;\r
-import eu.etaxonomy.cdm.model.common.RelationshipTermBase;\r
 import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
-import eu.etaxonomy.cdm.model.name.*;\r
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;\r
+import eu.etaxonomy.cdm.model.name.BotanicalName;\r
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;\r
+import eu.etaxonomy.cdm.model.name.HybridRelationship;\r
+import eu.etaxonomy.cdm.model.name.HybridRelationshipType;\r
+import eu.etaxonomy.cdm.model.name.NameRelationship;\r
+import eu.etaxonomy.cdm.model.name.NameRelationshipType;\r
+import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;\r
+import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;\r
+import eu.etaxonomy.cdm.model.name.NonViralName;\r
+import eu.etaxonomy.cdm.model.name.Rank;\r
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;\r
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
+import eu.etaxonomy.cdm.model.name.TypeDesignationBase;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
-import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;\r
+import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
 \r
 public interface INameService extends IIdentifiableEntityService<TaxonNameBase> {\r
 \r
-       /**\r
-        * FIXME candidate for harmonization?\r
-        * @param uuid\r
-        * @return\r
-        */\r
-       public TaxonNameBase getTaxonNameByUuid(UUID uuid);\r
-\r
-       /**\r
-        * FIXME candidate for harmonization?\r
-        * @param taxonName\r
-        * @return\r
-        */\r
-       public UUID saveTaxonName(TaxonNameBase taxonName);\r
-\r
-       /**\r
-        * FIXME candidate for harmonization?\r
-        * Saves a collection of  TaxonNames and return its UUID@param taxonCollection\r
-        * @return\r
-        */\r
-       public Map<UUID, TaxonNameBase> saveTaxonNameAll(Collection<? extends TaxonNameBase> taxonCollection);\r
 \r
        public Map<UUID, TypeDesignationBase> saveTypeDesignationAll(Collection<TypeDesignationBase> typeDesignationCollection);\r
 \r
        public Map<UUID, ReferencedEntityBase> saveReferencedEntitiesAll(Collection<ReferencedEntityBase> referencedEntityCollection);\r
                \r
        public Map<UUID, HomotypicalGroup> saveAllHomotypicalGroups(Collection<HomotypicalGroup> homotypicalGroups);\r
-       \r
-       /**\r
-        * FIXME candidate for harmonization?\r
-        * @param limit\r
-        * @param start\r
-        * @return\r
-        */\r
-       public List<TaxonNameBase> getAllNames(int limit, int start);\r
 \r
        public List<NomenclaturalStatus> getAllNomenclaturalStatus(int limit, int start);\r
 \r
@@ -77,6 +62,13 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
         * @return\r
         */\r
        public List<TaxonNameBase> getNamesByName(String name);\r
+       \r
+       /**\r
+        * Returns all NonViralNames with a name cache that matches the given string\r
+        * @param name\r
+        * @return\r
+        */\r
+       public List<NonViralName> getNamesByNameCache(String nameCache);\r
 \r
        /**\r
         * @param name\r
@@ -102,43 +94,77 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
 \r
     public List<HomotypicalGroup> getAllHomotypicalGroups(int limit, int start);\r
 \r
+       @Deprecated\r
     public List<RelationshipBase> getAllRelationships(int limit, int start);\r
     \r
        /**\r
         * Returns all Ranks\r
         * @return\r
+        * @deprecated use TermService#getVocabulary(VocabularyType) instead\r
         */\r
        public OrderedTermVocabulary<Rank> getRankVocabulary();\r
        \r
        /**\r
         * Returns all NomenclaturalStatusTypes\r
         * @return\r
+        * @deprecated use TermService#getVocabulary(VocabularyType) instead\r
         */\r
        public TermVocabulary<NomenclaturalStatusType> getStatusTypeVocabulary();\r
        \r
        /**\r
         * Returns TypeDesignationStatus vocabulary\r
         * @return\r
+        * @deprecated use TermService#getVocabulary(VocabularyType) instead\r
         */\r
        public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatusVocabulary();\r
                \r
        /**\r
         * Returns TypeDesignationStatus ordered vocabulary\r
         * @return\r
+        * @deprecated use TermService#getVocabulary(VocabularyType) instead\r
         */\r
        public OrderedTermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationVocabulary();\r
 \r
        /**\r
         * Returns all NameRelationshipTypes\r
         * @return\r
+        * @deprecated use TermService#getVocabulary(VocabularyType) instead\r
         */\r
        public TermVocabulary<NameRelationshipType> getNameRelationshipTypeVocabulary();\r
        \r
        /**\r
-        * Return a List of relationships related to this name, optionally filtered \r
+        * Return a List of relationships in which this name is related to another name, optionally filtered \r
         * by relationship type\r
         * \r
-        * @param name the name\r
+        * @param name the name on the <i>"from side"</i> of the relationship\r
+        * @param type the relationship type (or null to return all relationships) \r
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)\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
+        * @return a Pager of NameRelationship instances\r
+        */\r
+       public List<NameRelationship> listFromNameRelationships(TaxonNameBase name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Return a List of relationships in which this name is related to another name, optionally filtered \r
+        * by relationship type\r
+        * \r
+        * @param name the name on the <i>"from side"</i> of the relationship\r
+        * @param type the relationship type (or null to return all relationships) \r
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)\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
+        * @return a Pager of NameRelationship instances\r
+        */\r
+       public Pager<NameRelationship> pageFromNameRelationships(TaxonNameBase name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Return a List of relationships in which another name is related to this name, optionally filtered \r
+        * by relationship type\r
+        * \r
+        * @param name the name on the <i>"to side"</i> of the relationship \r
         * @param type the relationship type (or null to return all relationships) \r
         * @param pageSize The maximum number of relationships returned (can be null for all relationships)\r
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
@@ -146,7 +172,22 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
         * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}\r
         * @return a Pager of NameRelationship instances\r
         */\r
-       public Pager<NameRelationship> getRelatedNames(TaxonNameBase name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       public List<NameRelationship> listToNameRelationships(TaxonNameBase name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Return a List of relationships in which another name is related to this name, optionally filtered \r
+        * by relationship type\r
+        * \r
+        * @param name the name on the <i>"to side"</i> of the relationship \r
+        * @param type the relationship type (or null to return all relationships) \r
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)\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
+        * @return a Pager of NameRelationship instances\r
+        */\r
+       public Pager<NameRelationship> pageToNameRelationships(TaxonNameBase name,  NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
        \r
        /**\r
         * Return a List of hybrids related to this name, optionally filtered \r
@@ -160,7 +201,7 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
         * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}\r
         * @return a Pager of HybridRelationship instances\r
         */\r
-       public Pager<HybridRelationship> getHybridNames(BotanicalName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       public Pager<HybridRelationship> getHybridNames(NonViralName name, HybridRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
        \r
        /**\r
         * Return a List of types related to this name, optionally filtered \r
@@ -189,7 +230,60 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
         * @param rank\r
         * @param pageSize The maximum number of names returned (can be null for all names)\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
         * @return a Pager of TaxonNameBase instances\r
         */\r
-       public Pager<TaxonNameBase> searchNames(String uninomial, String infraGenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber);\r
+       public Pager<TaxonNameBase> searchNames(String uninomial, String infraGenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+        * Returns a Paged List of TaxonNameBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)\r
+        * \r
+        * @param clazz filter the results by class (or pass null to return all TaxonNameBase instances)\r
+        * @param queryString\r
+        * @param pageSize The maximum number of names returned (can be null for all matching names)\r
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
+        * @param orderHints\r
+        *            Supports path like <code>orderHints.propertyNames</code> which\r
+        *            include *-to-one properties like createdBy.username or\r
+        *            authorTeam.persistentTitleCache\r
+        * @param propertyPaths properties to be initialized\r
+        * @return a Pager TaxonNameBase instances\r
+        * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>\r
+        */\r
+       public Pager<TaxonNameBase> search(Class<? extends TaxonNameBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+       /**\r
+        * Returns a map that holds uuid, titleCache pairs of all names in the current database\r
+        * \r
+        * @return \r
+        *                      a <code>Map</code> containing uuid and titleCache of names\r
+        */\r
+       public List<UuidAndTitleCache> getUuidAndTitleCacheOfNames();\r
+       \r
+       /**\r
+        * Return a Pager of names matching the given query string, optionally filtered by class, optionally with a particular MatchMode\r
+        * \r
+        * @param clazz filter by class - can be null to include all instances of type T\r
+        * @param queryString the query string to filter by\r
+        * @param matchmode use a particular type of matching (can be null - defaults to exact matching)\r
+        * @param criteria additional criteria to filter by\r
+        * @param pageSize The maximum number of objects returned (can be null for all objects)\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 BeanInitializer#initialize(Object, List)}\r
+        * @param orderHints\r
+        *            Supports path like <code>orderHints.propertyNames</code> which\r
+        *            include *-to-one properties like createdBy.username or\r
+        *            authorTeam.persistentTitleCache\r
+        * @return a paged list of instances of type T matching the queryString\r
+        */\r
+    public Pager<TaxonNameBase> findByName(Class<? extends TaxonNameBase> clazz, String queryString,MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
+    \r
+    /**\r
+     * Returns a homotypical group with the given UUID or null if not homotypical group exists with that UUID\r
+     * \r
+     * @param uuid the uuid of the homotypical group\r
+     * @return a homotypical group\r
+     */\r
+    public HomotypicalGroup findHomotypicalGroup(UUID uuid);\r
 }
\ No newline at end of file