Implement HopObject.persist() to store HopObjects to db without adding them to any collections.

This commit is contained in:
hns 2005-03-08 11:46:15 +00:00
parent bee76afeb7
commit 78d647f521
2 changed files with 20 additions and 0 deletions

View file

@ -2410,6 +2410,13 @@ public final class Node implements INode, Serializable {
return (dbmap != null) && dbmap.isRelational();
}
/**
* Public method to make a node persistent.
*/
public void persist() {
makePersistable();
}
/**
* Turn node status from TRANSIENT to NEW so that the Transactor will
* know it has to insert this node. Recursively persistifies all child nodes

View file

@ -642,6 +642,19 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco
return false;
}
/**
* Makes the HopObject and all its reachable descendants persistent.
*
* @return the ID of the newly persisted HopObject or null if operation failed
*/
public Object jsFunction_persist() {
if (node instanceof helma.objectmodel.db.Node) {
((helma.objectmodel.db.Node) node).persist();
return node.getID();
}
return null;
}
/**
* Invalidate the node itself or a subnode
*/