Interface PersistenceManager
- All Known Implementing Classes:
StandardPersistenceManager
Supported API: true
Extendable: false
-
Method Summary
Modifier and TypeMethodDescriptionRemoves the specified persistable objects from the datastore.delete(Persistable obj) Removes the given persistable object from the datastore.find(Class targetLinkClass, ObjectIdentifier obj1Oid, String obj1Role, ObjectIdentifier obj2Oid) Retrieves any and all link objects that exist between two Persistable objects given their object identifiers.find(Class targetLinkClass, Persistable obj1, String obj1Role, Persistable obj2) Retrieves any and all link objects that exist between two given Persistable objects.find(StatementSpec a_statementSpec) Retrieves persistable objects from the datastore given the specified statement.find(StatementSpec a_statementSpec, ResultProcessor a_resultProcessor) Retrieves persistable objects from the datastore for the specified statement.getCurrentSequence(Class a_class) Given the sequence class, return the sequence inrement.getCurrentSequence(Class a_class, String AttributeName) Given the class for the column sequence as required input, and attribute name for the column sequence, return the current sequence.getLob(LobLocator lob) Returns an input stream to the Lob associated with the given lob locator.getNextSequence(Class a_class) Given the sequence class as input, return the next value.getNextSequence(Class a_class, String attributeName) Given the class for the column sequence as required input, and attribute name for the column sequence, return the next sequence.getSequenceIncrement(Class a_class) Given the sequence class, return the current sequence.getSequenceIncrement(Class a_class, String AttributeName) Given the class for the column sequence as required input, and attribute name for the column sequence, return the sequence inrement.modify(WTCollection a_objects) Updates the specified Persistable objects in the datastore.modify(Persistable obj) Updates the given Persistable object in the datastore.modify(Persistable obj, String attrName, ObjectMappable objAttr) Updates the given Persistable object in the datastore with the values specified in the ObjectMappable attribute.navigate(Persistable obj, String role, Class linkClass) Retrieves objects related to the given persistable object given a role and link class.navigate(Persistable obj, String role, Class linkClass, boolean onlyOtherSide) Retrieves objects related to the given persistable object given a role and link class.navigate(Persistable obj, String role, QuerySpec criteria) Retrieves objects related to the given persistable object given a role, an association name and selection criteria.navigate(Persistable obj, String role, QuerySpec criteria, boolean onlyOtherSide) Retrieves objects related to the given persistable object given a role, an association name and selection criteria.refresh(ObjectIdentifier objId) Retrieves a Persistable object from the database given its object identifier.refresh(ObjectIdentifier objId, boolean lock) Retrieves a Persistable object from the database given its object identifier.refresh(Persistable obj) Retrieves the given Persistable object from the database to restore its state.refresh(Persistable obj, boolean fullRefresh) Retrieves the given Persistable object from the database to restore its state.refresh(Persistable obj, boolean fullRefresh, boolean inPlace) Retrieves the given Persistable object from the database to restore its state.refresh(Persistable obj, boolean fullRefresh, boolean inPlace, boolean lock) Retrieves the given Persistable object from the database to restore its state.save(WTCollection objects) Invokes the modify method on the objects that are already persisted, otherwise invokes the store method.save(Persistable obj) Invokes the modify method if the given object is persistent, otherwise the save method invokes the store method.store(WTCollection a_objects) Stores the specified collection of Persistable objects in the datastore.store(WTCollection a_objects, wt.fc.WTCollectionExceptionHandler a_handler) Stores the specified collection of Persistable objects in the datastore.store(Persistable obj) Stores the specified Persistable object in the datastore.
-
Method Details
-
delete
Removes the given persistable object from the datastore. If the given Persistable object participates as either a role A or role B member, then referential integrity processing will occur as specified for that role. The delete method ensures that the operation is valid before removing the Persistable object from the datastore.The target for this operations dispatched event is the specified Persistable object for a single object event listener and a WTCollection containing the specified Persistable object for a multiple object event listener. Note that the PRE_REMOVE event is not supported for a single object event listener.
The delete performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_DELETEevent. - Ensures that this Persistable object is persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()). - Uses Access Control to determine if the user is allowed to delete this business object.
-
Deletes associated
BinaryLinkobjects that are owned by the role object that is being deleted. -
Dispatches a
PersistenceManagerEvent.CLEANUP_LINKevent. -
Dispatches a
PersistenceManagerEvent.PRE_REMOVEevent. - Deletes this Persistable object in the database, ensuring that the object has not gone stale (that is, someone else has already modified this object in the database).
- Sets new values in the persistent information attributes to indicate that this object has been deleted.
-
Dispatches a
PersistenceManagerEvent.REMOVEevent. -
If this object is of type
BinaryLink, then any cascaded role objects are deleted. -
Dispatches a
PersistenceManagerEvent.POST_DELETEevent. - Returns the Persistable object to the caller.
Before the commit of the transaction that this delete operation occurs in, the persistence service verifies that no
BinaryLinkobjects exist that reference any of the removed objects.
Supported API: true- Parameters:
obj- The object to be deleted from the datastore.- Returns:
- Persistable
- Throws:
WTException- See Also:
-
Dispatches a
-
find
QueryResult find(Class targetLinkClass, Persistable obj1, String obj1Role, Persistable obj2) throws WTException Retrieves any and all link objects that exist between two given Persistable objects. The method validates the resulting set of link objects retrieved from the database before returning them to the invoking method.
Supported API: true- Parameters:
targetLinkClass-obj1-obj1Role-obj2-- Returns:
- QueryResult
- Throws:
WTException
-
find
QueryResult find(Class targetLinkClass, ObjectIdentifier obj1Oid, String obj1Role, ObjectIdentifier obj2Oid) throws WTException, InvalidRoleException Retrieves any and all link objects that exist between two Persistable objects given their object identifiers. The method validates the resulting set of link objects retrieved from the database before returning them to the invoking method.
Supported API: true- Parameters:
targetLinkClass-obj1Oid-obj1Role-obj2Oid-- Returns:
- QueryResult
- Throws:
WTExceptionInvalidRoleException
-
getLob
Returns an input stream to the Lob associated with the given lob locator.
Supported API: true- Parameters:
lob- the Lob locator.- Returns:
- InputStream
- Throws:
WTException
-
modify
Updates the given Persistable object in the datastore. The modify method ensures that the operation is valid before updating the Persistable object in the datastore.The target for this operations dispatched event is the specified Persistable object for a single object event listener and a WTCollection containing the specified Persistable object for a multiple object event listener.
The modify method performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_MODIFYevent. - Ensures that this Persistable object is persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()). - Uses Access Control to determine if the user is allowed to modify this business object.
- Updates this Persistable object in the database, ensuring that the object has not gone stale (that is, someone else has already modified this object in the database). Note that any attributes derived from values that exist in other tables are not updated in the database.
- Sets new values in the persistent information attributes, such as update count and modify timestamp.
-
Dispatches a
PersistenceManagerEvent.UPDATEevent. -
Dispatches a
PersistenceManagerEvent.POST_MODIFYevent. - Returns the Persistable object to the caller.
Supported API: true- Parameters:
obj- The object to be modified in the datastore- Returns:
- Persistable
- Throws:
WTException
-
Dispatches a
-
refresh
Persistable refresh(Persistable obj, boolean fullRefresh) throws WTException, ObjectNoLongerExistsException Retrieves the given Persistable object from the database to restore its state. The object is not refreshed in place.
Supported API: true- Parameters:
obj- The persistable object to be refreshedfullRefresh- Set to true if the object references for the target object should be refreshed as well.- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException
-
refresh
Retrieves the given Persistable object from the database to restore its state. Object references for the target object are not refreshed and the object is not refreshed in place.
Supported API: true- Parameters:
obj- The persistable object to be refreshed- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException
-
refresh
Retrieves a Persistable object from the database given its object identifier. Object references of the target object are not refreshed.
Supported API: true- Parameters:
objId-- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException
-
save
Invokes the modify method if the given object is persistent, otherwise the save method invokes the store method.
Supported API: true- Parameters:
obj- The persistable object to be saved- Returns:
- Persistable
- Throws:
WTException
-
store
Stores the specified Persistable object in the datastore. The store method ensures that the operation is valid before storing the Persistable object in the datastore.The target for this operations dispatched event is the specified Persistable object for a single object event listener and a WTCollection containing the specified Persistable object for a multiple object event listener.
The store method performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_STOREevent. - Ensures that this Persistable object is not yet persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()). - Uses Access Control to determine if the user is allowed to create this business object.
- Inserts the Persistable object into the database and, in so doing, assigns an ObjectIdentifier and initializes the persistence information.
-
Dispatches a
PersistenceManagerEvent.INSERTevent. -
Dispatches a
PersistenceManagerEvent.POST_STOREevent. - Returns the Persistable object to the caller.
Supported API: true- Parameters:
obj- The object to be stored in the datastore- Returns:
- Persistable
- Throws:
WTException
-
Dispatches a
-
modify
Updates the given Persistable object in the datastore with the values specified in the ObjectMappable attribute.
Supported API: true- Parameters:
obj-attrName-objAttr-- Returns:
- Persistable
- Throws:
WTException
-
find
Retrieves persistable objects from the datastore given the specified statement. The find methods validates the resulting set of objects that were retrieved from the datastore before returning them to the invoking method.
Supported API: true- Parameters:
a_statementSpec- The search criteria to use for the find- Returns:
- QueryResult
- Throws:
WTException
-
refresh
Persistable refresh(Persistable obj, boolean fullRefresh, boolean inPlace) throws WTException, ObjectNoLongerExistsException Retrieves the given Persistable object from the database to restore its state.
Supported API: true- Parameters:
obj- The persistable object to be refreshedfullRefresh- Set to true if the object references for the target object should be refreshed as well.inPlace- Set to true if the target object should be refreshed in place.- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException- See Also:
-
find
ResultProcessor find(StatementSpec a_statementSpec, ResultProcessor a_resultProcessor) throws WTException Retrieves persistable objects from the datastore for the specified statement. The find methods validates the resulting set of objects that were retrieved from the datastore before returning via the specified ResultProcessor.
Supported API: true- Parameters:
a_statementSpec-a_resultProcessor-- Returns:
- ResultProcessor
- Throws:
WTException
-
refresh
Persistable refresh(Persistable obj, boolean fullRefresh, boolean inPlace, boolean lock) throws WTException, ObjectNoLongerExistsException Retrieves the given Persistable object from the database to restore its state.
Supported API: true- Parameters:
obj- The persistable object to be refreshedfullRefresh- Set to true if the object references for the target object should be refreshed as well.inPlace- Set to true if the target object should be refreshed in place.lock- Specifies whether the object should be locked as part of the refresh. This value should only be true when the call is within the context of a server-side transaction.- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException- See Also:
-
store
WTCollection store(WTCollection a_objects, wt.fc.WTCollectionExceptionHandler a_handler) throws WTException Stores the specified collection of Persistable objects in the datastore. The store method ensures that the operation is valid before storing the Persistable objects in the datastore.The target for this operations dispatched event is a Persistable object for a single object event listener (the listener is called once for each object in the collection) and the specified collection of Persistable objects for a multiple object event listener.
The store method performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_STOREevent. - Ensures that each Persistable object is not yet persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()for each object). - Uses Access Control to determine if the user is allowed to create each business object.
- Inserts the Persistable objects into the database and, in so doing, assigns each an ObjectIdentifier and initializes the persistence information.
-
Dispatches a
PersistenceManagerEvent.INSERTevent. -
Dispatches a
PersistenceManagerEvent.POST_STOREevent. - Returns the collection of Persistable objects to the caller.
Supported API: true- Parameters:
a_objects- The objects to be stored in the datastorea_handler- Specifies a custom handler for processing any exceptions that occur. If null, then default processing will be used.- Returns:
- WTCollection
- Throws:
WTException
-
Dispatches a
-
delete
Removes the specified persistable objects from the datastore. If a given Persistable object in the set participates as either a role A or role B member, then referential integrity processing will occur as specified for that role. The delete method ensures that the operation is valid before removing the Persistable objects from the datastore.The target for this operations dispatched event is the specified Persistable object for a single object event listener (the listener is called once for each object in the collection) and a WTCollection containing the specified Persistable object for a multiple object event listener. Note that the PRE_REMOVE event is not supported for a single object event listener.
The delete performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_DELETEevent. - Ensures that this Persistable objects are persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()for each object). - Uses Access Control to determine if the user is allowed to delete the business objects.
-
Deletes associated
BinaryLinkobjects that are owned by the role objects that are being deleted. -
Dispatches a
PersistenceManagerEvent.CLEANUP_LINKevent. -
Dispatches a
PersistenceManagerEvent.PRE_REMOVEevent. - Deletes the Persistable objects in the datastore, ensuring that the objects have not gone stale (that is, someone else has already modified this object in the datastore).
- Sets new values in the persistent information attributes to indicate that this objects have been deleted.
-
Dispatches a
PersistenceManagerEvent.REMOVEevent. -
For any objects that are of type
BinaryLink, cascaded role objects are deleted. -
Dispatches a
PersistenceManagerEvent.POST_DELETEevent. - Returns the collection of Persistable objects to the caller.
Before the commit of the transaction that this delete operation occurs in, the persistence service verifies that no
BinaryLinkobjects exist that reference any of the removed objects.
Supported API: true- Parameters:
a_objects- The objects to be deleted from the datastore.- Returns:
- WTSet
- Throws:
WTException- See Also:
-
Dispatches a
-
save
Invokes the modify method on the objects that are already persisted, otherwise invokes the store method.
Supported API: true- Parameters:
objects- The persistable objects to be saved- Returns:
- WTCollection
- Throws:
WTException
-
getNextSequence
Given the sequence class as input, return the next value. The specified sequence class must implement the DatastoreSequence interface.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
getNextSequence
Given the class for the column sequence as required input, and attribute name for the column sequence, return the next sequence. The specified attribute must be specified as sequence type.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
getSequenceIncrement
Given the class for the column sequence as required input, and attribute name for the column sequence, return the sequence inrement. The specified attribute must be specified as sequence type.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
getSequenceIncrement
Given the sequence class, return the current sequence. The specified sequence class must implement the DatastoreSequence interface.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
getCurrentSequence
Given the class for the column sequence as required input, and attribute name for the column sequence, return the current sequence. The specified attribute must be specified as sequence type.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
getCurrentSequence
Given the sequence class, return the sequence inrement. The specified sequence class must implement the DatastoreSequence interface.
Supported API: true- Parameters:
a_class-- Returns:
- String
- Throws:
WTException
-
refresh
Persistable refresh(ObjectIdentifier objId, boolean lock) throws WTException, ObjectNoLongerExistsException Retrieves a Persistable object from the database given its object identifier. Object references of the target object are not refreshed.
Supported API: true- Parameters:
objId-lock-- Returns:
- Persistable
- Throws:
WTExceptionObjectNoLongerExistsException
-
store
Stores the specified collection of Persistable objects in the datastore. The store method ensures that the operation is valid before storing the Persistable objects in the datastore.The target for this operations dispatched event is a Persistable object for a single object event listener (the listener is called once for each object in the collection) and the specified collection of Persistable objects for a multiple object event listener.
The store method performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_STOREevent. - Ensures that each Persistable object is not yet persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()for each object). - Uses Access Control to determine if the user is allowed to create each business object.
- Inserts the Persistable objects into the database and, in so doing, assigns each an ObjectIdentifier and initializes the persistence information.
-
Dispatches a
PersistenceManagerEvent.INSERTevent. -
Dispatches a
PersistenceManagerEvent.POST_STOREevent. - Returns the collection of Persistable objects to the caller.
Supported API: true- Parameters:
a_objects- The objects to be stored in the datastore- Returns:
- WTCollection
- Throws:
WTException
-
Dispatches a
-
modify
Updates the specified Persistable objects in the datastore. The modify method ensures that the operation is valid before updating the Persistable objects in the datastore.The target for this operations dispatched event is the specified Persistable object for a single object event listener (the listener is called once for each object in the collection) and a WTCollection containing the specified Persistable object for a multiple object event listener.
The modify method performs the following operations.
-
Dispatches a
PersistenceManagerEvent.PRE_MODIFYevent. - Ensures that each Persistable object is persistent.
-
Ensures that attributes are valid (by invoking
Persistable.checkAttributes()for each object). - Uses Access Control to determine if the user is allowed to modify each business object.
- Updates the Persistable objects in the database, ensuring that the objects have not gone stale (that is, someone else has already modified this object in the database). Note that any attributes derived from values that exist in other tables are not updated in the database.
- Sets new values in the persistent information attributes, such as update count and modify timestamp.
-
Dispatches a
PersistenceManagerEvent.UPDATEevent. -
Dispatches a
PersistenceManagerEvent.POST_MODIFYevent. - Returns the collection of Persistable objects to the caller.
Supported API: true- Parameters:
a_objects- The objects to be modified in the datastore- Returns:
- WTCollection
- Throws:
WTException
-
Dispatches a
-