diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index 5329074e..3285bf70 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -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 diff --git a/src/helma/scripting/rhino/HopObject.java b/src/helma/scripting/rhino/HopObject.java index 27886abb..3d97bef1 100644 --- a/src/helma/scripting/rhino/HopObject.java +++ b/src/helma/scripting/rhino/HopObject.java @@ -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 */