Streamline search method due to cdmlib service changes
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 17 Nov 2015 14:30:08 +0000 (15:30 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 17 Nov 2015 14:30:08 +0000 (15:30 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java

index 8d4bf0e08bb2ba91867cc4cfc3e7d6dad551f0aa..2103ba8e8e05f54d66e752037b9223b688bdb754 100644 (file)
@@ -162,14 +162,6 @@ public class SearchManager {
         */
        public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> configurator, boolean showFieldUnits){
            List<SpecimenOrObservationBase> records = new ArrayList<SpecimenOrObservationBase>();
         */
        public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> configurator, boolean showFieldUnits){
            List<SpecimenOrObservationBase> records = new ArrayList<SpecimenOrObservationBase>();
-               if(configurator.getClazz()==null){
-                   if(showFieldUnits){
-                       configurator.setClazz(SpecimenOrObservationBase.class);
-                   }
-                   else{
-                       configurator.setClazz(DerivedUnit.class);
-                   }
-               }
                final List<String> OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
                        "collection",
                        "descriptions",
                final List<String> OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
                        "collection",
                        "descriptions",
@@ -178,22 +170,8 @@ public class SearchManager {
                        "derivedFrom.originals"
                });
                configurator.setPropertyPaths(OCCURRENCE_INIT_STRATEGY);
                        "derivedFrom.originals"
                });
                configurator.setPropertyPaths(OCCURRENCE_INIT_STRATEGY);
-               if(configurator.getClazz().equals(SpecimenOrObservationBase.class)){
-                   //get FieldUnits + DerivedUnits
-                   configurator.setClazz(DerivedUnit.class);
-                   int derivedUnitCount = CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator);
-                   configurator.setClazz(FieldUnit.class);
-                   int fieldUnitCount = CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator);
-
-                   if(checkLargeResult(derivedUnitCount+fieldUnitCount)){
-                       configurator.setClazz(DerivedUnit.class);
-                       records.addAll(CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords());
-                       configurator.setClazz(FieldUnit.class);
-                       records.addAll(CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords());
-                   }
 
 
-               }
-               else if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
+               if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
                        records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords();
                }
                addUuidSearchResults(records, configurator, IOccurrenceService.class);
                        records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords();
                }
                addUuidSearchResults(records, configurator, IOccurrenceService.class);