r9624 - helma/helma/branches/lazy_collections/src/helma/objectmodel/db

[email protected] Fri, 17 Apr 2009 00:42:32 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090416224232.A07AD3D0D6@mia>
Author: hannes
Date: 2009-04-17 00:42:32 +0200 (Fri, 17 Apr 2009)
New Revision: 9624

Modified:
   helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Relation.java
Log:
* Make sure lastTypeChange is set in virtual collection DbMappings.
* Add getClone() method to Relation.

Details at http://dev.helma.org/trac/helma/changeset/9624

Modified: helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Relation.java
===================================================================
--- helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Relation.java	2009-04-16 22:41:11 UTC (rev 9623)
+++ helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Relation.java	2009-04-16 22:42:32 UTC (rev 9624)
@@ -106,7 +106,8 @@
 
     /**
      * This constructor makes a copy of an existing relation. Not all fields are copied, just those
-     * which are needed in groupby- and virtual nodes defined by this relation.
+     * which are needed in groupby- and virtual nodes defined by this relation. use
+     * {@link Relation#getClone()} to get a full copy of this relation.
      */
     protected Relation(Relation rel) {
         // Note: prototype, groupby, groupbyPrototype and groupbyOrder aren't copied here.
@@ -790,7 +791,7 @@
                 virtualMapping.propRelation = getVirtualPropertyRelation();
             }
         }
-
+        virtualMapping.lastTypeChange = ownType.lastTypeChange;
         return virtualMapping;
     }
 
@@ -1120,6 +1121,19 @@
     }
 
     /**
+     * Get a copy of this relation.
+     * @return a clone of this relation
+     */
+    public Relation getClone() {
+        Relation rel = new Relation(this);
+        rel.prototype        = prototype;
+        rel.groupby          = groupby;
+        rel.groupbyPrototype = groupbyPrototype;
+        rel.groupbyOrder     = groupbyOrder;
+        return rel;
+    }
+
+    /**
      * Check if the child node fullfills the constraints defined by this relation.
      * FIXME: This always returns false if the relation has a filter value set,
      * since we can't determine if the filter constraints are met without