Revert from change in revision 1.132 to only check name in getElementName()
for relational nodes: We actually need to do this for embedded nodes.
This commit is contained in:
parent
460fe9c892
commit
945c18b4ba
1 changed files with 30 additions and 28 deletions
|
@ -413,43 +413,45 @@ public final class Node implements INode, Serializable {
|
||||||
* and a property value for named properties.
|
* and a property value for named properties.
|
||||||
*/
|
*/
|
||||||
public String getElementName() {
|
public String getElementName() {
|
||||||
// for relational nodes we need to consult parent mapping to find element name
|
// check element name - this is either the Node's id or name.
|
||||||
if (isRelational()) {
|
long lastmod = lastmodified;
|
||||||
long lastmod = Math.max(lastmodified, dbmap.getLastTypeChange());
|
|
||||||
|
|
||||||
if ((parentHandle != null) && (lastNameCheck <= lastmod)) {
|
if (dbmap != null) {
|
||||||
try {
|
lastmod = Math.max(lastmod, dbmap.getLastTypeChange());
|
||||||
Node p = parentHandle.getNode(nmgr);
|
}
|
||||||
DbMapping parentmap = p.getDbMapping();
|
|
||||||
Relation prel = parentmap.getSubnodeRelation();
|
|
||||||
|
|
||||||
if (prel != null) {
|
if ((parentHandle != null) && (lastNameCheck <= lastmod)) {
|
||||||
if (prel.groupby != null) {
|
try {
|
||||||
setName(getString("groupname"));
|
Node p = parentHandle.getNode(nmgr);
|
||||||
|
DbMapping parentmap = p.getDbMapping();
|
||||||
|
Relation prel = parentmap.getSubnodeRelation();
|
||||||
|
|
||||||
|
if (prel != null) {
|
||||||
|
if (prel.groupby != null) {
|
||||||
|
setName(getString("groupname"));
|
||||||
|
anonymous = false;
|
||||||
|
} else if (prel.accessName != null) {
|
||||||
|
String propname = dbmap.columnNameToProperty(prel.accessName);
|
||||||
|
String propvalue = getString(propname);
|
||||||
|
|
||||||
|
if ((propvalue != null) && (propvalue.length() > 0)) {
|
||||||
|
setName(propvalue);
|
||||||
anonymous = false;
|
anonymous = false;
|
||||||
} else if (prel.accessName != null) {
|
} else if (!anonymous && p.isParentOf(this)) {
|
||||||
String propname = dbmap.columnNameToProperty(prel.accessName);
|
|
||||||
String propvalue = getString(propname);
|
|
||||||
|
|
||||||
if ((propvalue != null) && (propvalue.length() > 0)) {
|
|
||||||
setName(propvalue);
|
|
||||||
anonymous = false;
|
|
||||||
} else if (!anonymous && p.isParentOf(this)) {
|
|
||||||
anonymous = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
anonymous = true;
|
anonymous = true;
|
||||||
}
|
}
|
||||||
} else if (!anonymous && p.isParentOf(this)) {
|
} else {
|
||||||
anonymous = true;
|
anonymous = true;
|
||||||
}
|
}
|
||||||
} catch (Exception ignore) {
|
} else if (!anonymous && p.isParentOf(this)) {
|
||||||
// FIXME: add proper NullPointer checks in try statement
|
anonymous = true;
|
||||||
// just fall back to default method
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ignore) {
|
||||||
lastNameCheck = System.currentTimeMillis();
|
// FIXME: add proper NullPointer checks in try statement
|
||||||
|
// just fall back to default method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastNameCheck = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (anonymous || (name == null) || (name.length() == 0)) ? id : name;
|
return (anonymous || (name == null) || (name.length() == 0)) ? id : name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue