changed semantics of Node.properties(): Only the properties that
are either explicitly defined in the type.properties.file or the actual properties are returned, but not the ones defined by a generic _properties rule.
This commit is contained in:
parent
f6b20d916a
commit
fc7f0721a0
2 changed files with 26 additions and 19 deletions
|
@ -52,7 +52,7 @@ public class Node implements INode, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt einen neuen Node.
|
* Make a new Node object with a given name
|
||||||
*/
|
*/
|
||||||
public Node (String n) {
|
public Node (String n) {
|
||||||
id = generateID ();
|
id = generateID ();
|
||||||
|
@ -61,7 +61,7 @@ public class Node implements INode, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erstellt einen Clone eines Nodes in der "lokalen" Implementierung von INode.
|
* Create a clone of a given node that implements this class
|
||||||
*/
|
*/
|
||||||
public Node (INode node, Hashtable ntable, boolean conversionRoot) {
|
public Node (INode node, Hashtable ntable, boolean conversionRoot) {
|
||||||
this.id = generateID ();
|
this.id = generateID ();
|
||||||
|
@ -79,7 +79,9 @@ public class Node implements INode, Serializable {
|
||||||
addNode (nextc);
|
addNode (nextc);
|
||||||
}
|
}
|
||||||
for (Enumeration e = node.properties (); e.hasMoreElements (); ) {
|
for (Enumeration e = node.properties (); e.hasMoreElements (); ) {
|
||||||
IProperty next = (IProperty) e.nextElement ();
|
IProperty next = node.get ((String) e.nextElement (), false);
|
||||||
|
if (next == null)
|
||||||
|
continue;
|
||||||
int t = next.getType ();
|
int t = next.getType ();
|
||||||
if (t == IProperty.NODE) {
|
if (t == IProperty.NODE) {
|
||||||
INode n = next.getNodeValue ();
|
INode n = next.getNodeValue ();
|
||||||
|
@ -355,7 +357,7 @@ public class Node implements INode, Serializable {
|
||||||
}
|
}
|
||||||
for (Enumeration e2 = n.properties (); e2.hasMoreElements (); ) {
|
for (Enumeration e2 = n.properties (); e2.hasMoreElements (); ) {
|
||||||
// tell all nodes that are properties of n that they are no longer used as such
|
// tell all nodes that are properties of n that they are no longer used as such
|
||||||
Property p = (Property) e2.nextElement ();
|
Property p = (Property) n.get ((String) e2.nextElement (), false);
|
||||||
if (p != null && p.type == Property.NODE)
|
if (p != null && p.type == Property.NODE)
|
||||||
p.unregisterNode ();
|
p.unregisterNode ();
|
||||||
}
|
}
|
||||||
|
@ -410,7 +412,7 @@ public class Node implements INode, Serializable {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Enumeration properties () {
|
public Enumeration properties () {
|
||||||
return propMap == null ? new Vector ().elements () : propMap.elements ();
|
return propMap == null ? new EmptyEnumeration () : propMap.keys ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,10 +126,7 @@ public class Node implements INode, Serializable {
|
||||||
this.id = Key.makeVirtualID (parentmap, parentID, propname);
|
this.id = Key.makeVirtualID (parentmap, parentID, propname);
|
||||||
this.name = propname;
|
this.name = propname;
|
||||||
this.anonymous = false;
|
this.anonymous = false;
|
||||||
if (prototype == null)
|
setPrototype (prototype);
|
||||||
setPrototype ("");
|
|
||||||
else
|
|
||||||
setPrototype (prototype);
|
|
||||||
this.state = VIRTUAL;
|
this.state = VIRTUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +286,9 @@ public class Node implements INode, Serializable {
|
||||||
addNode (nextc);
|
addNode (nextc);
|
||||||
}
|
}
|
||||||
for (Enumeration e = node.properties (); e.hasMoreElements (); ) {
|
for (Enumeration e = node.properties (); e.hasMoreElements (); ) {
|
||||||
IProperty next = (IProperty) e.nextElement ();
|
IProperty next = node.get ((String) e.nextElement (), false);
|
||||||
|
if (next == null)
|
||||||
|
continue;
|
||||||
int t = next.getType ();
|
int t = next.getType ();
|
||||||
if (t == IProperty.NODE) {
|
if (t == IProperty.NODE) {
|
||||||
INode n = next.getNodeValue ();
|
INode n = next.getNodeValue ();
|
||||||
|
@ -809,8 +808,10 @@ public class Node implements INode, Serializable {
|
||||||
Relation gsrel = srel.getGroupbySubnodeRelation();
|
Relation gsrel = srel.getGroupbySubnodeRelation();
|
||||||
dbm.setSubnodeMapping (srel.other);
|
dbm.setSubnodeMapping (srel.other);
|
||||||
dbm.setSubnodeRelation (gsrel);
|
dbm.setSubnodeRelation (gsrel);
|
||||||
dbm.setPropertyMapping (prel.other);
|
if (prel != null) {
|
||||||
dbm.setPropertyRelation (prel.getGroupbyPropertyRelation());
|
dbm.setPropertyMapping (prel.other);
|
||||||
|
dbm.setPropertyRelation (prel.getGroupbyPropertyRelation());
|
||||||
|
}
|
||||||
node.setDbMapping (dbm);
|
node.setDbMapping (dbm);
|
||||||
String snrel = "WHERE "+srel.groupby +"='"+sid+"'";
|
String snrel = "WHERE "+srel.groupby +"='"+sid+"'";
|
||||||
if (gsrel.direction == Relation.BACKWARD)
|
if (gsrel.direction == Relation.BACKWARD)
|
||||||
|
@ -819,7 +820,9 @@ public class Node implements INode, Serializable {
|
||||||
snrel += " ORDER BY "+gsrel.order;
|
snrel += " ORDER BY "+gsrel.order;
|
||||||
node.setSubnodeRelation (snrel);
|
node.setSubnodeRelation (snrel);
|
||||||
return node;
|
return node;
|
||||||
} catch (Exception noluck) {}
|
} catch (Exception noluck) {
|
||||||
|
IServer.getLogger ().log ("Error creating group-by node for "+sid+": "+noluck);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,7 +1050,7 @@ public class Node implements INode, Serializable {
|
||||||
*/
|
*/
|
||||||
public Enumeration properties () {
|
public Enumeration properties () {
|
||||||
|
|
||||||
final Relation prel = dbmap == null ? null : dbmap.getPropertyRelation ();
|
/* final Relation prel = dbmap == null ? null : dbmap.getPropertyRelation ();
|
||||||
final DbMapping pmap = prel == null ? null : prel.other;
|
final DbMapping pmap = prel == null ? null : prel.other;
|
||||||
if (pmap != null && pmap.isRelational ()) {
|
if (pmap != null && pmap.isRelational ()) {
|
||||||
class Enum implements Enumeration {
|
class Enum implements Enumeration {
|
||||||
|
@ -1076,9 +1079,11 @@ public class Node implements INode, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Enum ();
|
return new Enum ();
|
||||||
}
|
} */
|
||||||
|
if (dbmap != null && dbmap.prop2db.size() > 0)
|
||||||
return propMap == null ? new Vector ().elements () : propMap.elements ();
|
return dbmap.prop2db.keys();
|
||||||
|
else
|
||||||
|
return propMap == null ? new EmptyEnumeration () : propMap.keys ();
|
||||||
|
|
||||||
// NOTE: we don't enumerate node properties here
|
// NOTE: we don't enumerate node properties here
|
||||||
// return propMap == null ? new Vector ().elements () : propMap.elements ();
|
// return propMap == null ? new Vector ().elements () : propMap.elements ();
|
||||||
|
@ -1696,8 +1701,8 @@ public class Node implements INode, Serializable {
|
||||||
n.makePersistentCapable ();
|
n.makePersistentCapable ();
|
||||||
}
|
}
|
||||||
for (Enumeration e = properties (); e.hasMoreElements (); ) {
|
for (Enumeration e = properties (); e.hasMoreElements (); ) {
|
||||||
IProperty next = (IProperty) e.nextElement ();
|
IProperty next = get ((String) e.nextElement (), false);
|
||||||
if (next.getType () == IProperty.NODE) {
|
if (next != null && next.getType () == IProperty.NODE) {
|
||||||
Node n = (Node) next.getNodeValue ();
|
Node n = (Node) next.getNodeValue ();
|
||||||
if (n != null && n.state == TRANSIENT)
|
if (n != null && n.state == TRANSIENT)
|
||||||
n.makePersistentCapable ();
|
n.makePersistentCapable ();
|
||||||
|
|
Loading…
Add table
Reference in a new issue