import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
public static final List NO_RESULTS = Arrays.asList(new Object[]{});
- public static final String WILDCARD = "*";
+ public static final String WILDCARD = "*"; //$NON-NLS-1$
public static int NO_COUNT = -1;
-
+
// TODO make this configurable via preferences
private static final int MAX_RESULTS_BEFORE_WARNING = 500;
public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator, ConversationHolder conversation){
-
+
if(checkLargeResult(CdmStore.getService(INameService.class).countByTitle(configurator))){
List<TaxonNameBase> records = CdmStore.getService(INameService.class).findByTitle(configurator).getRecords();
addUuidSearchResults(records, configurator, INameService.class);
public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> configurator, boolean showFieldUnits){
List<SpecimenOrObservationBase> records = new ArrayList<SpecimenOrObservationBase>();
final List<String> BASE_OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
- "collection",
- "descriptions",
- "identifiers",
- "derivationEvents.originals",
- "derivedFrom.originals",
- "gatheringEvent.country.representations",
- "gatheringEvent.collector",
- "gatheringEvent.locality",
- "descriptions.descriptionElements",
- "kindOfUnit",
- "amplificationResults",
- "sequences.singleReadAlignments",
- "mediaSpecimen"
+ "collection", //$NON-NLS-1$
+ "descriptions", //$NON-NLS-1$
+ "identifiers", //$NON-NLS-1$
+ "derivationEvents.originals", //$NON-NLS-1$
+ "derivedFrom.originals", //$NON-NLS-1$
+ "gatheringEvent.country.representations", //$NON-NLS-1$
+ "gatheringEvent.collector", //$NON-NLS-1$
+ "gatheringEvent.locality", //$NON-NLS-1$
+ "descriptions.descriptionElements", //$NON-NLS-1$
+ "kindOfUnit", //$NON-NLS-1$
+ "amplificationResults", //$NON-NLS-1$
+ "sequences.singleReadAlignments", //$NON-NLS-1$
+ "mediaSpecimen" //$NON-NLS-1$
});
List<String> occurrencePropertyPaths = new ArrayList<String>();
occurrencePropertyPaths.addAll(BASE_OCCURRENCE_INIT_STRATEGY);
for(String propertyPath:BASE_OCCURRENCE_INIT_STRATEGY) {
- occurrencePropertyPaths.add("derivationEvents.derivatives." + propertyPath);
+ occurrencePropertyPaths.add("derivationEvents.derivatives." + propertyPath); //$NON-NLS-1$
}
configurator.setPropertyPaths(occurrencePropertyPaths);
private boolean checkLargeResult(int count, int maxBeforWarning) {
if(count > maxBeforWarning){
- return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Large result expected",
- String.format("The current search will return %s objects. This will " +
- "take a long time and/or might render the editor unusable. Please consider refining your search.", count));
+ return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), Messages.SearchManager_LARGE_RESULT_EXPECTED,
+ String.format(Messages.SearchManager_LONG_SEARCH_WARNING, count));
}else{
return true;
}
}
private String sqlizeTitleSearchString(IIdentifiableEntityServiceConfigurator configurator){
- return configurator.getTitleSearchString().replace(WILDCARD, "%");
+ return configurator.getTitleSearchString().replace(WILDCARD, "%"); //$NON-NLS-1$
}
public List findTaxa(IIdentifiableEntityServiceConfigurator configurator) {