Set DbMapping on group nodes stored in embedded DB. Otherwise, child

nodes are not reachable by name after the application is restarted.
This commit is contained in:
hns 2004-02-04 17:34:58 +00:00
parent c6e5dcbc95
commit b9646ab20d

View file

@ -617,7 +617,7 @@ public final class Node implements INode, Serializable {
public void setName(String name) { public void setName(String name) {
if ((name == null) || (name.trim().length() == 0)) { if ((name == null) || (name.trim().length() == 0)) {
// use id as name // use id as name
this.name = id; this.name = id;
} else if (name.indexOf('/') > -1) { } else if (name.indexOf('/') > -1) {
// "/" is used as delimiter, so it's not a legal char // "/" is used as delimiter, so it's not a legal char
return; return;
@ -892,8 +892,8 @@ public final class Node implements INode, Serializable {
INode old = (INode) getChildElement(prop); INode old = (INode) getChildElement(prop);
if ((old != null) && (old != node)) { if ((old != null) && (old != node)) {
// FIXME: we delete the existing node here, // FIXME: we delete the existing node here,
// but actually the app developer should prevent this from // but actually the app developer should prevent this from
// happening, so it might be better to throw an exception. // happening, so it might be better to throw an exception.
old.remove(); old.remove();
this.removeNode(old); this.removeNode(old);
@ -989,7 +989,7 @@ public final class Node implements INode, Serializable {
/** /**
* This implements the getChild() method of the IPathElement interface * This implements the getChildElement() method of the IPathElement interface
*/ */
public IPathElement getChildElement(String name) { public IPathElement getChildElement(String name) {
if (dbmap != null) { if (dbmap != null) {
@ -1007,7 +1007,12 @@ public final class Node implements INode, Serializable {
if (state != TRANSIENT && rel.otherType != null && rel.otherType.isRelational()) { if (state != TRANSIENT && rel.otherType != null && rel.otherType.isRelational()) {
return nmgr.getNode(this, name, rel); return nmgr.getNode(this, name, rel);
} else { } else {
return getNode(name); INode node = getNode(name);
// set DbMapping for embedded db group nodes
if (node != null && rel.groupby != null) {
node.setDbMapping(dbmap.getGroupbyMapping());
}
return node;
} }
} }
@ -1151,7 +1156,7 @@ public final class Node implements INode, Serializable {
// set "groupname" property to value of groupby field // set "groupname" property to value of groupby field
node.setString("groupname", sid); node.setString("groupname", sid);
node.setDbMapping(groupbyMapping); node.setDbMapping(groupbyMapping);
if (!relational) { if (!relational) {