avoid calling setParent for root node ;-)

This commit is contained in:
hns 2001-02-01 19:11:39 +00:00
parent fbf746ed9e
commit eac9e96dee
2 changed files with 7 additions and 7 deletions

View file

@ -660,7 +660,7 @@ public class Node implements INode, Serializable {
} }
} }
if (node.getParent () == null) { if (node.getParent () == null && !"root".equalsIgnoreCase (node.getPrototype ())) {
node.setParent (this); node.setParent (this);
node.anonymous = true; node.anonymous = true;
} }
@ -757,7 +757,7 @@ public class Node implements INode, Serializable {
retval = nmgr.getNode (next, smap); retval = nmgr.getNode (next, smap);
} }
if (retval != null && retval.parentID == null) { if (retval != null && retval.parentID == null && !"root".equalsIgnoreCase (retval.getPrototype ())) {
retval.setParent (runner); retval.setParent (runner);
retval.anonymous = true; retval.anonymous = true;
} }
@ -788,7 +788,7 @@ public class Node implements INode, Serializable {
retval = nmgr.getNode (this, (String) subnodes.elementAt (index), srel); retval = nmgr.getNode (this, (String) subnodes.elementAt (index), srel);
else else
retval = nmgr.getNode ((String) subnodes.elementAt (index), smap); retval = nmgr.getNode ((String) subnodes.elementAt (index), smap);
if (retval != null && retval.parentID == null) { if (retval != null && retval.parentID == null && !"root".equalsIgnoreCase (retval.getPrototype ())) {
retval.setParent (this); retval.setParent (this);
retval.anonymous = true; retval.anonymous = true;
} }
@ -1109,7 +1109,7 @@ public class Node implements INode, Serializable {
// (i.e, still thinks it's just the key as a string) // (i.e, still thinks it's just the key as a string)
DbMapping pmap = dbmap == null ? null : dbmap.getExactPropertyMapping (propname); DbMapping pmap = dbmap == null ? null : dbmap.getExactPropertyMapping (propname);
if (pmap != null && prop != null && prop.type != IProperty.NODE) { if (pmap != null && prop != null && prop.type != IProperty.NODE) {
// this is a relational node stored by id // this is a relational node stored by id but we still think it's just a string. fix it
prop.nvalueID = prop.getStringValue (); prop.nvalueID = prop.getStringValue ();
prop.type = IProperty.NODE; prop.type = IProperty.NODE;
} }
@ -1124,7 +1124,7 @@ public class Node implements INode, Serializable {
try { try {
Node pn = nmgr.getNode (this, propname, prel); Node pn = nmgr.getNode (this, propname, prel);
if (pn != null) { if (pn != null) {
if (pn.parentID == null) { if (pn.parentID == null && !"root".equalsIgnoreCase (pn.getPrototype ())) {
pn.setParent (this); pn.setParent (this);
pn.name = propname; pn.name = propname;
pn.anonymous = false; pn.anonymous = false;
@ -1406,7 +1406,7 @@ public class Node implements INode, Serializable {
// check if the main identity of this node is as a named property // check if the main identity of this node is as a named property
// or as an anonymous node in a collection // or as an anonymous node in a collection
if (n.getParent () == null && n.adoptName) { if (n.getParent () == null && n.adoptName && !"root".equalsIgnoreCase (n.getPrototype ())) {
n.setParent (this); n.setParent (this);
n.name = propname; n.name = propname;
n.anonymous = false; n.anonymous = false;

View file

@ -382,7 +382,7 @@ public final class Property implements IProperty, Serializable, Cloneable {
// we have what we need, now get the node from the node manager // we have what we need, now get the node from the node manager
Node retval = node.nmgr.getNode (nvalueID, dbm); Node retval = node.nmgr.getNode (nvalueID, dbm);
if (retval != null && retval.parentID == null) { if (retval != null && retval.parentID == null && !"root".equalsIgnoreCase (retval.getPrototype ())) {
retval.setParent (node); retval.setParent (node);
retval.setName (propname); retval.setName (propname);
retval.anonymous = false; retval.anonymous = false;