Removed boolean inherit argument from INode.get*() methods because it

was never used.
This commit is contained in:
hns 2002-11-26 14:00:04 +00:00
parent ab349a1c3c
commit 94e9a8efab
11 changed files with 94 additions and 119 deletions

View file

@ -593,7 +593,7 @@ public final class Application implements IPathElement, Runnable {
public INode getUserNode (String uid) {
try {
INode users = getUserRoot ();
return users.getNode (uid, false);
return users.getNode (uid);
} catch (Exception x) {
return null;
}
@ -715,7 +715,7 @@ public final class Application implements IPathElement, Runnable {
// if none, try to get them from properties (internal db)
if (list.size()==0) {
for (Enumeration e=users.properties(); e.hasMoreElements(); ) {
list.add (users.getNode ((String)e.nextElement (),false));
list.add (users.getNode ((String)e.nextElement ()));
}
}
return list;
@ -764,7 +764,7 @@ public final class Application implements IPathElement, Runnable {
INode unode = null;
try {
INode users = getUserRoot ();
unode = users.getNode (uname, false);
unode = users.getNode (uname);
if (unode != null)
return null;
@ -799,8 +799,8 @@ public final class Application implements IPathElement, Runnable {
return false;
try {
INode users = getUserRoot ();
Node unode = (Node)users.getNode (uname, false);
String pw = unode.getString ("password", false);
Node unode = (Node) users.getNode (uname);
String pw = unode.getString ("password");
if (pw != null && pw.equals (password)) {
// let the old user-object forget about this session
logoutSession(session);

View file

@ -458,7 +458,7 @@ public final class Skin {
private void renderFromSession (RequestEvaluator reval) {
if (reval.session == null)
return;
Object value = reval.session.getCacheNode().getString (name, false);
Object value = reval.session.getCacheNode().getString (name);
writeToResponse (value, reval.res, true);
}

View file

@ -57,11 +57,11 @@ public final class SkinManager implements FilenameFilter {
// check if the skinset object is a HopObject (db based skin)
// or a String (file based skin)
if (skinset instanceof INode) {
INode n = ((INode) skinset).getNode (prototype, false);
INode n = ((INode) skinset).getNode (prototype);
if (n != null) {
n = n.getNode (skinname, false);
n = n.getNode (skinname);
if (n != null) {
String skin = n.getString ("skin", false);
String skin = n.getString ("skin");
if (skin != null) {
return new Skin (skin, app);
}

View file

@ -62,14 +62,14 @@ public interface INode extends INodeState, IPathElement {
*/
public Enumeration properties ();
public IProperty get (String name, boolean inherit);
public String getString (String name, boolean inherit);
public boolean getBoolean (String name, boolean inherit);
public Date getDate (String name, boolean inherit);
public long getInteger (String name, boolean inherit);
public double getFloat (String name, boolean inherit);
public INode getNode (String name, boolean inherit);
public Object getJavaObject (String name, boolean inherit);
public IProperty get (String name);
public String getString (String name);
public boolean getBoolean (String name);
public Date getDate (String name);
public long getInteger (String name);
public double getFloat (String name);
public INode getNode (String name);
public Object getJavaObject (String name);
public void setString (String name, String value);
public void setBoolean (String name, boolean value);

View file

@ -32,9 +32,6 @@ public class TransientNode implements INode, Serializable {
transient String prototype;
protected String contentType;
protected byte content[];
protected long created;
protected long lastmodified;
@ -249,14 +246,10 @@ public class TransientNode implements INode, Serializable {
}
public IPathElement getChildElement (String name) {
return getNode (name, false);
return getNode (name);
}
public INode getSubnode (String name) {
return getSubnode (name, false);
}
public INode getSubnode (String name, boolean inherit) {
StringTokenizer st = new StringTokenizer (name, "/");
TransientNode retval = this, runner;
while (st.hasMoreTokens () && retval != null) {
@ -267,9 +260,7 @@ public class TransientNode implements INode, Serializable {
else
retval = runner.nodeMap == null ? null : (TransientNode) runner.nodeMap.get (next);
if (retval == null)
retval = (TransientNode) runner.getNode (next, inherit);
if (retval == null && inherit && runner == this && parent != null)
retval = (TransientNode) parent.getSubnode (next, inherit);
retval = (TransientNode) runner.getNode (next);
}
return retval;
}
@ -311,12 +302,6 @@ public class TransientNode implements INode, Serializable {
p.node.propMap.remove (p.propname.toLowerCase ());
} catch (Exception ignore) {}
}
/* for (Enumeration e2 = n.properties (); e2.hasMoreElements (); ) {
// tell all nodes that are properties of n that they are no longer used as such
Property p = (Property) n.get ((String) e2.nextElement (), false);
if (p != null && p.type == Property.NODE)
p.unregisterNode ();
} */
// remove all subnodes, giving them a chance to destroy themselves.
Vector v = new Vector (); // removeElement modifies the Vector we are enumerating, so we are extra careful.
for (Enumeration e3 = n.getSubnodes (); e3.hasMoreElements (); ) {
@ -326,10 +311,6 @@ public class TransientNode implements INode, Serializable {
for (int i=0; i<m; i++) {
n.removeNode ((TransientNode) v.elementAt (i));
}
if (n.content != null) {
// IServer.getLogger().log ("destroying content of node "+n.getName ());
// ObjectStore.destroy (n.content);
}
} else {
//
n.links.removeElement (this);
@ -372,11 +353,8 @@ public class TransientNode implements INode, Serializable {
}
private Property getProperty (String propname, boolean inherit) {
private Property getProperty (String propname) {
Property prop = propMap == null ? null : (Property) propMap.get (propname);
if (prop == null && inherit && parent != null) {
prop = parent.getProperty (propname, inherit);
}
// check if we have to create a virtual node
if (prop == null && dbmap != null) {
Relation rel = dbmap.getPropertyRelation (propname);
@ -400,46 +378,46 @@ public class TransientNode implements INode, Serializable {
}
public IProperty get (String propname, boolean inherit) {
public IProperty get (String propname) {
propname = propname.toLowerCase ();
return getProperty (propname, inherit);
return getProperty (propname);
}
public String getString (String propname, String defaultValue, boolean inherit) {
String propValue = getString (propname, inherit);
public String getString (String propname, String defaultValue) {
String propValue = getString (propname);
return propValue == null ? defaultValue : propValue;
}
public String getString (String propname, boolean inherit) {
public String getString (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getStringValue ();
} catch (Exception ignore) {}
return null;
}
public long getInteger (String propname, boolean inherit) {
public long getInteger (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getIntegerValue ();
} catch (Exception ignore) {}
return 0;
}
public double getFloat (String propname, boolean inherit) {
public double getFloat (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getFloatValue ();
} catch (Exception ignore) {}
return 0.0;
}
public Date getDate (String propname, boolean inherit) {
public Date getDate (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getDateValue ();
} catch (Exception ignore) {}
@ -447,27 +425,27 @@ public class TransientNode implements INode, Serializable {
}
public boolean getBoolean (String propname, boolean inherit) {
public boolean getBoolean (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getBooleanValue ();
} catch (Exception ignore) {}
return false;
}
public INode getNode (String propname, boolean inherit) {
public INode getNode (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getNodeValue ();
} catch (Exception ignore) {}
return null;
}
public Object getJavaObject (String propname, boolean inherit) {
public Object getJavaObject (String propname) {
propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getJavaObjectValue ();
} catch (Exception ignore) {}

View file

@ -485,7 +485,7 @@ public final class Node implements INode, Serializable {
Relation prel = parentmap.getPropertyRelation();
if (prel != null && prel.subnodesAreProperties && prel.accessor != null) {
String propname = dbmap.columnNameToProperty (prel.accessor);
String propvalue = getString (propname, false);
String propvalue = getString (propname);
if (propvalue != null && propvalue.length() > 0) {
setName (propvalue);
anonymous = false;
@ -649,7 +649,7 @@ public final class Node implements INode, Serializable {
// reverse look up property used to access this via parent
Relation proprel = dbmap.columnNameToRelation (prel.accessor);
if (proprel != null && proprel.propName != null)
newname = getString (proprel.propName, false);
newname = getString (proprel.propName);
}
}
@ -687,7 +687,7 @@ public final class Node implements INode, Serializable {
// we only try to fetch a node if an explicit relation is specified for the prop name
Relation rel = dbmap.propertyToRelation (pinfo.propname);
if (rel != null && rel.reftype == Relation.REFERENCE)
pn = getNode (pinfo.propname, false);
pn = getNode (pinfo.propname);
// the parent of this node is the app's root node...
if (pn == null && pinfo.isroot)
pn = nmgr.getNode ("0", nmgr.getDbMapping ("root"));
@ -695,13 +695,13 @@ public final class Node implements INode, Serializable {
if (pn != null) {
// see if dbmapping specifies anonymity for this node
if (pinfo.virtualname != null)
pn = pn.getNode (pinfo.virtualname, false);
pn = pn.getNode (pinfo.virtualname);
DbMapping dbm = pn == null ? null : pn.getDbMapping ();
try {
if (dbm != null && dbm.getSubnodeGroupby () != null) {
// check for groupby
rel = dbmap.columnNameToRelation (dbm.getSubnodeGroupby());
pn = pn.getSubnode (getString (rel.propName, false));
pn = pn.getSubnode (getString (rel.propName));
}
if (pn != null) {
setParent ((Node) pn);
@ -784,8 +784,8 @@ public final class Node implements INode, Serializable {
Relation groupbyRel = srel.otherType.columnNameToRelation (srel.groupby);
String groupbyProp = (groupbyRel != null) ?
groupbyRel.propName : srel.groupby;
String groupbyValue = node.getString (groupbyProp, false);
INode groupbyNode = getNode (groupbyValue, false);
String groupbyValue = node.getString (groupbyProp);
INode groupbyNode = getNode (groupbyValue);
// if group-by node doesn't exist, we'll create it
if (groupbyNode == null)
groupbyNode = getGroupbySubnode (groupbyValue, true);
@ -821,9 +821,9 @@ public final class Node implements INode, Serializable {
Relation localrel = node.dbmap.columnNameToRelation (prel.accessor);
// if no relation from db column to prop name is found, assume that both are equal
String propname = localrel == null ? prel.accessor : localrel.propName;
String prop = node.getString (propname, false);
String prop = node.getString (propname);
if (prop != null && prop.length() > 0) {
INode old = getNode (prop, false);
INode old = getNode (prop);
if (old != null && old != node) {
unset (prop);
removeNode (old);
@ -911,20 +911,20 @@ public final class Node implements INode, Serializable {
// getting this specific child element
Relation rel = dbmap.getExactPropertyRelation (name);
if (rel != null)
return (IPathElement) getNode (name, false);
return (IPathElement) getNode (name);
rel = dbmap.getSubnodeRelation ();
if (rel != null && rel.groupby == null && rel.accessor != null) {
if (rel.otherType != null && rel.otherType.isRelational ())
return (IPathElement) nmgr.getNode (this, name, rel);
else
return (IPathElement) getNode (name, false);
return (IPathElement) getNode (name);
}
return (IPathElement) getSubnode (name);
} else {
// no dbmapping - just try child collection first, then named property.
IPathElement child = (IPathElement) getSubnode (name);
if (child == null)
child = (IPathElement) getNode (name, false);
child = (IPathElement) getNode (name);
return child;
}
}
@ -1097,8 +1097,8 @@ public final class Node implements INode, Serializable {
Relation localrel = node.dbmap.columnNameToRelation (prel.accessor);
// if no relation from db column to prop name is found, assume that both are equal
String propname = localrel == null ? prel.accessor : localrel.propName;
String prop = node.getString (propname, false);
if (prop != null && getNode (prop, false) == node)
String prop = node.getString (propname);
if (prop != null && getNode (prop) == node)
unset (prop);
}
}
@ -1318,15 +1318,15 @@ public final class Node implements INode, Serializable {
return propMap;
}
public IProperty get (String propname, boolean inherit) {
return getProperty (propname, inherit);
public IProperty get (String propname) {
return getProperty (propname);
}
public String getParentInfo () {
return "anonymous:"+anonymous+",parentHandle"+parentHandle+",parent:"+getParent();
}
protected Property getProperty (String propname, boolean inherit) {
protected Property getProperty (String propname) {
// nmgr.logEvent ("GETTING PROPERTY: "+propname);
if (propname == null)
return null;
@ -1382,42 +1382,39 @@ public final class Node implements INode, Serializable {
}
}
if (prop == null && inherit && getParent () != null && state != TRANSIENT) {
prop = ((Node) getParent ()).getProperty (propname, inherit);
}
return prop;
}
public String getString (String propname, boolean inherit) {
public String getString (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getStringValue ();
} catch (Exception ignore) {}
return null;
}
public long getInteger (String propname, boolean inherit) {
public long getInteger (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getIntegerValue ();
} catch (Exception ignore) {}
return 0;
}
public double getFloat (String propname, boolean inherit) {
public double getFloat (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getFloatValue ();
} catch (Exception ignore) {}
return 0.0;
}
public Date getDate (String propname, boolean inherit) {
public Date getDate (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getDateValue ();
} catch (Exception ignore) {}
@ -1425,27 +1422,27 @@ public final class Node implements INode, Serializable {
}
public boolean getBoolean (String propname, boolean inherit) {
public boolean getBoolean (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getBooleanValue ();
} catch (Exception ignore) {}
return false;
}
public INode getNode (String propname, boolean inherit) {
public INode getNode (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getNodeValue ();
} catch (Exception ignore) {}
return null;
}
public Object getJavaObject (String propname, boolean inherit) {
public Object getJavaObject (String propname) {
// propname = propname.toLowerCase ();
Property prop = getProperty (propname, inherit);
Property prop = getProperty (propname);
try {
return prop.getJavaObjectValue ();
} catch (Exception ignore) {}
@ -1489,14 +1486,14 @@ public final class Node implements INode, Serializable {
String dbcolumn = dbmap.propertyToColumnName (propname);
if (propRel != null && propRel.accessor != null && propRel.accessor.equals (dbcolumn)) {
INode n = parent.getNode (value, false);
INode n = parent.getNode (value);
if (n != null && n != this) {
parent.unset (value);
parent.removeNode (n);
}
if (oldvalue != null) {
n = parent.getNode (oldvalue, false);
n = parent.getNode (oldvalue);
if (n == this) {
parent.unset (oldvalue);
parent.addNode (this);
@ -1805,7 +1802,7 @@ public final class Node implements INode, Serializable {
n.makePersistentCapable ();
}
for (Enumeration e = properties (); e.hasMoreElements (); ) {
IProperty next = get ((String) e.nextElement (), false);
IProperty next = get ((String) e.nextElement ());
if (next != null && next.getType () == IProperty.NODE) {
Node n = (Node) next.getNodeValue ();
if (n != null && n.state == TRANSIENT)

View file

@ -410,7 +410,7 @@ public final class NodeManager {
Map.Entry e = (Map.Entry) i.next ();
String propname = (String) e.getKey ();
Relation rel = (Relation) e.getValue ();
Property p = node.getProperty (propname, false);
Property p = node.getProperty (propname);
if (p != null && rel != null) {
switch (p.getType ()) {
@ -493,7 +493,7 @@ public final class NodeManager {
(rel.reftype != Relation.REFERENCE && rel.reftype != Relation.PRIMITIVE)))
continue;
Property p = node.getProperty (propname, false);
Property p = node.getProperty (propname);
if (p != null && rel != null) {
@ -864,7 +864,7 @@ public final class NodeManager {
// group nodes.
String groupName = null;
if (groupbyProp != null) {
groupName = node.getString (groupbyProp, false);
groupName = node.getString (groupbyProp);
List sn = (List) groupbySubnodes.get (groupName);
if (sn == null) {
sn = new ExternalizableVector ();
@ -876,7 +876,7 @@ public final class NodeManager {
// if relation doesn't use primary key as accessor, get accessor value
String accessName = null;
if (accessProp != null) {
accessName = node.getString (accessProp, false);
accessName = node.getString (accessProp);
}
// register new nodes with the cache. If an up-to-date copy

View file

@ -520,10 +520,10 @@ public final class Relation {
if (localName == null || localName.equalsIgnoreCase (ownType.getIDField ()))
value = home.getID ();
else if (ownType.isRelational ())
value = home.getString (ownType.columnNameToProperty (localName), false);
value = home.getString (ownType.columnNameToProperty (localName));
else
value = home.getString (localName, false);
if (value != null && !value.equals (child.getString (propname, false))) {
value = home.getString (localName);
if (value != null && !value.equals (child.getString (propname))) {
return false;
}
}
@ -550,7 +550,7 @@ public final class Relation {
if (localName == null || localName.equalsIgnoreCase (ownType.getIDField ())) {
// only set node if property in child object is defined as reference.
if (crel.reftype == REFERENCE) {
INode currentValue = child.getNode (crel.propName, false);
INode currentValue = child.getNode (crel.propName);
// we set the backwards reference iff the reference is currently unset, if
// is set to a transient object, or if the new target is not transient. This
// prevents us from overwriting a persistent refererence with a transient one,
@ -566,9 +566,9 @@ public final class Relation {
} else if (crel.reftype == PRIMITIVE) {
String value = null;
if (ownType.isRelational ())
value = home.getString (ownType.columnNameToProperty (localName), false);
value = home.getString (ownType.columnNameToProperty (localName));
else
value = home.getString (localName, false);
value = home.getString (localName);
if (value != null) {
child.setString (crel.propName, value);
}
@ -629,7 +629,7 @@ public final class Relation {
local = ref.getID ();
else {
String homeprop = ownType.columnNameToProperty (localName);
local = ref.getString (homeprop, false);
local = ref.getString (homeprop);
}
q.append (foreignName);
q.append (" = ");

View file

@ -162,9 +162,9 @@ public class XmlConverter implements XmlConstants {
String prototype = helmaKey.substring (0, dot);
INode node = (INode) nodeCache.get (prototype);
helmaKey = helmaKey.substring (dot+1);
if (node != null && node.getString(helmaKey, false)==null)
if (node != null && node.getString(helmaKey)==null)
node.setString (helmaKey, XmlUtil.getTextContent (childNode));
} else if ( helmaNode.getString(helmaKey,false)==null ) {
} else if ( helmaNode.getString(helmaKey)==null ) {
helmaNode.setString( helmaKey, XmlUtil.getTextContent(childNode) );
if (DEBUG)
debug("childtext-2-property mapping, setting " + helmaKey + " as string" );
@ -195,10 +195,10 @@ public class XmlConverter implements XmlConstants {
if (node == null)
continue;
if ( node.getNode(helmaKey,false)==null ) {
if ( node.getNode(helmaKey)==null ) {
convert( childElement, node.createNode(helmaKey), nodeCache );
if (DEBUG)
debug( "read " + childElement.toString() + node.getNode(helmaKey,false).toString() );
debug( "read " + childElement.toString() + node.getNode(helmaKey).toString() );
}
continue;
}
@ -243,7 +243,7 @@ public class XmlConverter implements XmlConstants {
if ("_children".equals (helmaKey)) {
worknode = node;
} else {
worknode = node.getNode( helmaKey, false );
worknode = node.getNode( helmaKey );
if ( worknode==null ) {
// if virtual node doesn't exist, create it
worknode = helmaNode.createNode( helmaKey );

View file

@ -190,7 +190,7 @@ public class XmlWriter extends OutputStreamWriter implements XmlConstants {
}
while ( e.hasMoreElements() ) {
String key = (String)e.nextElement();
IProperty prop = node.get(key,false);
IProperty prop = node.get(key);
if ( prop!=null ) {
boolean validName = isValidElementName (key);
String elementName, propName;

View file

@ -318,7 +318,7 @@ public class ESNode extends ObjectPrototype {
public boolean deleteProperty(String propertyName, int hash) throws EcmaScriptException {
checkNode ();
// engine.app.logEvent ("delete property called: "+propertyName);
if (node.get (propertyName, false) != null) {
if (node.get (propertyName) != null) {
node.unset (propertyName);
return true;
}
@ -389,7 +389,7 @@ public class ESNode extends ObjectPrototype {
return getInternalProperty (propertyName);
// this _may_ do a relational query if properties are mapped to a relational type.
IProperty p = node.get (propertyName, false);
IProperty p = node.get (propertyName);
if (p != null) {
if (p.getType () == IProperty.STRING) {
String str = p.getStringValue ();