import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
*/
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[] {
+ final List<String> BASE_OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
+ "collection",
"descriptions",
"identifiers",
- "derivationEvents.originals"
+ "derivationEvents.originals",
+ "derivedFrom.originals",
+ "gatheringEvent.country.representations",
+ "gatheringEvent.collector",
+ "gatheringEvent.locality",
+ "descriptions.descriptionElements",
+ "kindOfUnit",
+ "amplificationResults",
+ "sequences.singleReadAlignments",
+ "mediaSpecimen"
});
- 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());
- }
+ List<String> occurrencePropertyPaths = new ArrayList<String>();
+ occurrencePropertyPaths.addAll(BASE_OCCURRENCE_INIT_STRATEGY);
+ for(String propertyPath:BASE_OCCURRENCE_INIT_STRATEGY) {
+ occurrencePropertyPaths.add("derivationEvents.derivatives." + propertyPath);
}
- else if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
+ configurator.setPropertyPaths(occurrencePropertyPaths);
+
+ if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords();
}
addUuidSearchResults(records, configurator, IOccurrenceService.class);