Revision 16cafda4
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
public class TermManager { |
36 | 36 |
|
37 |
private static final String TERMS = "terms"; |
|
38 |
private static final String TERM = "term"; |
|
39 |
private static final String HIDE = "hide"; |
|
40 |
|
|
41 |
private static final String CLASS = "class"; |
|
42 |
private static final String UUID_STRING = "uuid"; |
|
43 |
|
|
44 |
|
|
45 | 37 |
private Map<Object, List> cachedTermMap = new HashMap<>(); |
46 | 38 |
|
47 |
|
|
48 | 39 |
//new cache for features!! |
49 | 40 |
//dinstinguish preferences for both |
50 | 41 |
//load at start |
... | ... | |
84 | 75 |
@SuppressWarnings("unchecked") |
85 | 76 |
List<T> terms = cachedTermMap.get(termVocabulary.getUuid()); |
86 | 77 |
if(terms==null){ |
87 |
terms = getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary,null)));
|
|
78 |
terms = getFilteredTerms(new ArrayList<>(TermStore.getTerms(termVocabulary,null))); |
|
88 | 79 |
cachedTermMap.put(termVocabulary.getUuid(), terms); |
89 | 80 |
} |
90 | 81 |
return terms; |
... | ... | |
234 | 225 |
return null; |
235 | 226 |
} |
236 | 227 |
|
237 |
private TermVocabularyDto getTermVocabularyByDto(Collection<TermDto> initialTerms){ |
|
238 |
if(!initialTerms.isEmpty()){ |
|
239 |
TermDto entity = initialTerms.iterator().next(); |
|
240 |
return entity.getVocabularyDto(); |
|
241 |
} |
|
242 |
return null; |
|
243 |
} |
|
244 |
|
|
245 |
|
|
246 | 228 |
/** |
247 | 229 |
* Generic method to set term preferences |
248 | 230 |
* |
... | ... | |
264 | 246 |
clearTermMapForTermVoc(voc.getUuid()); |
265 | 247 |
} |
266 | 248 |
|
267 |
|
|
268 | 249 |
/** |
269 | 250 |
* Generic method to set term preferences |
270 | 251 |
* |
... | ... | |
345 | 326 |
public <T extends DefinedTermBase> List<T> getTerms(List<UUID> uuidList, Class clazz){ |
346 | 327 |
|
347 | 328 |
List<T> filteredTerms = new ArrayList<>(); |
348 |
List<T> terms = TermStore.getTerms(clazz); |
|
329 |
@SuppressWarnings("unchecked") |
|
330 |
List<T> terms = TermStore.getTerms(clazz); |
|
349 | 331 |
if (uuidList == null || uuidList.isEmpty()){ |
350 | 332 |
return terms; |
351 | 333 |
} |
Also available in: Unified diff
cleanup