added polytomous key tests and initial developments on caching
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 20 Oct 2014 11:05:56 +0000 (11:05 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 20 Oct 2014 11:05:56 +0000 (11:05 +0000)
15 files changed:
.gitattributes
.gitignore
eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CachedCommonServiceImpl.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmEntityCacheManager.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmTransientEntityCacher.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/ICachedCommonService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/LazyLoadingCachingUtils.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/.svnignore [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.readPolytmousKeyData.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.remoting/src/test/resources/log4j.properties [new file with mode: 0644]

index 628081ab6d0cc78495ddf043a151e25951c61ffd..26a406a13f9c874c2e205bd71de9a9a27b494606 100644 (file)
@@ -1011,7 +1011,12 @@ eu.etaxonomy.taxeditor.remoting/lib/.svnignore -text
 eu.etaxonomy.taxeditor.remoting/pom.xml -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CachedCommonServiceImpl.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmEntityCacheManager.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmTransientEntityCacher.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/ICachedCommonService.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/LazyLoadingCachingUtils.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java -text
@@ -1020,6 +1025,7 @@ eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemote
 eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/taxeditor/remoting/RemotingTestPluginActivator.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text
 eu.etaxonomy.taxeditor.remoting/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java -text
+eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/.svnignore -text
 eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/jetty-runner-9.2.3.v20140905.jar -text
 eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/start-9.2.3.v20140905.jar -text
 eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/config.properties -text
@@ -1028,23 +1034,30 @@ eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/localApplica
 eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml -text
 eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remoting_persistence_security.xml -text
 eu.etaxonomy.taxeditor.remoting/src/main/resources/eu/etaxonomy/cdm/remoting_services_security.xml -text
+eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/exception/CDMServerException.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmPersistentRemoteSourceTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTest.java -text
+eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/HttpInvokerServicesTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java -text
+eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/datasources.xml -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
+eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.readPolytmousKeyData.xml -text
+eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.xml -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
+eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/h2/cdmTest.h2.db -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/h2/cdmTest.trace.db -text
+eu.etaxonomy.taxeditor.remoting/src/test/resources/log4j.properties -text
 eu.etaxonomy.taxeditor.remoting/src/test/resources/unitils.properties -text
 eu.etaxonomy.taxeditor.store/.classpath -text
 eu.etaxonomy.taxeditor.store/.project -text
index dc0d24ec9501ecc7c61e1e3bc94ff80c3793a4df..000adc05f15f4ef02806aa2daf2685871378c5ee 100644 (file)
@@ -35,6 +35,7 @@ eu.etaxonomy.taxeditor.remoting/*.log
 eu.etaxonomy.taxeditor.remoting/.settings
 eu.etaxonomy.taxeditor.remoting/lib
 eu.etaxonomy.taxeditor.remoting/lib/*.jar
+eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/cdmlib-remote-webapp.war
 eu.etaxonomy.taxeditor.remoting/target
 eu.etaxonomy.taxeditor.store/.settings
 eu.etaxonomy.taxeditor.store/hibernate.log
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CachedCommonServiceImpl.java b/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CachedCommonServiceImpl.java
new file mode 100644 (file)
index 0000000..519025d
--- /dev/null
@@ -0,0 +1,198 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.api.cache;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.hibernate.collection.internal.PersistentList;
+import org.hibernate.collection.internal.PersistentMap;
+import org.hibernate.collection.internal.PersistentSet;
+import org.hibernate.collection.internal.PersistentSortedMap;
+import org.hibernate.collection.internal.PersistentSortedSet;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.cache.LazyLoadingCachingUtils.CollectionType;
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+@Component
+public class CachedCommonServiceImpl implements ICachedCommonService {
+
+
+    @Autowired
+    private ICommonService commonService;
+
+    private static boolean cacheEnabled = true;
+
+    @Autowired
+    private CdmEntityCacheManager cdmEntityCacheManager;
+
+    @Autowired
+    private LazyLoadingCachingUtils lazyLoadingCachingUtils;
+
+
+    public static boolean isCacheEnabled() {
+        return cacheEnabled;
+    }
+
+    public static void setCacheEnabled(boolean cacheEnabled) {
+        CachedCommonServiceImpl.cacheEnabled = cacheEnabled;
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#find(java.lang.Class, int)
+     */
+    @Override
+    public CdmBase find(Class<? extends CdmBase> clazz, int id){
+        if(cacheEnabled) {
+            CdmBase cdmEntity = cdmEntityCacheManager.getCdmTransientEntityCacher().getFromCache(clazz, id);
+            if(cdmEntity != null) {
+                return cdmEntity;
+            } else {
+                cdmEntity = commonService.find(clazz, id);
+                cdmEntity = cdmEntityCacheManager.getCdmTransientEntityCacher().put(clazz, id, cdmEntity);
+                return cdmEntity;
+            }
+        } else {
+            return commonService.find(clazz, id);
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#initializeCollection(org.hibernate.collection.spi.PersistentCollection)
+     */
+    @Override
+    public PersistentCollection initializeCollection(PersistentCollection col) {
+            PersistentCollection pc = commonService.initializeCollection(col);
+
+            return pc;
+    }
+
+    @Override
+    public void updatePersistentCollection(CollectionField colf) {
+        switch(colf.getType()) {
+        case MAP:
+            lazyLoadingCachingUtils.updatePersistentCollection((Map)colf.getCollection());
+        case SET:
+        case LIST:
+        default:
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#isEmpty(org.hibernate.collection.spi.PersistentCollection)
+     */
+    @Override
+    public boolean isEmpty(PersistentCollection col) {
+            return commonService.isEmpty(col);
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#size(org.hibernate.collection.spi.PersistentCollection)
+     */
+    @Override
+    public int size(PersistentCollection col) {
+        return commonService.size(col);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#get(org.hibernate.collection.spi.PersistentCollection, int)
+     */
+    @Override
+    public Object get(PersistentCollection col, int index) {
+        return commonService.get(col, index);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#contains(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+     */
+    @Override
+    public boolean contains(PersistentCollection col, Object element) {
+        return commonService.contains(col, element);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsKey(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+     */
+    @Override
+    public boolean containsKey(PersistentCollection col, Object key) {
+        return commonService.containsKey(col, key);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsValue(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+     */
+    @Override
+    public boolean containsValue(PersistentCollection col, Object element) {
+        return commonService.containsValue(col, element);
+    }
+
+    @Override
+    public CollectionField getCollectionField(PersistentCollection pc) {
+        if(pc != null) {
+            if(pc instanceof PersistentSet) {
+                return new CollectionField(new HashSet((Set)pc), CollectionType.SET);
+            }
+            if(pc instanceof PersistentSortedSet) {
+                return new CollectionField(new TreeSet((Set)pc), CollectionType.SET);
+            }
+            if(pc instanceof PersistentList) {
+                return new CollectionField(new ArrayList((List)pc), CollectionType.LIST);
+            }
+            if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
+                return new CollectionField(new HashMap((Map)pc), CollectionType.MAP);
+            }
+            if(pc instanceof PersistentSortedMap) {
+                return new CollectionField(new TreeMap((Map)pc), CollectionType.MAP);
+            }
+        }
+        return null;
+    }
+
+    public class CollectionField {
+        private final Object col;
+        private final CollectionType type;
+        public CollectionField(Object col, CollectionType type) {
+            this.col = col;
+            this.type = type;
+        }
+
+        public Object getCollection() {
+            return this.col;
+        }
+
+        public CollectionType getType() {
+            return this.type;
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmEntityCacheManager.java b/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmEntityCacheManager.java
new file mode 100644 (file)
index 0000000..46d0888
--- /dev/null
@@ -0,0 +1,30 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.api.cache;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2014
+ *
+ */
+@Component
+public class CdmEntityCacheManager {
+
+    @Autowired
+    private CdmTransientEntityCacher cdmTransientEntityCacher;
+
+
+    public CdmTransientEntityCacher getCdmTransientEntityCacher() {
+        return cdmTransientEntityCacher;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmTransientEntityCacher.java b/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/CdmTransientEntityCacher.java
new file mode 100644 (file)
index 0000000..c53c2e9
--- /dev/null
@@ -0,0 +1,179 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.api.cache;
+
+import java.util.UUID;
+
+import org.springframework.stereotype.Component;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+@Component
+public class CdmTransientEntityCacher<T extends CdmBase> extends CdmServiceCacher<T> {
+
+    private static final String ENTITY_CACHE_NAME = "entityCache";
+
+    public CdmTransientEntityCacher() {
+     // Create entity cache
+        getDefaultCacheManager().addCache(new Cache(getEntityCacheConfiguration()));
+    }
+    /**
+     * Returns the default cache configuration.
+     *
+     * @return
+     */
+    private CacheConfiguration getEntityCacheConfiguration() {
+        // For a better understanding on how to size caches, refer to
+        // http://ehcache.org/documentation/configuration/cache-size
+        return new CacheConfiguration(ENTITY_CACHE_NAME, 500)
+        .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
+        .eternal(false)
+        // default ttl and tti set to 2 hours
+        .timeToLiveSeconds(60*60*2)
+        .timeToIdleSeconds(60*60*2);
+        // This is 2.6.9 API
+        //.maxEntriesLocalDisk(1000);
+        //.persistence(new PersistenceConfiguration().strategy(Strategy.LOCALTEMPSWAP));
+    }
+
+    /**
+     * Returns the cache corresponding to the cache id
+     *
+     * @param cacheId
+     * @return
+     */
+    private static Cache getCache() {
+        return getDefaultCacheManager().getCache(ENTITY_CACHE_NAME);
+    }
+
+
+    /**
+     * Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}),
+     * in the cache corresponding to the given cache id
+     *
+     * @param cacheId
+     * @param uuid
+     * @param cdmEntity
+     */
+    public T put(String id, T cdmEntity) {
+        T cachedCdmEntity = getFromCache(cdmEntity.getUuid());
+        cachedCdmEntity = (cachedCdmEntity == null) ? getFromCache(id) : cachedCdmEntity;
+        if(cachedCdmEntity != null) {
+            return cachedCdmEntity;
+        } else {
+            getCache().put(new Element(id, cdmEntity));
+            return cdmEntity;
+        }
+    }
+
+    @Override
+    public T put(UUID uuid, T cdmEntity) {
+        T cachedCdmEntity = getFromCache(cdmEntity.getUuid());
+        cachedCdmEntity = (cachedCdmEntity == null) ? getFromCache(uuid) : cachedCdmEntity;
+        if(cachedCdmEntity != null) {
+            return cachedCdmEntity;
+        } else {
+            getCache().put(new Element(uuid, cdmEntity));
+            return cdmEntity;
+        }
+    }
+
+    public T put(Class<? extends CdmBase> clazz, int id, T cdmEntity) {
+        String cacheId = generateId(clazz,id);
+        return put(cacheId, cdmEntity);
+    }
+
+    /**
+     * Gets the cache element corresponding to the given {@link java.util.UUID}
+     * in the cache corresponding to the given cache id.
+     *
+     * @param uuid
+     * @return
+     */
+    @Override
+    protected Element getCacheElement(UUID uuid) {
+        return getCache().get(uuid);
+    }
+
+    private Element getCacheElement(String id) {
+        return getCache().get(id);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.model.ICdmCacher#getFromCache(java.util.UUID)
+     */
+    @Override
+    public T getFromCache(UUID uuid) {
+        Element e = getCacheElement(uuid);
+        e = (getCacheElement(uuid) == null) ? super.getCacheElement(uuid) : e;
+        if (e == null) {
+            return null;
+        } else {
+            return(T)e.getObjectValue();
+        }
+    }
+
+    public  T getFromCache(String id) {
+        Element e = getCacheElement(id);
+        if (e == null) {
+            return null;
+        } else {
+            return (T) e.getObjectValue();
+        }
+    }
+
+
+    public T getFromCache(Class<? extends CdmBase> clazz, int id) {
+        String cacheId = generateId(clazz,id);
+        return getFromCache(cacheId);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.model.ICdmCacher#exists(java.util.UUID)
+     */
+    @Override
+    public boolean exists(UUID uuid) {
+        return (getCacheElement(uuid) != null || super.getCacheElement(uuid) != null);
+    }
+
+    public boolean exists(String id) {
+        return (getCacheElement(id) != null);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.model.ICdmCacher#existsAndIsNotNull(java.util.UUID)
+     */
+    @Override
+    public boolean existsAndIsNotNull(UUID uuid) {
+        return getFromCache(uuid) != null;
+    }
+
+    public boolean existsAndIsNotNull(String id) {
+        return getFromCache(id) != null;
+    }
+
+
+    private static String generateId(Class<? extends CdmBase> clazz, int id) {
+        return clazz.getName() + String.valueOf(id);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/ICachedCommonService.java b/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/ICachedCommonService.java
new file mode 100644 (file)
index 0000000..10d02bf
--- /dev/null
@@ -0,0 +1,45 @@
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.cdm.api.cache;
+
+import org.hibernate.collection.internal.PersistentMap;
+import org.hibernate.collection.spi.PersistentCollection;
+
+import eu.etaxonomy.cdm.api.cache.CachedCommonServiceImpl.CollectionField;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+public interface ICachedCommonService {
+
+    public CdmBase find(Class<? extends CdmBase> clazz, int id);
+
+    public PersistentCollection initializeCollection(PersistentCollection col);
+
+    public void updatePersistentCollection(CollectionField colf);
+
+    public boolean isEmpty(PersistentCollection col);
+
+    public int size(PersistentCollection col);
+
+    public Object get(PersistentCollection col, int index);
+
+    public boolean contains(PersistentCollection col, Object element);
+
+    public boolean containsKey(PersistentCollection col, Object key);
+
+    public boolean containsValue(PersistentCollection col, Object element);
+
+    public CollectionField getCollectionField(PersistentCollection pc);
+
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/LazyLoadingCachingUtils.java b/eu.etaxonomy.taxeditor.remoting/src/main/java/eu/etaxonomy/cdm/api/cache/LazyLoadingCachingUtils.java
new file mode 100644 (file)
index 0000000..64d0099
--- /dev/null
@@ -0,0 +1,77 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.api.cache;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.hibernate.collection.internal.PersistentMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 15 Oct 2014
+ *
+ */
+@Component
+public class LazyLoadingCachingUtils {
+
+    @Autowired
+    private CdmEntityCacheManager cdmEntityCacheManager;
+
+    public static enum CollectionType {
+        SET,
+        LIST,
+        MAP;
+
+        @Override
+        public String toString() {
+            return this.name().toLowerCase();
+        }
+    }
+
+    public void updatePersistentCollection(Map map) {
+        if(map == null || map.isEmpty()) {
+            return;
+        }
+
+        int originalMapSize = map.size();
+        Object[] result = new Object[ map.size() * 2 ];
+        Iterator iter = map.entrySet().iterator();
+        int i=0;
+        while ( iter.hasNext() ) {
+            Map.Entry e = (Map.Entry) iter.next();
+            result[i++] = e.getKey();
+            result[i++] = e.getValue();
+        }
+
+        for(i=0; i<result.length;i++) {
+            if(result[i] instanceof CdmBase) {
+                CdmBase cdmBase = (CdmBase)result[i];
+                CdmBase cachedCdmBase = cdmEntityCacheManager.getCdmTransientEntityCacher().put(cdmBase.getClass(),cdmBase.getId(), cdmBase);
+                result[i] = cachedCdmBase;
+            }
+        }
+        map.clear();
+        for(i = 0; i < originalMapSize; i+=2 ) {
+            map.put(
+                    result[i],
+                    result[i+1]
+                );
+        }
+
+    }
+
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/.svnignore b/eu.etaxonomy.taxeditor.remoting/src/main/resources/etc/jetty/.svnignore
new file mode 100644 (file)
index 0000000..a09ae97
--- /dev/null
@@ -0,0 +1 @@
+cdmlib-remote-webapp.war
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java b/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java
new file mode 100644 (file)
index 0000000..93b21d7
--- /dev/null
@@ -0,0 +1,281 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.polytomouskey;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.cache.CachedCommonServiceImpl;
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Credit;
+import eu.etaxonomy.cdm.model.common.Extension;
+import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.media.Rights;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
+
+/**
+ * @author cmathew
+ * @date 7 Oct 2014
+ *
+ */
+@DataSet
+public class PolytomousKeyTest extends BaseRemotingTest {
+
+    private static final Logger logger = Logger.getLogger(PolytomousKeyTest.class);
+
+    UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
+    UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
+
+
+    IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+    ICommonService commonService = getRemoteApplicationController().getCommonService();
+    ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+
+    Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+    @BeforeClass
+    public static void initializePolytomousKeyTest() {
+        logger.setLevel(Level.INFO);
+        CDMServer.getInstance().setKeepServerRunning(true);
+
+        initializeController("default", "127.0.0.1", 8080, "", NomenclaturalCode.ICNAFP);
+    }
+
+    @Test
+    public void readAllPolytomousKeys() {
+        List<PolytomousKey> pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+        for(PolytomousKey pKey : pKeys) {
+            logger.info("Polytomous Key : " + pKey.getTitleCache());
+        }
+    }
+
+
+    @Test
+    //@DataSet("PolytomousKeyTest.readPolytmousKeyData.xml")
+    public void readPolytmousKeyData() {
+        PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        Set<Taxon> taxonomicScope = pKey.getTaxonomicScope();
+        Iterator<Taxon> tsItr = taxonomicScope.iterator();
+        Taxon taxon = tsItr.next();
+        logger.info("taxonomic scope : " + taxon.getTitleCache());
+        Assert.assertEquals(taxon.getTitleCache(), "Achillea cretica L. sec. Cyprus");
+        taxon = tsItr.next();
+        logger.info("taxonomic scope : " + taxon.getTitleCache());
+        Assert.assertEquals(taxon.getTitleCache(), "Achillea sec. Cyprus");
+        Assert.assertEquals(tsItr.hasNext(), false);
+
+        List<Credit> credits = pKey.getCredits();
+        AgentBase agent = credits.get(0).getAgent();
+        Assert.assertEquals(agent.getId(),4809);
+        Assert.assertEquals(agent.getTitleCache(),"R. A. Graham");
+        Assert.assertEquals(credits.get(0).getText(),"Credits Text Test");
+
+        Set<Extension> exts = pKey.getExtensions();
+        Iterator<Extension> extItr = exts.iterator();
+        Extension ext = extItr.next();
+        Assert.assertEquals(ext.getValue(), "http://test.com");
+
+        Set<Rights> rights = pKey.getRights();
+        Iterator<Rights> rightsItr = rights.iterator();
+        Rights right = rightsItr.next();
+        Assert.assertEquals(right.getText(),"Rights Text Test");
+
+        Set<IdentifiableSource> sources = pKey.getSources();
+        Iterator<IdentifiableSource> sourcesItr = sources.iterator();
+        IdentifiableSource source = sourcesItr.next();
+        Assert.assertEquals(source.getId(), 23710);
+        source = sourcesItr.next();
+        Assert.assertEquals(source.getId(), 23711);
+
+        // TO DO : Added tests for Annotations , Markers
+    }
+
+    @Test
+    public void readPolytomousKeyDataFromNodes() {
+        PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode rootNode = pKey.getRoot();
+
+
+        Assert.assertEquals(rootNode.getId(), 2750);
+
+        Assert.assertEquals(rootNode.getChildAt(0).getId(), 2751);
+        Assert.assertEquals(rootNode.getChildAt(0).getParent().getId(), rootNode.getId());
+        Assert.assertEquals(rootNode.getKey().getId(), pKey.getId());
+        Integer sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(0), "sortIndex");
+        Assert.assertEquals(sortIndex, new Integer(0));
+        String statement = "Capitula without ligulate ray-florets; leaves entire or subentire";
+        Assert.assertEquals(rootNode.getChildAt(0).getStatement().getLabelText(english), statement);
+
+        Assert.assertEquals(rootNode.getChildAt(1).getId(), 2753);
+        Assert.assertEquals(rootNode.getChildAt(1).getParent().getId(), rootNode.getId());
+        Assert.assertEquals(rootNode.getChildAt(1).getKey().getId(), pKey.getId());
+        sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1), "sortIndex");
+        Assert.assertEquals(sortIndex, new Integer(1));
+        statement = "Capitula with ligulate ray-florets; leaves pinnatisect";
+        Assert.assertEquals(rootNode.getChildAt(1).getStatement().getLabelText(english), statement);
+
+        Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getId(), 2754);
+        Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getParent().getId(), rootNode.getChildAt(1).getId());
+        Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getKey().getId(), pKey.getId());
+        sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1).getChildAt(0), "sortIndex");
+        Assert.assertEquals(sortIndex, new Integer(0));
+        statement = "Ray-florets yellow";
+        Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getStatement().getLabelText(english), statement);
+        Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
+    }
+
+    @Test
+    public void savePolytomousKeyNodeData() {
+        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode pkeynode = pkey.getRoot();
+        String newQuestion = "New Question";
+        String newStatement = "New Statement";
+
+        Assert.assertEquals("Question 1",pkeynode.getQuestion().getLabel().get(english).getText());
+        for(PolytomousKeyNode node : pkeynode.getChildren()) {
+
+            node.setQuestion(null);
+            node.setStatement(null);
+        }
+        //FIXME: Add tests for feature after fixing problem
+
+        //Feature feature = pkeynode.getFeature();
+        //Assert.assertEquals(feature.getTitleCache(),"Systematics");
+        //pkeynode.setFeature(null);
+
+        Assert.assertEquals(pkeynode.getChildAt(0).getModifyingText().get(english).getText(),"Modifying Text 1a");
+        String modifyingText = "Modifying Text 1a updated";
+
+        //pkeynode.getChildAt(0).putModifyingText(english, modifyingText);
+
+        Assert.assertEquals(pkeynode.getChildAt(0).getSubkey().getId(),751);
+        Assert.assertEquals(pkeynode.getChildAt(0).getSubkey().getTitleCache(),"Asphodeline");
+        Assert.assertNull(pkeynode.getChildAt(1).getTaxon());
+        Taxon taxon = CdmBase.deproxy(taxonService.find(taxon1Uuid),Taxon.class);
+        pkeynode.getChildAt(1).setTaxon(taxon);
+
+        polytomousKeyService.merge(pkey);
+
+        pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        pkeynode = pkey.getRoot();
+        for(PolytomousKeyNode node : pkeynode.getChildren()) {
+            Assert.assertNull(node.getQuestion());
+            node.setQuestion(KeyStatement.NewInstance(english,newQuestion));
+            Assert.assertNull(node.getStatement());
+            node.setStatement(KeyStatement.NewInstance(english,newStatement));
+        }
+        //Assert.assertNull(pkeynode.getFeature());
+        //pkeynode.setFeature(feature);
+
+        //Assert.assertEquals(pkeynode.getChildAt(0).getModifyingText().get(english).getText(),modifyingText);
+        Assert.assertEquals(pkeynode.getChildAt(1).getTaxon(), taxon);
+
+        polytomousKeyService.merge(pkey);
+
+        pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        pkeynode = pkey.getRoot();
+        for(PolytomousKeyNode node : pkeynode.getChildren()) {
+            Assert.assertNotNull(node.getQuestion());
+            Map<Language, LanguageString> label = node.getQuestion().getLabel();
+            Assert.assertEquals(newQuestion, label.get(english).getText());
+            Assert.assertNotNull(node.getStatement());
+            Assert.assertEquals(newStatement, node.getStatement().getLabel(english).getText());
+        }
+        //Assert.assertEquals(pkeynode.getFeature().getId(), feature.getId());
+
+    }
+
+    @Test
+    public void savePolytomousKeyNodeDataWithSameSubKey() {
+        //CachedCommonServiceImpl.setCacheEnabled(false);
+        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode pkeynode = pkey.getRoot();
+
+        PolytomousKey subkey1 = pkeynode.getChildAt(0).getSubkey();
+        String subkey1title = subkey1.getTitleCache();
+        subkey1.setTitleCache(subkey1title + "test", true);
+
+
+        PolytomousKey subkey2 = pkeynode.getChildAt(1).getChildAt(0).getSubkey();
+        String subkey2title = subkey2.getTitleCache();
+        subkey2.setTitleCache(subkey2title + "test", true);
+
+        Assert.assertNotSame(subkey1, subkey2);
+
+
+        polytomousKeyService.merge(pkey);
+    }
+
+    @Test
+    public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() {
+        CachedCommonServiceImpl.setCacheEnabled(false);
+        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode pkeynode = pkey.getRoot();
+
+        PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
+        PolytomousKeyNode childNode0 = (PolytomousKeyNode)commonService.get(children, 0);
+        PolytomousKey subkey1 = CdmBase.deproxy(childNode0.getSubkey(),PolytomousKey.class);
+        String subkey1title = subkey1.getTitleCache();
+        subkey1.setTitleCache(subkey1title + "test", true);
+
+        PolytomousKeyNode childNode1 = (PolytomousKeyNode)commonService.get(children, 1);
+        PolytomousKey subkey2 = CdmBase.deproxy(childNode1.getSubkey(),PolytomousKey.class);
+        String subkey2title = subkey2.getTitleCache();
+        subkey2.setTitleCache(subkey2title + "test", true);
+
+        Assert.assertNotSame(subkey1, subkey2);
+
+        polytomousKeyService.merge(pkey);
+    }
+
+
+    @Test
+    public void savePolytomousKeyNodeDataWithSameLanguageInLabel() {
+        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode pkeynode = pkey.getRoot();
+
+        Map<Language, LanguageString> label1 = pkeynode.getQuestion().getLabel();
+        label1.size();
+        //Language lang1 = label1.get(english).getLanguage();
+        //String title1 = lang1.getTitleCache();
+
+        Map<Language, LanguageString> label2 = pkeynode.getChildAt(0).getStatement().getLabel();
+        label2.size();
+        //Language lang2 = label2.get(english).getLanguage();
+        //String title2 = lang2.getTitleCache();
+
+        polytomousKeyService.merge(pkey);
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java b/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java
new file mode 100644 (file)
index 0000000..503cab4
--- /dev/null
@@ -0,0 +1,41 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.httpinvoker;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.UnitilsJUnit4;
+
+import eu.etaxonomy.taxeditor.lazyloading.AbstractLazyInitializerTest;
+
+/**
+ * @author cmathew
+ * @date 6 Oct 2014
+ *
+ */
+public class CdmServerTestManager extends UnitilsJUnit4 {
+    private static final Logger logger = Logger.getLogger(CdmServerTestManager.class);
+
+
+    @Test
+    public void stopCdmServer() {
+        Logger.getRootLogger().setLevel(Level.INFO);
+        CDMServer.getInstance().setKeepServerRunning(true);
+        try {
+            CDMServer.getInstance().stop();
+        } catch (Exception e) {
+            Assert.fail("Server could not be stopped. Reason : " + e.getMessage());
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java b/eu.etaxonomy.taxeditor.remoting/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java
new file mode 100644 (file)
index 0000000..f995499
--- /dev/null
@@ -0,0 +1,89 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.lazyloading;
+
+import java.util.UUID;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2014
+ *
+ */
+public class CdmEntityCacherTest extends BaseRemotingTest {
+
+    private static final Logger logger = Logger.getLogger(CdmEntityCacherTest.class);
+
+    UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
+    UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
+
+
+    IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+    ICommonService commonService = getRemoteApplicationController().getCommonService();
+    ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+
+    Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+    @BeforeClass
+    public static void initializePolytomousKeyTest() {
+        logger.setLevel(Level.INFO);
+        CDMServer.getInstance().setKeepServerRunning(true);
+
+        initializeController("default", "127.0.0.1", 8080, "", NomenclaturalCode.ICNAFP);
+    }
+
+    @Test
+    public void testSimpleCache() {
+
+
+    }
+
+    @Test
+    public void testCachingCdmEntities() {
+        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+        PolytomousKeyNode pkeynode = pkey.getRoot();
+
+        PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
+        PolytomousKeyNode childNode0 = (PolytomousKeyNode)commonService.get(children, 0);
+        PolytomousKey subkey1 = CdmBase.deproxy(childNode0.getSubkey(),PolytomousKey.class);
+        String subkey1title = subkey1.getTitleCache();
+        subkey1.setTitleCache(subkey1title + "test", true);
+
+        PolytomousKeyNode childNode1 = (PolytomousKeyNode)commonService.get(children, 1);
+        PolytomousKey subkey2 = CdmBase.deproxy(childNode1.getSubkey(),PolytomousKey.class);
+        String subkey2title = subkey2.getTitleCache();
+        subkey2.setTitleCache(subkey2title + "test", true);
+
+        Assert.assertNotSame(subkey1, subkey2);
+
+        polytomousKeyService.merge(pkey);
+
+
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.readPolytmousKeyData.xml b/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.readPolytmousKeyData.xml
new file mode 100644 (file)
index 0000000..293407c
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  generated by Jailer 4.3, Wed Oct 08 17:58:52 CEST 2014 from cmathew@cmbgbm-t530
+  
+  Extraction Model:  PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-58-33-987.csv)
+  Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
+  Database User:     root
+  
+  Exported Rows:     60
+      AgentBase                      1
+      Credit                         1
+      Extension                      1
+      KeyStatement                   10
+      KeyStatement_LanguageString    10
+      LanguageString                 10
+      OriginalSourceBase             2
+      PolytomousKey                  1
+      PolytomousKeyNode              10
+      PolytomousKey_Credit           1
+      PolytomousKey_Extension        1
+      PolytomousKey_OriginalSourceBase 2
+      PolytomousKey_RightsInfo       1
+      PolytomousKey_Taxon            2
+      RightsInfo                     1
+      TaxonBase                      6
+  
+--><dataset>
+  <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="24"/>
+
+  <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="23" sortIndex="0"/>
+
+  <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="14574" created="2014-10-07 16:11:55.0" uuid="e5587acc-d437-4f7a-89be-eb53bf07a5a8" text="New Question" language_id="124"/>
+  <LanguageString id="14575" created="2014-10-07 16:11:55.0" uuid="82bc5779-7985-4507-bdd2-92696f528e25" text="New Question" language_id="124"/>
+
+  <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="32" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="35" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="36" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. &amp; Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="37" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="40" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="41" sec_id="10" publish="true"/>
+
+  <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+  <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="36"/>
+
+  <RightsInfo id="25" created="2014-10-08 13:52:22.0" uuid="d7e7d422-899e-4212-8261-4f50b928c256" updated="2014-10-08 13:52:58.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="12404" type_id="2056"/>
+
+  <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" createdby_id="30" updatedby_id="30" key_id="1550"/>
+  <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" question_id="2764" statement_id="2467" subkey_id="751" taxon_id="37" parent_id="2750"/>
+  <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+  <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2765" statement_id="2460" parent_id="2750"/>
+  <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2461" parent_id="2753"/>
+  <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+  <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+  <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2464" parent_id="2753"/>
+  <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+  <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+  <Credit id="23" created="2014-10-08 13:51:29.0" uuid="dd57ac87-ce85-49f3-a2ea-851fec1725f2" updated="2014-10-08 13:52:58.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+  <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2764" created="2014-10-07 16:11:55.0" uuid="33a3cc78-618e-401f-9e2d-cc41fb179516"/>
+  <KeyStatement id="2765" created="2014-10-07 16:11:55.0" uuid="c1e05068-e463-47d4-b3d4-4d5297afdb8b"/>
+
+  <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+  <Extension id="24" created="2014-10-08 13:52:03.0" uuid="4b92254d-8afe-409a-839e-04054324064a" updated="2014-10-08 13:52:58.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+  <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="25"/>
+
+  <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2764" label_id="14574" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2765" label_id="14575" label_mapkey_id="124"/>
+
+  <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" createdby_id="30" updatedby_id="30" root_id="2750" startNumber="1"/>
+
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="1730" sourceType="PTS"/>
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="50" sourceType="PTS"/>
+
+  
+</dataset>
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.xml b/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.xml
new file mode 100644 (file)
index 0000000..ba23175
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+  
+  Extraction Model:  PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+  Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
+  Database User:     root
+  
+  Exported Rows:     79
+      AgentBase                      1
+      Credit                         1
+      DefinedTermBase                1
+      Extension                      1
+      KeyStatement                   10
+      KeyStatement_LanguageString    10
+      LanguageString                 19
+      OriginalSourceBase             2
+      PolytomousKey                  2
+      PolytomousKeyNode              10
+      PolytomousKeyNode_LanguageString 9
+      PolytomousKey_Credit           1
+      PolytomousKey_Extension        1
+      PolytomousKey_OriginalSourceBase 2
+      PolytomousKey_RightsInfo       1
+      PolytomousKey_Taxon            1
+      RightsInfo                     1
+      TaxonBase                      6
+  
+--><dataset>
+  <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+  <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+  <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+  <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="" language_id="124"/>
+  <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+  <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+
+  <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. &amp; Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+  <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+  <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4808" type_id="2056"/>
+
+  <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2760"/>
+  <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="751" taxon_id="37" parent_id="2750"/>
+  <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+  <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2761" statement_id="2460"  subkey_id="751" parent_id="2750"/>
+  <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2461" subkey_id="751" parent_id="2753"/>
+  <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+  <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+  <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2464" parent_id="2753"/>
+  <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+  <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+  <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+  <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+  <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+  <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+  <DefinedTermBase DTYPE="Language" id="124" created="2010-12-21 15:09:09.0" uuid="e9f8cdb7-6819-44e8-95d3-e2d0690c3523" protectedtitlecache="false" titleCache="English" uri=""  vocabulary_id="10" termType="LA" idInVocabulary="eng"/>
+
+  <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+  <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+  <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+
+  <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" createdby_id="30"  startNumber="1"/>
+  <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" createdby_id="30" updatedby_id="30" root_id="2750" startNumber="1"/>
+
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="1730" sourceType="PTS"/>
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="50" sourceType="PTS"/>
+
+  
+</dataset>
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml b/eu.etaxonomy.taxeditor.remoting/src/test/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml
new file mode 100644 (file)
index 0000000..ba23175
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+  
+  Extraction Model:  PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+  Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
+  Database User:     root
+  
+  Exported Rows:     79
+      AgentBase                      1
+      Credit                         1
+      DefinedTermBase                1
+      Extension                      1
+      KeyStatement                   10
+      KeyStatement_LanguageString    10
+      LanguageString                 19
+      OriginalSourceBase             2
+      PolytomousKey                  2
+      PolytomousKeyNode              10
+      PolytomousKeyNode_LanguageString 9
+      PolytomousKey_Credit           1
+      PolytomousKey_Extension        1
+      PolytomousKey_OriginalSourceBase 2
+      PolytomousKey_RightsInfo       1
+      PolytomousKey_Taxon            1
+      RightsInfo                     1
+      TaxonBase                      6
+  
+--><dataset>
+  <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+  <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+  <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+  <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+  <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="" language_id="124"/>
+  <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" createdby_id="30" updatedby_id="30" language_id="124"/>
+  <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+  <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+
+  <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. &amp; Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11"  sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+  <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+  <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4808" type_id="2056"/>
+
+  <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2760"/>
+  <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="751" taxon_id="37" parent_id="2750"/>
+  <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+  <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2761" statement_id="2460"  subkey_id="751" parent_id="2750"/>
+  <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2461" subkey_id="751" parent_id="2753"/>
+  <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+  <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+  <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2464" parent_id="2753"/>
+  <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+  <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+  <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+  <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+  <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+  <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+  <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+  <DefinedTermBase DTYPE="Language" id="124" created="2010-12-21 15:09:09.0" uuid="e9f8cdb7-6819-44e8-95d3-e2d0690c3523" protectedtitlecache="false" titleCache="English" uri=""  vocabulary_id="10" termType="LA" idInVocabulary="eng"/>
+
+  <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+  <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+  <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+  <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+  <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+
+  <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" createdby_id="30"  startNumber="1"/>
+  <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" createdby_id="30" updatedby_id="30" root_id="2750" startNumber="1"/>
+
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="1730" sourceType="PTS"/>
+  <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="50" sourceType="PTS"/>
+
+  
+</dataset>
diff --git a/eu.etaxonomy.taxeditor.remoting/src/test/resources/log4j.properties b/eu.etaxonomy.taxeditor.remoting/src/test/resources/log4j.properties
new file mode 100644 (file)
index 0000000..96951aa
--- /dev/null
@@ -0,0 +1,17 @@
+### ************ APPENDER ***********************************###
+
+### direct log messages to stdout ###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+
+### ************* LOG LEVELS *********************************###
+
+### set log levels - for more verbose logging change 'info' to 'debug' ###
+### levels: error, warn, debug, info
+log4j.rootLogger=INFO, stdout
+
+### set directory-specific levels below
+log4j.logger.eu.etaxonomy.taxeditor = INFO
\ No newline at end of file