Revision 611b3a85
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java | ||
---|---|---|
14 | 14 |
import java.util.List; |
15 | 15 |
import java.util.UUID; |
16 | 16 |
|
17 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
18 |
import org.eclipse.swt.widgets.Display; |
|
19 |
|
|
17 | 20 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
18 | 21 |
import eu.etaxonomy.cdm.api.service.IAgentService; |
19 | 22 |
import eu.etaxonomy.cdm.api.service.IGroupService; |
... | ... | |
40 | 43 |
import eu.etaxonomy.cdm.model.reference.Reference; |
41 | 44 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
42 | 45 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
46 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
|
43 | 47 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
44 | 48 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
45 | 49 |
|
... | ... | |
55 | 59 |
|
56 | 60 |
public static int NO_COUNT = -1; |
57 | 61 |
|
62 |
private static final int MAX_RESULTS_BEFORE_WARNING = 500; |
|
63 |
|
|
58 | 64 |
public List<TaxonName> findNames(IIdentifiableEntityServiceConfigurator configurator, ConversationHolder conversation){ |
59 | 65 |
List<TaxonName> records = CdmStore.getService(INameService.class).findByTitle(configurator).getRecords(); |
60 | 66 |
addUuidSearchResults(records, configurator, INameService.class); |
... | ... | |
169 | 175 |
} |
170 | 176 |
configurator.setPropertyPaths(occurrencePropertyPaths); |
171 | 177 |
|
172 |
records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords(); |
|
178 |
if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){ |
|
179 |
records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords(); |
|
180 |
} |
|
173 | 181 |
addUuidSearchResults(records, configurator, IOccurrenceService.class); |
174 | 182 |
return records; |
175 | 183 |
} |
... | ... | |
212 | 220 |
return records; |
213 | 221 |
} |
214 | 222 |
|
223 |
private boolean checkLargeResult(int count) { |
|
224 |
return checkLargeResult(count, MAX_RESULTS_BEFORE_WARNING); |
|
225 |
} |
|
226 |
|
|
227 |
private boolean checkLargeResult(int count, int maxBeforWarning) { |
|
228 |
if(count > maxBeforWarning){ |
|
229 |
return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), Messages.SearchManager_LARGE_RESULT_EXPECTED, |
|
230 |
String.format(Messages.SearchManager_LONG_SEARCH_WARNING, count)); |
|
231 |
}else{ |
|
232 |
return true; |
|
233 |
} |
|
234 |
} |
|
215 | 235 |
|
216 | 236 |
} |
Also available in: Unified diff
ref #6321 Re-enable search count warning for derivate view