cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Sun, 28 Jun 2020 18:48:51 +0000 (20:48 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Sun, 28 Jun 2020 18:51:53 +0000 (20:51 +0200)
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CacheLoader.java
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmTransientEntityCacher.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/cache/CdmCacher.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/utility/UserHelper.java

index 85de85fccb698de9b249ed1d23b65f4b06a5a717..ed97445e323f975789b5514bb13f5a3d8aa9a968 100644 (file)
@@ -177,6 +177,7 @@ public class CacheLoader {
         while(collectionItr.hasNext()) {
             Object obj = collectionItr.next();
             if(alreadyVisitedEntities == null) {
+                //AM: does this really ever happen?
                 result[count] = load(obj, false, update);
             } else {
                 result[count] = loadRecursive(obj, alreadyVisitedEntities, update);
@@ -295,7 +296,9 @@ public class CacheLoader {
         //TODO improve generics for deproxyOrNull, probably need to split the method
         @SuppressWarnings("unchecked")
         T deproxiedEntity = (T)ProxyUtils.deproxyOrNull(cdmEntity);
-        if(deproxiedEntity != null){
+        if(deproxiedEntity == null){
+            if (logger.isDebugEnabled()){logger.debug("ignoring uninitlialized proxy " + cdmEntity.getClass() + "#" + cdmEntity.getId());}
+        }else{
             String className = deproxiedEntity.getClass().getName();
             CdmModelFieldPropertyFromClass cmfpfc = getFromCdmlibModelCache(className);
             if(cmfpfc != null) {
@@ -321,8 +324,6 @@ public class CacheLoader {
                 throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " +
                         "The cache may be corrupted or not in sync with the latest model version" );
             }
-        } else { //deproxiedEntity == null
-            logger.debug("ignoring uninitlialized proxy " + cdmEntity.getClass() + "#" + cdmEntity.getId());
         }
 
         return cachedCdmEntity;
@@ -398,7 +399,7 @@ public class CacheLoader {
                 if(CdmBase.class.isAssignableFrom(obj.getClass())) {
                     logger.debug("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
 
-                    cdmEntityInSubGraph  = (CdmBase)obj;
+                    cdmEntityInSubGraph = (CdmBase)obj;
                     CdmBase cachedCdmEntityInSubGraph = cdmCacher.getFromCache(cdmEntityInSubGraph);
 
                     if(cachedCdmEntityInSubGraph != null) {
index f51ea1e29e2ee3e7e7a317de3d5b2b00c0d4f530..729a292901ea4d517d068153294469c77412c262 100644 (file)
@@ -342,7 +342,7 @@ public class CdmTransientEntityCacher implements ICdmCacher {
     }
 
     @Override
-    public boolean exists(CdmBase cdmBase) {
-        return exists(generateKey(cdmBase));
+    public boolean exists(CdmBase cdmEntity) {
+        return exists(generateKey(cdmEntity));
     }
 }
index a8c297b510bb76dba45f6841e55ac91a4f70b9f5..abf79fe5db374fa7507b21924d85a5de5f70d852 100644 (file)
@@ -20,7 +20,6 @@ import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
  *
  * @author cmathew
  */
-
 public abstract class CdmCacher implements ICdmUuidCacher {
 
     public static final Logger logger = Logger.getLogger(CdmCacher.class);
index 019f02fd4c4f98b82528f470c211723a602cbaf4..a84b5d4804c88e4547c8171fd04fb3b3959b8bf6 100644 (file)
@@ -31,11 +31,6 @@ import eu.etaxonomy.cdm.persistence.query.Grouping;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
 \r
-\r
-/**\r
- * @author a.mueller\r
- *\r
- */\r
 /**\r
  * @author a.kohlbecker\r
  * @since 23.03.2009\r
@@ -91,8 +86,6 @@ public interface IService<T extends ICdmBase>{
      */\r
     public DeleteResult delete(UUID persistentObjectUUID) ;\r
 \r
-\r
-\r
     /**\r
      * Returns true if an entity of type <T> with a unique identifier matching the\r
      * identifier supplied exists in the database, or false if no such entity can be\r
@@ -129,8 +122,6 @@ public interface IService<T extends ICdmBase>{
      */\r
     public T find(UUID uuid);\r
 \r
-\r
-\r
        /**\r
         * Return a persisted entity that matches the unique identifier\r
      * supplied as an argument, or null if the entity does not exist.\r
index c40d868777298d63af46746b537013a54b3daa7c..341396c70c110a81f68bd29236641d941c1702be 100644 (file)
@@ -25,7 +25,6 @@ import eu.etaxonomy.cdm.persistence.permission.CdmAuthority;
  *
  * @author a.kohlbecker
  * @since May 23, 2017
- *
  */
 public interface UserHelper {
 
@@ -51,7 +50,6 @@ public interface UserHelper {
     boolean userIs(RoleProbe roleProbe);
 
     /**
-     *
      * @param username
      * @param cdmEntity
      * @param crud
@@ -62,7 +60,6 @@ public interface UserHelper {
     public CdmAuthority createAuthorityFor(String username, CdmBase cdmEntity, EnumSet<CRUD> crud, String property);
 
     /**
-     *
      * @param username
      * @param cdmType
      * @param entitiyId
@@ -73,9 +70,7 @@ public interface UserHelper {
      */
     public CdmAuthority createAuthorityFor(String username, Class<? extends CdmBase> cdmType, Integer entitiyId, EnumSet<CRUD> crud, String property);
 
-
-    /**
-    *
+   /**
     * @param username
     * @param cdmType
     * @param entitiyUuid
@@ -86,7 +81,6 @@ public interface UserHelper {
     */
    public CdmAuthority createAuthorityFor(String username, Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property);
 
-
     /**
      * @param cdmType
      * @param entitiyId
@@ -116,46 +110,23 @@ public interface UserHelper {
 
     /**
      * Scans the currently authenticated user for CdmAuthorities which match the given parameters
-     *
-     * @param cdmEntity
-     * @param crud
-     * @return
      */
     public Collection<CdmAuthority> findUserPermissions(CdmBase cdmEntity, EnumSet<CRUD> crud);
 
     /**
      * Scans the currently authenticated user for CdmAuthorities which match the given parameters
-     *
-     * @param cdmType
-     * @param crud
-     * @return
      */
     public <T extends CdmBase> Collection<CdmAuthority> findUserPermissions(Class<T> cdmType, EnumSet<CRUD> crud);
 
-    /**
-     * @param newAuthority
-     */
     public void removeAuthorityForCurrentUser(CdmAuthority newAuthority);
 
-    /**
-     * @param username
-     * @param newAuthority
-     */
     public void removeAuthorityForCurrentUser(String username, CdmAuthority newAuthority);
 
-    /**
-     *
-     */
     public void logout();
 
     void setSecurityContextAccess(SecurityContextAccess securityContextAccess);
 
-    /**
-     * @return
-     */
     public Authentication getAuthentication();
 
     public CdmUserHelper withCache(ICdmEntityUuidCacher iCdmCacher);
-
-
 }