(no commit message)
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 18 Jun 2009 14:37:42 +0000 (14:37 +0000)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 18 Jun 2009 14:37:42 +0000 (14:37 +0000)
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImpl.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IDescriptionService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/INameService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ITaxonService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/NameServiceImpl.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/ITaxonServiceConfigurator.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/impl/TaxonServiceConfiguratorImpl.java

index c682d2652d5822dd1f135986a6c5e03067fda384..4de723d1da869c486f42973829cbc45062b4c01b 100644 (file)
@@ -40,6 +40,7 @@ import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.media.Media;\r
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
 import eu.etaxonomy.cdm.persistence.dao.common.ITermVocabularyDao;\r
 import eu.etaxonomy.cdm.persistence.dao.description.IDescriptionDao;\r
 import eu.etaxonomy.cdm.persistence.dao.description.IDescriptionElementDao;\r
@@ -228,16 +229,18 @@ public class DescriptionServiceImpl extends IdentifiableServiceBase<DescriptionB
                return dao.countDescriptions(type, hasImages, hasText, feature);\r
        }\r
 \r
-       public <TYPE extends DescriptionElementBase> Pager<TYPE> getDescriptionElements(DescriptionBase description, Set<Feature> features,     Class<TYPE> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {\r
-        Integer numberOfResults = dao.countDescriptionElements(description, features, type);\r
-               \r
+       public <TYPE extends DescriptionElementBase> Pager<TYPE> getDescriptionElements(DescriptionBase description,\r
+                       Set<Feature> features, Class<TYPE> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {\r
+               Integer numberOfResults = dao.countDescriptionElements(description, features, type);\r
+\r
                List<TYPE> results = new ArrayList<TYPE>();\r
-               if(numberOfResults > 0) { // no point checking again\r
-                       results = dao.getDescriptionElements(description, features, type, pageSize, pageNumber, propertyPaths); \r
+               if (numberOfResults > 0) { // no point checking again\r
+                       results = dao.getDescriptionElements(description, features, type, pageSize, pageNumber, propertyPaths);\r
                }\r
-               \r
+\r
                return new DefaultPagerImpl<TYPE>(pageNumber, numberOfResults, pageSize, results);\r
        }\r
+       \r
 \r
        public Pager<Media> getMedia(DescriptionElementBase descriptionElement, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {\r
         Integer numberOfResults = descriptionElementDao.countMedia(descriptionElement);\r
index e6611878fac2e94b3a29716aa382ab7fff9ca0b2..349ab6ba357a2d3fdca4f1e7f56a93e8dfa7e595 100644 (file)
@@ -32,6 +32,7 @@ import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.media.Media;\r
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
 \r
@@ -184,6 +185,7 @@ public interface IDescriptionService extends IIdentifiableEntityService<Descript
         * @param description The description which these description elements belong to (can be null to count all description elements)\r
         * @param features Restrict the results to those description elements which are scoped by one of the Features passed (can be null or empty)\r
         * @param type The type of description\r
+        * @param class \r
         * @param pageSize The maximum number of description elements returned (can be null for all description elements)\r
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
         * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}\r
index 0dcee780e5ae46251c9b17ce505148b164a9b1d7..59ce00ddd23019f8183988974cf906f1e794b094 100644 (file)
@@ -13,6 +13,7 @@ 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 eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
@@ -108,6 +109,7 @@ 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
@@ -146,10 +148,24 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
        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
@@ -157,7 +173,36 @@ 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 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
+        * @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> 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
index 4d5bbc235e9c5f9e5891b801c8f436a609dba225..a3d93fde7df63c2cb2b6457a3eb05ab894efb575 100644 (file)
@@ -183,7 +183,7 @@ public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
        public Synonym makeTaxonSynonym (Taxon oldTaxon, Taxon newAcceptedTaxon, SynonymRelationshipType synonymType, ReferenceBase citation, String citationMicroReference);
        
        /**
-        * Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied) 
+        * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
         * where the supplied taxon is relatedTo.
         * 
         * @param taxon The taxon that is relatedTo
@@ -192,12 +192,54 @@ public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
         * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
         * @param orderHints Properties to order by
         * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @return a List of TaxonRelationship instances
+        */
+       public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+       
+       /**
+        * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
+        * where the supplied taxon is relatedTo.
+        * 
+        * @param taxon The taxon that is relatedTo
+        * @param type The type of TaxonRelationship (can be null)
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
+        * @param orderHints Properties to order by
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @return a Pager of TaxonRelationship instances
+        */
+       public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+       
+       /**
+        * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
+        * where the supplied taxon is relatedFrom.
+        * 
+        * @param taxon The taxon that is relatedFrom
+        * @param type The type of TaxonRelationship (can be null)
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
+        * @param orderHints Properties to order by
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
+        * @return a List of TaxonRelationship instances
+        */
+       public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+       
+       /**
+        * Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) 
+        * where the supplied taxon is relatedFrom.
+        * 
+        * @param taxon The taxon that is relatedFrom
+        * @param type The type of TaxonRelationship (can be null)
+        * @param pageSize The maximum number of relationships returned (can be null for all relationships)
+        * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
+        * @param orderHints Properties to order by
+        * @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link BeanInitializer#initialize(Object, List)}
         * @return a Pager of TaxonRelationship instances
         */
-       public Pager<TaxonRelationship> getRelatedTaxa(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+       public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
        
        /**
-        * Returns the SynonymRelationships (of where relationship.type == type, if this arguement is supplied) 
+        * Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) 
         * where the supplied taxon is relatedTo.
         * 
         * @param taxon The taxon that is relatedTo
index fed4b803a37dd21fb2a43949477ade1113811c6e..5ae46727f84b28aadf953d4cf9d137f7d0c8610e 100644 (file)
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 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.apache.log4j.Logger;\r
@@ -155,6 +156,7 @@ public class NameServiceImpl extends IdentifiableServiceBase<TaxonNameBase,ITaxo
                return homotypicalGroupDao.list(limit, start);\r
        }\r
        \r
+       @Deprecated\r
        public List<RelationshipBase> getAllRelationships(int limit, int start){\r
                return dao.getAllRelationships(limit, start);\r
        }\r
@@ -234,16 +236,36 @@ public class NameServiceImpl extends IdentifiableServiceBase<TaxonNameBase,ITaxo
                \r
                return new DefaultPagerImpl<HybridRelationship>(pageNumber, numberOfResults, pageSize, results);\r
        }\r
-\r
-       public Pager<NameRelationship> getRelatedNames(TaxonNameBase name,NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
-        Integer numberOfResults = dao.countRelatedNames(name, type);\r
+       \r
+       public List<NameRelationship> listFromNameRelationships(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+               Integer numberOfResults = dao.countNameRelationships(name, NameRelationship.Direction.relatedFrom, type);\r
                \r
                List<NameRelationship> results = new ArrayList<NameRelationship>();\r
                if(numberOfResults > 0) { // no point checking again\r
-                       results = dao.getRelatedNames(name, type, pageSize, pageNumber,orderHints,propertyPaths); \r
+                       results = dao.getNameRelationships(name, NameRelationship.Direction.relatedFrom, type, pageSize, pageNumber, orderHints, propertyPaths); \r
                }\r
+               return results;\r
+       }\r
+\r
+       public Pager<NameRelationship> pageFromNameRelationships(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+               List<NameRelationship> results = listFromNameRelationships(name, type, pageSize, pageNumber, orderHints, propertyPaths);\r
+               return new DefaultPagerImpl<NameRelationship>(pageNumber, results.size(), pageSize, results);\r
+       }\r
+       \r
+       public List<NameRelationship> listToNameRelationships(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+\r
+               Integer numberOfResults = dao.countNameRelationships(name, NameRelationship.Direction.relatedTo, type);\r
                \r
-               return new DefaultPagerImpl<NameRelationship>(pageNumber, numberOfResults, pageSize, results);\r
+               List<NameRelationship> results = new ArrayList<NameRelationship>();\r
+               if(numberOfResults > 0) { // no point checking again\r
+                       results = dao.getNameRelationships(name, NameRelationship.Direction.relatedTo, type, pageSize, pageNumber, orderHints, propertyPaths); \r
+               }\r
+               return results;\r
+       }\r
+       \r
+       public Pager<NameRelationship> pageToNameRelationships(TaxonNameBase name, NameRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+               List<NameRelationship> results = listToNameRelationships(name, type, pageSize, pageNumber, orderHints, propertyPaths);\r
+               return new DefaultPagerImpl<NameRelationship>(pageNumber, results.size(), pageSize, results);\r
        }\r
 \r
        \r
index a03f3e09f62117a4b087d07d0a01e48de9fbc6c9..3a4dc73c448a0909d6f1b5e2448972ad228806af 100644 (file)
@@ -46,6 +46,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;\r
+import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonomicTree;\r
 import eu.etaxonomy.cdm.persistence.dao.common.IOrderedTermVocabularyDao;\r
 import eu.etaxonomy.cdm.persistence.dao.description.IDescriptionDao;\r
@@ -73,6 +74,8 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
        private IOrderedTermVocabularyDao orderedVocabularyDao;\r
        @Autowired\r
        private IDescriptionDao descriptionDao;\r
+       @Autowired\r
+       private BeanInitializer defaultBeanInitializer;\r
 \r
        \r
        /**\r
@@ -338,15 +341,34 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                return new DefaultPagerImpl<TaxonBase>(pageNumber, numberOfResults, pageSize, results);\r
        }\r
 \r
-       public Pager<TaxonRelationship> getRelatedTaxa(Taxon taxon,     TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
-        Integer numberOfResults = dao.countRelatedTaxa(taxon, type);\r
+       public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths){\r
+               Integer numberOfResults = dao.countTaxonRelationships(taxon, type, TaxonRelationship.Direction.relatedTo);\r
                \r
                List<TaxonRelationship> results = new ArrayList<TaxonRelationship>();\r
                if(numberOfResults > 0) { // no point checking again\r
-                       results = dao.getRelatedTaxa(taxon, type, pageSize, pageNumber, orderHints, propertyPaths); \r
+                       results = dao.getTaxonRelationships(taxon, type, pageSize, pageNumber, orderHints, propertyPaths, TaxonRelationship.Direction.relatedTo); \r
                }\r
+               return results;\r
+       }\r
+       \r
+       public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+               List<TaxonRelationship> results = listToTaxonRelationships(taxon, type, pageSize, pageNumber, orderHints, propertyPaths); \r
+               return new DefaultPagerImpl<TaxonRelationship>(pageNumber, results.size(), pageSize, results);\r
+       }\r
+       \r
+       public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths){\r
+               Integer numberOfResults = dao.countTaxonRelationships(taxon, type, TaxonRelationship.Direction.relatedFrom);\r
                \r
-               return new DefaultPagerImpl<TaxonRelationship>(pageNumber, numberOfResults, pageSize, results);\r
+               List<TaxonRelationship> results = new ArrayList<TaxonRelationship>();\r
+               if(numberOfResults > 0) { // no point checking again\r
+                       results = dao.getTaxonRelationships(taxon, type, pageSize, pageNumber, orderHints, propertyPaths, TaxonRelationship.Direction.relatedFrom); \r
+               }\r
+               return results;\r
+       }\r
+       \r
+       public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
+               List<TaxonRelationship> results = listToTaxonRelationships(taxon, type, pageSize, pageNumber, orderHints, propertyPaths); \r
+               return new DefaultPagerImpl<TaxonRelationship>(pageNumber, results.size(), pageSize, results);\r
        }\r
 \r
        public Pager<SynonymRelationship> getSynonyms(Taxon taxon,      SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) {\r
@@ -400,7 +422,8 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                if (configurator.isDoTaxa() && configurator.isDoSynonyms()) {\r
                        taxa = dao.getTaxaByName(configurator.getSearchString(), \r
                                        configurator.getMatchMode(), SelectMode.ALL, configurator.getSec(),\r
-                                               configurator.getPageSize(), configurator.getPageNumber());\r
+                                               configurator.getPageSize(), configurator.getPageNumber(), \r
+                                               configurator.getTaxonPropertyPath());\r
                        numberTaxaResults = \r
                                dao.countTaxaByName(configurator.getSearchString(), \r
                                                configurator.getMatchMode(), SelectMode.ALL, configurator.getSec());\r
@@ -408,7 +431,8 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                } else if(configurator.isDoTaxa()) {\r
                        taxa = dao.getTaxaByName(configurator.getSearchString(), \r
                                        configurator.getMatchMode(), SelectMode.TAXA, configurator.getSec(),\r
-                                       configurator.getPageSize(), configurator.getPageNumber());\r
+                                       configurator.getPageSize(), configurator.getPageNumber(), \r
+                                       configurator.getTaxonPropertyPath());\r
                        numberTaxaResults = \r
                                dao.countTaxaByName(configurator.getSearchString(), \r
                                                configurator.getMatchMode(), SelectMode.TAXA, configurator.getSec());\r
@@ -416,7 +440,8 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                } else if (configurator.isDoSynonyms()) {\r
                        taxa = dao.getTaxaByName(configurator.getSearchString(), \r
                                        configurator.getMatchMode(), SelectMode.SYNONYMS, configurator.getSec(),\r
-                                       configurator.getPageSize(), configurator.getPageNumber());\r
+                                       configurator.getPageSize(), configurator.getPageNumber(), \r
+                                       configurator.getTaxonPropertyPath());\r
                        numberTaxaResults = \r
                                dao.countTaxaByName(configurator.getSearchString(), \r
                                                configurator.getMatchMode(), SelectMode.SYNONYMS, configurator.getSec());\r
@@ -424,7 +449,9 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
 \r
                if (logger.isDebugEnabled()) { logger.debug(numberTaxaResults + " matching taxa counted"); }\r
                \r
-               results.addAll(taxa);\r
+               if(taxa != null){\r
+                       results.addAll(taxa);\r
+               }\r
                \r
                numberOfResults += numberTaxaResults;\r
                \r
@@ -434,7 +461,7 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
             int numberNameResults = 0;\r
                        List<? extends TaxonNameBase<?,?>> names = \r
                                nameDao.findByName(configurator.getSearchString(), configurator.getMatchMode(), \r
-                                               configurator.getPageSize(), configurator.getPageNumber(), null);\r
+                                               configurator.getPageSize(), configurator.getPageNumber(), null, null);\r
                        if (logger.isDebugEnabled()) { logger.debug(names.size() + " matching name(s) found"); }\r
                        if (names.size() > 0) {\r
                                for (TaxonNameBase<?,?> taxonName : names) {\r
@@ -449,7 +476,7 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                }\r
                \r
                // Taxa from common names\r
-               \r
+               // FIXME the matching common names also must be returned\r
                if (configurator.isDoTaxaByCommonNames()) {\r
                        int numberCommonNameResults = 0;\r
                        List<CommonTaxonName> commonTaxonNames = \r
@@ -465,6 +492,7 @@ public class TaxonServiceImpl extends IdentifiableServiceBase<TaxonBase,ITaxonDa
                                                Taxon taxon = taxonDescription.getTaxon();\r
                                                taxon = HibernateProxyHelper.deproxy(taxon, Taxon.class);\r
                                                if (!results.contains(taxon) && !taxon.isMisappliedName()) {\r
+                                                       defaultBeanInitializer.initialize(taxon, configurator.getTaxonPropertyPath());\r
                                                        results.add(taxon);\r
                                                        numberCommonNameResults++;\r
                                                }\r
index ae885f1c34f2b22fed886f2cc8ab26ae9d5295c1..4233ef67ca0a615e26d149ff22dde4e37a83e8cb 100644 (file)
@@ -10,6 +10,8 @@
 \r
 package eu.etaxonomy.cdm.api.service.config;\r
 \r
+import java.util.List;\r
+\r
 import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
 import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
 \r
@@ -46,7 +48,7 @@ public interface ITaxonServiceConfigurator {
 \r
        public ReferenceBase getSec();\r
        \r
-       public void setReferenceBase(ReferenceBase sec);\r
+       public void setSec(ReferenceBase sec);\r
        \r
        public Integer getPageSize();\r
 \r
@@ -55,4 +57,12 @@ public interface ITaxonServiceConfigurator {
        public Integer getPageNumber();\r
        \r
        public void setPageNumber(Integer pageNumber);\r
+       \r
+       public List<String> getTaxonPropertyPath();\r
+\r
+       public void setTaxonPropertyPath(List<String> taxonPropertyPath);\r
+\r
+       public List<String> getCommonNamePropertyPath();\r
+\r
+       public void setCommonNamePropertyPath(List<String> commonNamePropertyPath);\r
 }\r
index e49ed312ab8e3b81ca18f0ac214357b3dc2347b4..05cad6db4d17e0ec5e699fccf5f159cee31cd1c3 100644 (file)
@@ -11,6 +11,8 @@
 \r
 package eu.etaxonomy.cdm.api.service.config.impl;\r
 \r
+import java.util.List;\r
+\r
 import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;\r
 import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorBase;\r
 import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
@@ -30,6 +32,8 @@ implements ITaxonServiceConfigurator {
        private boolean doNamesWithoutTaxa = false;\r
        private String searchString;\r
        private ReferenceBase sec = null;\r
+       private List<String> taxonPropertyPath;\r
+       private List<String> commonNamePropertyPath;\r
        \r
        public static TaxonServiceConfiguratorImpl NewInstance() {\r
                return new TaxonServiceConfiguratorImpl();\r
@@ -99,7 +103,24 @@ implements ITaxonServiceConfigurator {
                return sec;\r
        }\r
        \r
-       public void setReferenceBase(ReferenceBase sec) {\r
+       public void setSec(ReferenceBase sec) {\r
                this.sec = sec;\r
        }\r
+\r
+       public List<String> getTaxonPropertyPath() {\r
+               return taxonPropertyPath;\r
+       }\r
+\r
+       public void setTaxonPropertyPath(List<String> taxonPropertyPath) {\r
+               this.taxonPropertyPath = taxonPropertyPath;\r
+       }\r
+\r
+       public List<String> getCommonNamePropertyPath() {\r
+               return commonNamePropertyPath;\r
+       }\r
+\r
+       public void setCommonNamePropertyPath(List<String> commonNamePropertyPath) {\r
+               this.commonNamePropertyPath = commonNamePropertyPath;\r
+       }\r
+       \r
 }\r