Catch up on the promise of separating child nodes from properties: do not
set node properties for child nodes with groupby or accessname set. This means that lookups for groupby/accessname nodes becomes pretty expensive for the embedded database because we have to loop through child nodes, but the overhead seems acceptable, and the embedded db is not for high performance deployment anyhow. (Eventually we can implement some kind of caching mechanism here if necessary.)
This commit is contained in:
parent
418976539e
commit
01edf54603
1 changed files with 18 additions and 6 deletions
|
@ -924,8 +924,6 @@ public final class Node implements INode, Serializable {
|
|||
old.remove();
|
||||
this.removeNode(old);
|
||||
}
|
||||
|
||||
setNode(prop, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1035,7 +1033,7 @@ public final class Node implements INode, Serializable {
|
|||
// getting this specific child element
|
||||
Relation rel = dbmap.getExactPropertyRelation(name);
|
||||
|
||||
if (rel != null) {
|
||||
if (rel != null && !rel.isPrimitive()) {
|
||||
return getNode(name);
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1043,18 @@ public final class Node implements INode, Serializable {
|
|||
if (state != TRANSIENT && rel.otherType != null && rel.otherType.isRelational()) {
|
||||
return nmgr.getNode(this, name, rel);
|
||||
} else {
|
||||
INode node = getNode(name);
|
||||
// Do what we have to do: loop through subnodes and
|
||||
// check if any one matches
|
||||
String propname = rel.groupby != null ? "groupname" : rel.accessName;
|
||||
INode node = null;
|
||||
Enumeration e = getSubnodes();
|
||||
while (e.hasMoreElements()) {
|
||||
Node n = (Node) e.nextElement();
|
||||
if (name.equalsIgnoreCase(n.getString(propname))) {
|
||||
node = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// set DbMapping for embedded db group nodes
|
||||
if (node != null && rel.groupby != null) {
|
||||
node.setDbMapping(dbmap.getGroupbyMapping());
|
||||
|
@ -1198,7 +1207,11 @@ public final class Node implements INode, Serializable {
|
|||
node.setDbMapping(groupbyMapping);
|
||||
|
||||
if (!relational) {
|
||||
setNode(sid, node);
|
||||
// if we're not transient, make new node persistable
|
||||
if (state != TRANSIENT) {
|
||||
node.makePersistable();
|
||||
node.checkWriteLock();
|
||||
}
|
||||
subnodes.add(node.getHandle());
|
||||
}
|
||||
|
||||
|
@ -1950,7 +1963,6 @@ public final class Node implements INode, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
parent.setNode(value, this);
|
||||
setName(value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue