Only do anonymous/named check in getElementName() for relational objects.

Also check if child is relational before doing Relation.checkConstraints in isParentOf().
This commit is contained in:
hns 2004-03-02 15:03:05 +00:00
parent 08c443ce6a
commit 83d29f6a60

View file

@ -413,13 +413,9 @@ public final class Node implements INode, Serializable {
* and a property value for named properties.
*/
public String getElementName() {
// if subnodes are also mounted as properties, try to get the "nice" prop value
// instead of the id by turning the anonymous flag off.
long lastmod = lastmodified;
if (dbmap != null) {
lastmod = Math.max(lastmod, dbmap.getLastTypeChange());
}
// for relational nodes we need to consult parent mapping to find element name
if (isRelational()) {
long lastmod = Math.max(lastmodified, dbmap.getLastTypeChange());
if ((parentHandle != null) && (lastNameCheck < lastmod)) {
try {
@ -454,6 +450,7 @@ public final class Node implements INode, Serializable {
lastNameCheck = System.currentTimeMillis();
}
}
return (anonymous || (name == null) || (name.length() == 0)) ? id : name;
}
@ -1354,7 +1351,7 @@ public final class Node implements INode, Serializable {
* @return true if the given node is contained in this node's child list
*/
public boolean isParentOf(Node n) {
if (dbmap != null) {
if (dbmap != null && n.isRelational()) {
Relation subrel = dbmap.getSubnodeRelation();
// if we're dealing with relational child nodes use
// Relation.checkConstraints to avoid loading the child index.