Deprecate getCharacterData method in service layer
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IdentifiableServiceBase.java
index 8d9115afe4912a8155e6eb9ccadfcf13158986b9..de1dd9fb4ef2165d3123bc5bf8f08f03f4429b39 100644 (file)
@@ -306,11 +306,12 @@ public abstract class IdentifiableServiceBase<T extends IdentifiableEntity, DAO
         * @param entitiesToUpdate
         * @param entity
         */
         * @param entitiesToUpdate
         * @param entity
         */
+       @SuppressWarnings("unchecked")
        private void updateTitleCacheForSingleEntity(
                        IIdentifiableEntityCacheStrategy<T> cacheStrategy,
                        List<T> entitiesToUpdate, T entity) {
 
        private void updateTitleCacheForSingleEntity(
                        IIdentifiableEntityCacheStrategy<T> cacheStrategy,
                        List<T> entitiesToUpdate, T entity) {
 
-               assert (entity.isProtectedTitleCache() == false );
+               //assert (entity.isProtectedTitleCache() == false );
 
                //exclude recursive inreferences
                if (entity.isInstanceOf(Reference.class)){
 
                //exclude recursive inreferences
                if (entity.isInstanceOf(Reference.class)){
@@ -330,14 +331,15 @@ public abstract class IdentifiableServiceBase<T extends IdentifiableEntity, DAO
                                entityCacheStrategy = ReferenceFactory.newReference(((Reference<?>)entity).getType()).getCacheStrategy();
                        }
                }
                                entityCacheStrategy = ReferenceFactory.newReference(((Reference<?>)entity).getType()).getCacheStrategy();
                        }
                }
-               entity.setCacheStrategy(entityCacheStrategy);
+               
 
 
                //old titleCache
                entity.setProtectedTitleCache(true);
 
 
                //old titleCache
                entity.setProtectedTitleCache(true);
+               
                String oldTitleCache = entity.getTitleCache();
                entity.setTitleCache(oldTitleCache, false);   //before we had entity.setProtectedTitleCache(false) but this deleted the titleCache itself
                String oldTitleCache = entity.getTitleCache();
                entity.setTitleCache(oldTitleCache, false);   //before we had entity.setProtectedTitleCache(false) but this deleted the titleCache itself
-
+               entity.setCacheStrategy(entityCacheStrategy);
                //NonViralNames and Reference have more caches //TODO handle in NameService
                String oldNameCache = null;
                String oldFullTitleCache = null;
                //NonViralNames and Reference have more caches //TODO handle in NameService
                String oldNameCache = null;
                String oldFullTitleCache = null;
@@ -387,6 +389,7 @@ public abstract class IdentifiableServiceBase<T extends IdentifiableEntity, DAO
                if ( oldTitleCache == null   || oldTitleCache != null && ! oldTitleCache.equals(newTitleCache) ){
                        entity.setTitleCache(null, false);
                        String newCache = entity.getTitleCache();
                if ( oldTitleCache == null   || oldTitleCache != null && ! oldTitleCache.equals(newTitleCache) ){
                        entity.setTitleCache(null, false);
                        String newCache = entity.getTitleCache();
+                       
                        if (newCache == null){
                                logger.warn("newCache should never be null");
                        }
                        if (newCache == null){
                                logger.warn("newCache should never be null");
                        }