Revision caddd4f3
Added by Patrick Plitzner over 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java | ||
---|---|---|
59 | 59 |
// TODO make this configurable via preferences |
60 | 60 |
private static final int MAX_RESULTS_BEFORE_WARNING = 500; |
61 | 61 |
|
62 |
/** |
|
63 |
* <p>findNames</p> |
|
64 |
* |
|
65 |
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object. |
|
66 |
* @return a {@link java.util.List} object. |
|
67 |
*/ |
|
68 | 62 |
public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){ |
69 | 63 |
if(checkLargeResult(CdmStore.getService(INameService.class).countByTitle(configurator))){ |
70 | 64 |
return CdmStore.getService(INameService.class).findByTitle(configurator).getRecords(); |
... | ... | |
86 | 80 |
relationships.add((NameRelationship) relationship); |
87 | 81 |
} |
88 | 82 |
} |
89 |
|
|
90 |
|
|
91 | 83 |
return relationships; |
92 |
|
|
93 | 84 |
} |
94 | 85 |
|
95 |
/** |
|
96 |
* <p>findTaxaAndNames</p> |
|
97 |
* |
|
98 |
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object. |
|
99 |
* @return a {@link java.util.List} object. |
|
100 |
*/ |
|
101 | 86 |
public List<UuidAndTitleCache<IdentifiableEntity>> findTaxaAndNames(IFindTaxaAndNamesConfigurator<TaxonBase> configurator){ |
102 | 87 |
return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator); |
103 | 88 |
} |
104 | 89 |
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
/** |
|
109 |
* <p>findReferences</p> |
|
110 |
* |
|
111 |
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object. |
|
112 |
* @return a {@link java.util.List} object. |
|
113 |
*/ |
|
114 | 90 |
public List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){ |
115 | 91 |
if(checkLargeResult(CdmStore.getService(IReferenceService.class).countByTitle(configurator))){ |
116 | 92 |
return CdmStore.getService(IReferenceService.class).findByTitle(configurator).getRecords(); |
... | ... | |
118 | 94 |
return NO_RESULTS; |
119 | 95 |
} |
120 | 96 |
|
121 |
|
|
122 |
/** |
|
123 |
* <p>findAgents</p> |
|
124 |
* |
|
125 |
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object. |
|
126 |
* @return a {@link java.util.List} object. |
|
127 |
*/ |
|
128 | 97 |
public List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){ |
129 | 98 |
if(checkLargeResult(CdmStore.getService(IAgentService.class).countByTitle(configurator))){ |
130 | 99 |
return CdmStore.getService(IAgentService.class).findByTitle(configurator).getRecords(); |
... | ... | |
132 | 101 |
return NO_RESULTS; |
133 | 102 |
} |
134 | 103 |
|
135 |
/** |
|
136 |
* <p>findTeamOrPersons</p> |
|
137 |
* |
|
138 |
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object. |
|
139 |
* @return a {@link java.util.List} object. |
|
140 |
*/ |
|
141 | 104 |
@SuppressWarnings("unchecked") |
142 | 105 |
public List<TeamOrPersonBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){ |
143 | 106 |
configurator.setClazz(TeamOrPersonBase.class); |
... | ... | |
214 | 177 |
} |
215 | 178 |
|
216 | 179 |
|
217 |
/** |
|
218 |
* @param count |
|
219 |
* @return |
|
220 |
*/ |
|
221 | 180 |
private boolean checkLargeResult(int count) { |
222 | 181 |
if(count > MAX_RESULTS_BEFORE_WARNING){ |
223 | 182 |
return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Large result expected", |
... | ... | |
228 | 187 |
} |
229 | 188 |
} |
230 | 189 |
|
231 |
/** |
|
232 |
* |
|
233 |
* @param configurator |
|
234 |
* @return |
|
235 |
*/ |
|
236 | 190 |
private String sqlizeTitleSearchString(IIdentifiableEntityServiceConfigurator configurator){ |
237 | 191 |
return configurator.getTitleSearchString().replace(WILDCARD, "%"); |
238 | 192 |
} |
Also available in: Unified diff
Trim code