Fixes an issue where update of title caches did not work for cloned instances.
authorn.hoffmann <n.hoffmann@localhost>
Wed, 5 Jan 2011 17:19:35 +0000 (17:19 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 5 Jan 2011 17:19:35 +0000 (17:19 +0000)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/CdmBase.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/NonViralNameTest.java

index f0f8fe22e40152da78147be1cb78083daaafc6d3..c6dd4d6334abd68fa44ae3352fe2cf7f5bc142a7 100644 (file)
@@ -358,6 +358,7 @@ public abstract class CdmBase implements Serializable, ICdmBase{
        protected void clone(CdmBase clone){
                clone.setCreatedBy(createdBy);
                clone.setId(id);
        protected void clone(CdmBase clone){
                clone.setCreatedBy(createdBy);
                clone.setId(id);
+               clone.propertyChangeSupport=new PropertyChangeSupport(clone);
                //Constructor Attributes
                //clone.setCreated(created);
                //clone.setUuid(getUuid());
                //Constructor Attributes
                //clone.setCreated(created);
                //clone.setUuid(getUuid());
@@ -370,6 +371,7 @@ public abstract class CdmBase implements Serializable, ICdmBase{
        @Override
        public Object clone() throws CloneNotSupportedException{
                CdmBase result = (CdmBase)super.clone();
        @Override
        public Object clone() throws CloneNotSupportedException{
                CdmBase result = (CdmBase)super.clone();
+               result.propertyChangeSupport=new PropertyChangeSupport(result);
                
                //TODO ?
                result.setId(0);
                
                //TODO ?
                result.setId(0);
index 9a1058585bf6e1d0a73dcac1f4e6e097b78e6ee6..f08acb8a506becb101ec83ad6f9f9d90abcd741e 100644 (file)
@@ -558,6 +558,8 @@ public abstract class IdentifiableEntity<S extends IIdentifiableEntityCacheStrat
                if (! protectedTitleCache){
                        result.titleCache = null;
                }
                if (! protectedTitleCache){
                        result.titleCache = null;
                }
+               
+               result.initListener();
                return result;
        }
        
                return result;
        }
        
index 55618ce64e307c751707390003e08e20220e7d37..a56abd909ad412559ee2c3ad1bf01a6986d4fcd5 100644 (file)
@@ -385,6 +385,9 @@ public class NonViralNameTest extends EntityTestBase {
                Assert.assertEquals("NameCache should be equal", nonViralName1.getNameCache(), clone.getNameCache());\r
                Assert.assertEquals("AuthorshipCache should be equal", nonViralName1.getAuthorshipCache(), clone.getAuthorshipCache());\r
                \r
                Assert.assertEquals("NameCache should be equal", nonViralName1.getNameCache(), clone.getNameCache());\r
                Assert.assertEquals("AuthorshipCache should be equal", nonViralName1.getAuthorshipCache(), clone.getAuthorshipCache());\r
                \r
+               clone.setSpecificEpithet("sub");\r
+               Assert.assertEquals("NameCache should be changed", "Aus (\u00D7Infaus) sub subsp. infrabus", clone.getNameCache());\r
+               \r
                //hybrid parents of clone \r
                Assert.assertEquals("There should be exactly 2 hybrid relationships in which the clone takes the child role", 2, clone.getChildRelationships().size());\r
                Set<NonViralName> parentSet = new HashSet<NonViralName>();\r
                //hybrid parents of clone \r
                Assert.assertEquals("There should be exactly 2 hybrid relationships in which the clone takes the child role", 2, clone.getChildRelationships().size());\r
                Set<NonViralName> parentSet = new HashSet<NonViralName>();\r