import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
import java.util.UUID;
import org.apache.log4j.Logger;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.common.VocabularyEnum;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
-import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
-import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.Article;
import eu.etaxonomy.cdm.model.reference.Book;
import eu.etaxonomy.cdm.model.reference.Generic;
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.cdm.model.taxon.TaxonomicTree;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
}
}
- public Set<TaxonRelationshipType> getConceptRelationshipTypes() {
- Set<TaxonRelationshipType> conceptRelationshipTypes = getTaxonRelationshipTypes().getTerms();
- // remove these two relations as they are considered standard taxon relations
- conceptRelationshipTypes.remove(TaxonRelationshipType.MISAPPLIED_NAME_FOR());
- conceptRelationshipTypes.remove(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN());
-
- return conceptRelationshipTypes;
- }
public ReferenceBase<?> getDefaultSec() {
// TODO why is this returning null? and of course, replace w the real deal
return applicationController.getReferenceService().getReferenceByUuid(
UUID.fromString("f3593c18-a8d2-4e51-bdad-0befbf8fb2d1"));
}
-
- private TermVocabulary<Feature> getFeaturesInternal() {
- return applicationController.getTermService().getVocabulary(VocabularyEnum.Feature);
- }
- public static SortedSet<Feature> getFeatures() {
- return getDefault().getFeaturesInternal().getTermsOrderedByLabels(getDefaultLanguage());
- }
-
- public SortedSet<NameRelationshipType> getNameRelationshipTypes() {
- return applicationController.getTermService().getVocabulary(VocabularyEnum.NameRelationshipType).getTermsOrderedByLabels(Language.DEFAULT());
- }
-
- public TermVocabulary<NomenclaturalStatusType> getNomenclaturalStatusTypesInternal() {
- return applicationController.getTermService().getVocabulary(VocabularyEnum.NomenclaturalStatusType);
- }
-
- public static Set<NomenclaturalStatusType> getNomenclaturalStatusTypes(){
- // TODO sort types
- return getDefault().getNomenclaturalStatusTypesInternal().getTerms();
- }
-
- private OrderedTermVocabulary<Rank> getRanksInternal(){
- TermVocabulary<Rank> vocabulary = applicationController.getTermService().getVocabulary(VocabularyEnum.Rank);
- return HibernateProxyHelper.deproxy(vocabulary, OrderedTermVocabulary.class);
- }
-
- public static SortedSet<Rank> getRanks(){
- return getDefault().getRanksInternal().getOrderedTerms(null);
- }
-
+ /**
+ * @deprecated use taxonomic tree instead
+ */
public List<Taxon> getRootTaxa() {
boolean onlyWithChildren = false;
boolean withMisapplications = true;
public List<TaxonomicTree> getTaxonomicTrees() {
return applicationController.getTaxonService().getAllTaxonomicTrees(10000, 0);
}
-
- public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypes() {
- TermVocabulary vocabulary = HibernateProxyHelper.deproxy
- (applicationController.getTermService().getVocabulary(VocabularyEnum.TaxonRelationshipType), TermVocabulary.class);
- return (OrderedTermVocabulary<TaxonRelationshipType>) vocabulary;
- }
-
- public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatus() {
- return applicationController.getTermService().getVocabulary(VocabularyEnum.SpecimenTypeDesignationStatus);
- }
-
-
- public UUID saveTaxon(Taxon taxon) {
- return applicationController.getTaxonService().save(taxon);
- }
-
- public void setApplicationController(
- CdmApplicationController applicationController) {
- this.applicationController = applicationController;
- }
+
private CdmApplicationController getApplicationControllerInternal(){
return applicationController;
return getDefault().getGlobalReadOnlyConversation();
}
- public static ITaxonService getTaxonService(){
- return getDefault().getApplicationController().getTaxonService();
- }
+
+ /*
+ * EXPOSING SERVICES
+ */
- public static INameService getNameService(){
- return getDefault().getApplicationController().getNameService();
- }
+ public static ITaxonService getTaxonService(){ return getDefault().getApplicationControllerInternal().getTaxonService();}
- public static IReferenceService getReferenceService(){
- return getDefault().getApplicationController().getReferenceService();
- }
+ public static INameService getNameService(){ return getDefault().getApplicationControllerInternal().getNameService();}
- public static ILocationService getLocationService(){
- return getDefault().getApplicationController().getLocationService();
- }
+ public static IReferenceService getReferenceService(){ return getDefault().getApplicationControllerInternal().getReferenceService();}
+
+ public static ILocationService getLocationService(){ return getDefault().getApplicationControllerInternal().getLocationService();}
- public static ProviderManager getAuthenticationManager() {
- return getDefault().getApplicationController().getAuthenticationManager();
- }
+ public static ProviderManager getAuthenticationManager() { return getDefault().getApplicationControllerInternal().getAuthenticationManager();}
/**
}
return resultsList;
}
-
-
- public static List<Language> getLanguages() {
- ITermService termService = getDefault().getApplicationController().getTermService();
- ArrayList<Language> languages = new ArrayList<Language>();
- for (Language language : termService.getLanguageVocabulary()) {
- languages.add(language);
- }
-
- // TODO sort languages
-
-// languages.add(Language.ENGLISH());
-// languages.add(Language.GERMAN());
- return languages;
- }
/**
* FIXME mock
return Language.ENGLISH();
}
- /**
- * @return
- */
- private static String getApplicationContextBean() {
- return DEFAULT_APPLICATION_CONTEXT;
- }
-
/**
* @return
*/
return nomReferenceTypeMap;
}
- /**
- * @param feature
- */
- public static void saveFeature(Feature feature) {
- TermVocabulary<Feature> vocabulary = getDefault().getFeaturesInternal();
-
- vocabulary.addTerm(feature);
-
- getDefault().getApplicationController().getTermService().saveTermVocabulary(vocabulary);
- }
-
- /**
- * TODO make this more generic
- *
- * @param feature
- */
- public static void updateFeature(Feature feature) {
- TermVocabulary<Feature> vocabulary = getDefault().getFeaturesInternal();
-
- getDefault().getApplicationController().getTermService().saveTermVocabulary(vocabulary);
- }
}