return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator);
}
+
+
/**
* <p>findReferences</p>
@Deprecated
//TODO: method needs to be optimized with a direct SQL query instead of iterating over all specimens
public List<SpecimenOrObservationBase> findOccurrencesByType(IIdentifiableEntityServiceConfigurator configurator, SpecimenOrObservationType type){
- List<SpecimenOrObservationBase> occurrences = new ArrayList<SpecimenOrObservationBase>();
- for(SpecimenOrObservationBase occurrence:findOccurrences(configurator, true)){
- if(occurrence.getRecordBasis()==type){
- occurrences.add(occurrence);
+ List<SpecimenOrObservationBase> filteredOccurrences = new ArrayList<SpecimenOrObservationBase>();
+ List<SpecimenOrObservationBase> occurrences = findOccurrences(configurator, true);
+ if(type!=null){
+ for(SpecimenOrObservationBase occurrence:occurrences){
+ if(occurrence.getRecordBasis().equals(type)
+ || occurrence.getRecordBasis().isKindOf(type)
+ || type == SpecimenOrObservationType.Unknown){
+ filteredOccurrences.add(occurrence);
+ }
}
}
- return occurrences;
+ else{
+ filteredOccurrences = occurrences;
+ }
+ return filteredOccurrences;
}
public List<User> findUsers(IIdentifiableEntityServiceConfigurator configurator){
return configurator.getTitleSearchString().replace(WILDCARD, "%");
}
+ public List findTaxa(IIdentifiableEntityServiceConfigurator configurator) {
+ if(checkLargeResult(CdmStore.getService(ITaxonService.class).countByTitle(configurator))){
+ return CdmStore.getService(ITaxonService.class).findByTitle(configurator).getRecords();
+ }
+ return NO_RESULTS;
+ }
+
}