Merge branch 'hotfix/3.12.3' into develop
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / CollectionServiceImpl.java
index e72066c0fa4099bb4d9a09325171b13650ce5c86..8007ed736f9eb8137601779f60f526ea48c58c23 100644 (file)
@@ -1,64 +1,52 @@
 /**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
-* \r
+*\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
+*/ \r
 \r
 package eu.etaxonomy.cdm.api.service;\r
 \r
+import java.util.List;\r
+\r
 import org.apache.log4j.Logger;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.stereotype.Service;\r
 import org.springframework.transaction.annotation.Transactional;\r
 \r
+import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;\r
 import eu.etaxonomy.cdm.model.occurrence.Collection;\r
-import eu.etaxonomy.cdm.persistence.dao.collection.ICollectionDao;\r
-import java.util.List;\r
-import java.util.UUID;\r
-\r
+import eu.etaxonomy.cdm.persistence.dao.occurrence.ICollectionDao;\r
+import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;\r
 \r
 @Service\r
 @Transactional(readOnly = true)\r
-public class CollectionServiceImpl extends ServiceBase<Collection> implements ICollectionService {\r
-       static Logger logger = Logger.getLogger(CollectionServiceImpl.class);\r
-       \r
-       private ICollectionDao collectionDao;\r
+public class CollectionServiceImpl extends     IdentifiableServiceBase<Collection, ICollectionDao> implements  ICollectionService {\r
        \r
-       @Autowired\r
+       @SuppressWarnings("unused")\r
+       static private final Logger logger = Logger.getLogger(CollectionServiceImpl.class);\r
+\r
+    @Autowired\r
+       @Override\r
        protected void setDao(ICollectionDao dao) {\r
                this.dao = dao;\r
-               this.collectionDao = dao;\r
        }\r
 \r
-       public Collection getCollectionByUuid(UUID uuid) {\r
-               return super.getCdmObjectByUuid(uuid); \r
-       }\r
 \r
-       public List<Collection> searchCollectionByCode(String code) {\r
-               return collectionDao.getCollectionByCode(code);\r
+       @Override\r
+       @Transactional(readOnly = false)\r
+    public void updateTitleCache(Class<? extends Collection> clazz, Integer stepSize, IIdentifiableEntityCacheStrategy<Collection> cacheStrategy, IProgressMonitor monitor) {\r
+               if (clazz == null){\r
+                       clazz = Collection.class;\r
+               }\r
+               super.updateTitleCacheImpl(clazz, stepSize, cacheStrategy, monitor);\r
        }\r
-\r
-\r
\r
 \r
        \r
-\r
-       public void generateTitleCache() {\r
-               generateTitleCache(true);\r
-       }\r
-       //TODO\r
-       public void generateTitleCache(boolean forceProtected) {\r
-               logger.warn("generateTitleCache not yet fully implemented!");\r
-//             for (Collection tb : taxonDao.getAllTaxa(null,null)){\r
-//                     logger.warn("Old taxon title: " + tb.getTitleCache());\r
-//                     if (forceProtected || !tb.isProtectedTitleCache() ){\r
-//                             tb.setTitleCache(tb.generateTitle(), false);\r
-//                             taxonDao.update(tb);\r
-//                             logger.warn("New title: " + tb.getTitleCache());\r
-//                     }\r
-//             }\r
-               \r
+       public List<Collection> searchByCode(String code) {\r
+               return this.dao.getCollectionByCode(code);\r
        }\r
 }\r