Implement HopObject.persist() to store HopObjects to db without adding them to any collections.
This commit is contained in:
parent
bee76afeb7
commit
78d647f521
2 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue