diff --git a/src/helma/objectmodel/db/Property.java b/src/helma/objectmodel/db/Property.java
index 604fa608..a0de82c9 100644
--- a/src/helma/objectmodel/db/Property.java
+++ b/src/helma/objectmodel/db/Property.java
@@ -193,43 +193,16 @@ public final class Property implements IProperty, Serializable, Cloneable {
}
public void setNodeValue (Node value) {
- value.checkWriteLock ();
+ // value.checkWriteLock ();
if (type == NODE)
unregisterNode ();
if (type == JAVAOBJECT)
this.jvalue = null;
- registerNode (value);
+ // registerNode (value);
type = NODE;
- /* if (node.dbmap != null) {
- Relation rel = node.dbmap.getPropertyRelation (propname);
- if (rel != null && rel.other != null) {
- DbMapping vmap = value.getDbMapping ();
- // check if actual type matches expected type
- if (rel.other != vmap && (!rel.virtual || rel.prototype != null)) {
- throw new RuntimeException ("Can't assign property: expected prototype "+rel.other+", got "+vmap);
- }
- // check if this is a forward relation, i.e. if we point to a field in the value object
- // if so, we may use something else than the object's id to refer to it.
- if (!rel.virtual && rel.direction == Relation.FORWARD) {
- if (rel.usesPrimaryKey ()) {
- this.nvalueID = value.getID ();
- nhandle = new NodeHandle (value);
- } else try {
- this.nvalueID = value.getString (vmap.columnNameToProperty (rel.getRemoteField()).propname, false);
- nhandle = null;
- } catch (Exception x) {
- throw new RuntimeException ("Can't set "+propname+" to "+value+": error retrieving target property");
- }
- dirty = true;
- return;
- }
- }
- } */
-
nhandle = value.getHandle ();
- // this.nvalueID = value == null ? null : value.getID ();
dirty = true;
}
@@ -256,8 +229,6 @@ public final class Property implements IProperty, Serializable, Cloneable {
nvmap = node.dbmap.getPropertyMapping (propname);
nvrel = node.dbmap.getPropertyRelation (propname);
}
- // if (nvalue == null)
- // nvalue = node.nmgr.getNode (nvalueID, nvmap);
if (nvalue == null)
return;
@@ -276,23 +247,11 @@ public final class Property implements IProperty, Serializable, Cloneable {
if (!nvalue.isAnonymous() && propname.equals (nvalue.getName()) && this.node == nvalue.getParent()) {
// this is the "main" property of a named node, so handle this as a cascading delete.
nvalue.deepRemoveNode ();
- } else {
- nvalue.unregisterPropLinkFrom (this.node);
}
}
}
- /**
- * Tell the value node that it is being used as a property value.
- */
- protected void registerNode (Node n) {
- // only need to call registerPropLink if the value node is not stored in a relational db
- if (n != null && (n.dbmap == null || !n.dbmap.isRelational())) {
- n.registerPropLinkFrom (this.node);
- }
- }
-
public String getStringValue () {
switch (type) {
case STRING:
@@ -349,48 +308,6 @@ public final class Property implements IProperty, Serializable, Cloneable {
Node n = nhandle.getNode (node.nmgr);
if (n != null) return n;
}
- /* DbMapping dbm = null;
- //// PROVISIONAL
- if (type == NODE && nvalueID != null) {
- Relation rel = null;
- if (dbm == null && node.dbmap != null) {
- // try to get DbMap for property, if it isn't known yet
- rel = node.dbmap.getPropertyRelation (propname);
- // figure out db mapping from relation
- if (rel != null) {
- // is the property a virtual node containing objects from relational db?
- if (rel.virtual && rel.other.isRelational ())
- return node.nmgr.getNode (node, propname, rel);
- else if (!rel.virtual && rel.direction == Relation.FORWARD)
- return node.nmgr.getNode (node, nvalueID, rel);
- // avoid setting dbm for virtual and groupby relations, except for
- // [mountpoint] kind of prototyped virtual nodes
- else if ((!rel.virtual || rel.prototype != null) && rel.groupby == null)
- dbm = rel.other;
- }
- }
-
- // we have what we need, now get the node from the node manager
- Node retval = node.nmgr.getNode (nvalueID, dbm);
- if (retval != null && retval.parentHandle == null && !"root".equalsIgnoreCase (retval.getPrototype ())) {
- retval.setParent (node);
- retval.setName (propname);
- retval.anonymous = false;
- }
-
- if (retval != null && retval.getDbMapping () == null && rel != null && rel.virtual && rel.prototype == null) {
- // a virtual node whose child nodes are not relational -
- // set up dbmapping that describes subnodes and properties
- DbMapping _dbm = new DbMapping ();
- _dbm.setSubnodeMapping (rel.other);
- _dbm.setPropertyMapping (rel.other);
- _dbm.setSubnodeRelation (rel.getVirtualSubnodeRelation());
- _dbm.setPropertyRelation (rel.getVirtualPropertyRelation());
- retval.setDbMapping (_dbm);
- }
-
- return retval;
- } */
return null;
}
@@ -400,86 +317,9 @@ public final class Property implements IProperty, Serializable, Cloneable {
return null;
}
- public String getEditor () {
- switch (type) {
- case STRING:
- return "password".equalsIgnoreCase (propname) ?
- "" :
- "" ;
- case BOOLEAN:
- return "";
- case INTEGER:
- return "" ;
- case FLOAT:
- return "" ;
- case DATE:
- SimpleDateFormat format = new SimpleDateFormat ("dd.MM.yy hh:mm");
- String date = format.format (new Date (lvalue));
- return "";
- }
- return "";
- }
-
- private String escape (String s) {
- char c[] = new char[s.length()];
- s.getChars (0, c.length, c, 0);
- StringBuffer b = new StringBuffer ();
- int copyfrom = 0;
- for (int i = 0; i < c.length; i++) {
- switch (c[i]) {
- case '\\':
- case '"':
- if (i-copyfrom > 0)
- b.append (c, copyfrom, i-copyfrom);
- b.append ('\\');
- b.append (c[i]);
- copyfrom = i+1;
- }
- }
- if (c.length-copyfrom > 0)
- b.append (c, copyfrom, c.length-copyfrom);
- return b.toString ();
- }
public int getType () {
return type;
-
- }
-
- public String getTypeString () {
- switch (type) {
- case STRING:
- return "string";
- case BOOLEAN:
- return "boolean";
- case DATE:
- return "date";
- case INTEGER:
- return "integer";
- case FLOAT:
- return "float";
- case NODE:
- return "node";
- }
- return "";
- }
-
-
- public Object clone () {
- try {
- Property c = (Property) super.clone();
- c.propname = this.propname;
- c.svalue = this.svalue;
- c.bvalue = this.bvalue;
- c.lvalue = this.lvalue;
- c.dvalue = this.dvalue;
- c.nhandle = this.nhandle;
- c.type = this.type;
- return c;
- } catch (CloneNotSupportedException e) {
- // this shouldn't happen, since we are Cloneable
- throw new InternalError ();
- }
}
}