-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.AbsenceTerm;
-import eu.etaxonomy.cdm.model.description.PresenceTerm;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
import eu.etaxonomy.cdm.model.location.NamedAreaType;
-import eu.etaxonomy.cdm.persistence.dao.common.IDefinedTermDao;
-import eu.etaxonomy.cdm.persistence.dao.common.IOrderedTermVocabularyDao;
-import eu.etaxonomy.cdm.persistence.dao.common.ITermVocabularyDao;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dao.term.IDefinedTermDao;
+import eu.etaxonomy.cdm.persistence.dao.term.IOrderedTermVocabularyDao;
+import eu.etaxonomy.cdm.persistence.dao.term.ITermVocabularyDao;
/**
* Quick and dirty implementation of a location service as needed by the editor.
- *
+ *
* NOTE: Current implementation does not support the IService methods like {@link #save(DefinedTermBase)}
* as no base dao is loaded by autowiring.
*
* @author n.hoffman
- * @created 08.04.2009
- * @version 1.0
+ * @since 08.04.2009
*/
@Service
@Transactional(readOnly = true)
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ServiceBase#setDao(eu.etaxonomy.cdm.persistence.dao.common.ICdmEntityDao)
*/
- @Override
+ @Override
protected void setDao(IDefinedTermDao dao) {
this.dao = dao;
}
- /**
- * (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ILocationService#getAbsenceTerms()
- * FIXME Candidate for harmonization
- * is this method a duplicate of termService.getVocabulary(VocabularyEnum.AbsenceTerm)?
- */
- public OrderedTermVocabulary<AbsenceTerm> getAbsenceTermVocabulary() {
- String uuidString = "5cd438c8-a8a1-4958-842e-169e83e2ceee";
- UUID uuid = UUID.fromString(uuidString);
- OrderedTermVocabulary<AbsenceTerm> absenceTermVocabulary =
- (OrderedTermVocabulary)orderedVocabularyDao.findByUuid(uuid);
- return absenceTermVocabulary;
- }
-
/**
* (non-Javadoc)
* FIXME Candidate for harmonization
* is this method a duplicate of termService.getVocabulary(VocabularyEnum.PresenceTerm)
*/
- public OrderedTermVocabulary<PresenceTerm> getPresenceTermVocabulary() {
+ @Override
+ public OrderedTermVocabulary<PresenceAbsenceTerm> getPresenceAbsenceTermVocabulary() {
String uuidString = "adbbbe15-c4d3-47b7-80a8-c7d104e53a05";
UUID uuid = UUID.fromString(uuidString);
- OrderedTermVocabulary<PresenceTerm> presenceTermVocabulary =
+ OrderedTermVocabulary<PresenceAbsenceTerm> presenceTermVocabulary =
(OrderedTermVocabulary)orderedVocabularyDao.findByUuid(uuid);
return presenceTermVocabulary;
}
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ILocationService#getNamedAreaVocabularyTypes()
*/
+ @Override
public List<NamedAreaVocabularyType> getNamedAreaVocabularyTypes() {
List<NamedAreaVocabularyType> result = new ArrayList<NamedAreaVocabularyType>(3);
result.add(NamedAreaVocabularyType.TDWG_AREA);
- result.add(NamedAreaVocabularyType.WATERBODY_OR_COUNTRY);
+ result.add(NamedAreaVocabularyType.COUNTRY);
+ result.add(NamedAreaVocabularyType.WATERBODY);
result.add(NamedAreaVocabularyType.CONTINENT);
return result;
}
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ILocationService#getNamedAreas(java.lang.Object)
*/
+ @Override
public OrderedTermVocabulary<NamedArea> getNamedAreaVocabulary(NamedAreaVocabularyType vocabularyType) {
UUID namedAreaVocabularyUuid = null;
if(vocabularyType == NamedAreaVocabularyType.CONTINENT){
namedAreaVocabularyUuid = UUID.fromString("e72cbcb6-58f8-4201-9774-15d0c6abc128");
}
- if(vocabularyType == NamedAreaVocabularyType.WATERBODY_OR_COUNTRY){
+ if(vocabularyType == NamedAreaVocabularyType.COUNTRY){
namedAreaVocabularyUuid = UUID.fromString("006b1870-7347-4624-990f-e5ed78484a1a");
}
-
+ if(vocabularyType == NamedAreaVocabularyType.WATERBODY){
+ namedAreaVocabularyUuid = UUID.fromString("35a62b25-f541-4f12-a7c7-17d90dec3e03");
+ }
return (OrderedTermVocabulary)orderedVocabularyDao.findByUuid(namedAreaVocabularyUuid);
}
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ILocationService#getNamedAreaLevelVocabulary()
*/
+ @Override
public OrderedTermVocabulary<NamedAreaLevel> getNamedAreaLevelVocabulary() {
// TODO return namedAreaLevel filtered by NamedAreaVocabularyType
String uuidString = "49034253-27c8-4219-97e8-f8d987d3d122";
* FIXME Candidate for harmonization
* is this method a duplicate of termService.getVocabulary(VocabularyEnum.NamedAreaType)
*/
+ @Override
public TermVocabulary<NamedAreaType> getNamedAreaTypeVocabulary() {
String uuidString = "e51d52d6-965b-4f7d-900f-4ba9c6f5dd33";
UUID uuid = UUID.fromString(uuidString);
return namedAreaTypeVocabulary;
}
+ @Override
public List<NamedArea> getTopLevelNamedAreasByVocabularyType(NamedAreaVocabularyType vocabularyType){
OrderedTermVocabulary<NamedArea> vocabulary = getNamedAreaVocabulary(vocabularyType);
- List<NamedArea> topLevelTerms = new ArrayList<NamedArea>();
+ List<NamedArea> topLevelTerms = new ArrayList<>();
// for(NamedArea area : vocabulary){
- Iterator<NamedArea> it = vocabulary.iterator();
+ Iterator<NamedArea> it = vocabulary.getTerms().iterator();
while(it.hasNext()){
NamedArea area = HibernateProxyHelper.deproxy(it.next(), NamedArea.class);