-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.MarkerType;
-import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.AbsenceTerm;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
-import eu.etaxonomy.cdm.model.description.PresenceTerm;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
* @param termType the term type
* @return an alphabetically sorted list of terms
*/
- public static List<DefinedTermBase<?>> getTerms(TermType termType, Comparator<DefinedTermBase<?>> comparator){
+ public static <TERM extends DefinedTermBase> List<TERM> getTerms(TermType termType, Comparator<TERM> comparator){
return getTermsFromService(termType, comparator);
}
* @param comparator
* @return
*/
- private static List<DefinedTermBase<?>> getTermsFromService(TermType termType, Comparator<DefinedTermBase<?>> comparator){
+ private static <T extends DefinedTermBase> List<T> getTermsFromService(TermType termType, Comparator<T> comparator){
if (comparator == null){
- comparator = new DefaultTermComparator<DefinedTermBase<?>>();
+ comparator = new DefaultTermComparator<T>();
}
- List<DefinedTermBase<?>> terms = CdmStore.getService(ITermService.class).listByTermType(termType, null, null, null, null);
+ List<T> terms = CdmStore.getService(ITermService.class).listByTermType(termType, null, null, null, null);
Collections.sort(terms, comparator);
return terms;
}
}
/**
- * @param term a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
+ * @param term a {@link eu.etaxonomy.cdm.model.term.DefinedTermBase} object.
*/
public static void saveTerm(DefinedTermBase term){
CdmStore.getService(ITermService.class).saveOrUpdate(term);
/**
* <p>delete</p>
*
- * @param selected a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
+ * @param selected a {@link eu.etaxonomy.cdm.model.term.DefinedTermBase} object.
* @throws ReferencedObjectUndeletableException
*/
public static void delete(DefinedTermBase selected) throws ReferencedObjectUndeletableException {
/**
* Save a vacabulary to data store
*
- * @param term a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
+ * @param term a {@link eu.etaxonomy.cdm.model.term.DefinedTermBase} object.
*/
public static void updateVocabulary(DefinedTermBase term) {
CdmStore.getService(ITermService.class).saveOrUpdate(term);
}
});
- termStoreEdgeCases.add(new ITermStoreEdgeCase<PresenceAbsenceTermBase>() {
+ termStoreEdgeCases.add(new ITermStoreEdgeCase<PresenceAbsenceTerm>() {
@Override
- public Class<PresenceAbsenceTermBase> getTermClass() {
- return PresenceAbsenceTermBase.class;
+ public Class<PresenceAbsenceTerm> getTermClass() {
+ return PresenceAbsenceTerm.class;
}
@Override
- public List<PresenceAbsenceTermBase> getTerms() {
- List presenceAbsenceTerms = TermStore.getTermsFromService(PresenceTerm.class, null);
- presenceAbsenceTerms.addAll(TermStore.getTermsFromService(AbsenceTerm.class, null));
+ public List<PresenceAbsenceTerm> getTerms() {
+ List<PresenceAbsenceTerm> presenceAbsenceTerms = TermStore.getTermsFromService(PresenceAbsenceTerm.class, null);
return presenceAbsenceTerms;
}