Revision 7084aeff
Added by Patrick Plitzner almost 10 years ago
- added support for term retrieval by TermVocabulary
- adapted MediaSpecimen DetailsView
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java | ||
---|---|---|
23 | 23 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
24 | 24 |
import eu.etaxonomy.cdm.model.common.TermBase; |
25 | 25 |
import eu.etaxonomy.cdm.model.common.TermType; |
26 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
|
26 |
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
|
27 | 27 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
28 | 28 |
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer; |
29 | 29 |
|
... | ... | |
56 | 56 |
return getFilteredTerms(TermStore.getTerms(termType, null)); |
57 | 57 |
} |
58 | 58 |
|
59 |
/** |
|
60 |
* |
|
61 |
* @param clazz |
|
62 |
* @return |
|
63 |
*/ |
|
64 |
public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary){ |
|
65 |
return getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary, null))); |
|
66 |
} |
|
67 |
|
|
59 | 68 |
/** |
60 | 69 |
* |
61 | 70 |
* @param clazz |
... | ... | |
137 | 146 |
|
138 | 147 |
String typeName = getTermClass(initialTerms); |
139 | 148 |
Collection<UUID> hiddenTermUuids = hiddenTermsMap.get(typeName); |
140 |
|
|
149 |
|
|
141 | 150 |
|
142 | 151 |
if(hiddenTermUuids == null){ |
143 | 152 |
return initialTerms; |
... | ... | |
148 | 157 |
if(! hiddenTermUuids.contains(((TaxonRelationshipTypeInverseContainer) term).getType().getUuid())){ |
149 | 158 |
T type = (T)((TaxonRelationshipTypeInverseContainer) term).getType(); |
150 | 159 |
filteredTerms.add(type); |
151 |
|
|
160 |
|
|
152 | 161 |
} |
153 | 162 |
} |
154 | 163 |
if(! hiddenTermUuids.contains(term.getUuid())){ |
... | ... | |
160 | 169 |
} |
161 | 170 |
|
162 | 171 |
private <T extends DefinedTermBase> String getTermClass(Collection<T> initialTerms){ |
163 |
|
|
172 |
|
|
164 | 173 |
String result = null; |
165 | 174 |
if(!initialTerms.isEmpty()){ |
166 |
|
|
175 |
|
|
167 | 176 |
//TODO: there should be a more generic solution!! |
168 | 177 |
T entity = initialTerms.iterator().next(); |
169 | 178 |
if (entity instanceof TaxonRelationshipTypeInverseContainer){ |
Also available in: Unified diff