r9583 - helma/helma/branches/lazy_collections/src/helma/objectmodel/db
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090407181841.702213D0D6@mia> |
Author: hannes
Date: 2009-04-07 20:18:41 +0200 (Tue, 07 Apr 2009)
New Revision: 9583
Modified:
helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Node.java
helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SegmentedSubnodeList.java
helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SubnodeList.java
Log:
Make sure subnodes are reloaded when explicit subnodRelation is set.
Details at http://dev.helma.org/trac/helma/changeset/9583
Modified: helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Node.java 2009-04-07 14:01:29 UTC (rev 9582)
+++ helma/helma/branches/lazy_collections/src/helma/objectmodel/db/Node.java 2009-04-07 18:18:41 UTC (rev 9583)
@@ -634,8 +634,8 @@
* @param rel ...
*/
public synchronized void setSubnodeRelation(String rel) {
- if (((rel == null) && (this.subnodeRelation == null)) ||
- ((rel != null) && rel.equalsIgnoreCase(this.subnodeRelation))) {
+ if ((rel == null && this.subnodeRelation == null) ||
+ (rel != null && rel.equalsIgnoreCase(this.subnodeRelation))) {
return;
}
@@ -644,8 +644,9 @@
DbMapping smap = (dbmap == null) ? null : dbmap.getSubnodeMapping();
- if ((smap != null) && smap.isRelational()) {
- subnodes = null;
+ if (subnodes != null && smap != null && smap.isRelational()) {
+ subnodes.subnodeCount = -1;
+ subnodes.lastSubnodeFetch = -1;
}
}
@@ -1515,13 +1516,13 @@
*/
public void loadNodes() {
// Don't do this for transient nodes which don't have an explicit subnode relation set
- if (((state == TRANSIENT) || (state == NEW)) && (subnodeRelation == null)) {
+ if ((state == TRANSIENT || state == NEW) && subnodeRelation == null) {
return;
}
DbMapping subMap = (dbmap == null) ? null : dbmap.getSubnodeMapping();
- if ((subMap != null) && subMap.isRelational()) {
+ if (subMap != null && subMap.isRelational()) {
// check if subnodes need to be reloaded
synchronized (this) {
if (subnodes == null) {
@@ -1538,7 +1539,7 @@
* @return List an empty List of the type used by this Node
*/
public SubnodeList createSubnodeList() {
- subnodes = new SegmentedSubnodeList(this);
+ subnodes = new SubnodeList(this);
return subnodes;
}
Modified: helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SegmentedSubnodeList.java
===================================================================
--- helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SegmentedSubnodeList.java 2009-04-07 14:01:29 UTC (rev 9582)
+++ helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SegmentedSubnodeList.java 2009-04-07 18:18:41 UTC (rev 9583)
@@ -20,9 +20,6 @@
transient int loadstatus;
transient List[] keys;
- transient long lastSubnodeCount = 0; // these two are only used
- transient int subnodeCount = -1; // for aggressive loading relational subnodes
-
/**
* Creates a new subnode list
* @param node the node we belong to
Modified: helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SubnodeList.java
===================================================================
--- helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SubnodeList.java 2009-04-07 14:01:29 UTC (rev 9582)
+++ helma/helma/branches/lazy_collections/src/helma/objectmodel/db/SubnodeList.java 2009-04-07 18:18:41 UTC (rev 9583)
@@ -30,6 +30,9 @@
transient long lastSubnodeFetch = 0;
transient long lastSubnodeChange = 0;
+ transient long lastSubnodeCount = 0;
+ transient int subnodeCount = -1;
+
/**
* Hide/disable zero argument constructor for subclasses
@@ -128,6 +131,7 @@
// also reload if the type mapping has changed.
long lastChange = getLastSubnodeChange();
+ if (node.getSubnodeRelation() != null) System.err.println(" *** *** *** " + lastChange + "/ " + lastSubnodeFetch);
Relation rel = getSubnodeRelation();
if (lastChange != lastSubnodeFetch) {
if (rel.aggressiveLoading && rel.groupby == null) {