Interface ObjectBeanPersistenceManager
- All Superinterfaces:
ObjectBeanManager
- All Known Subinterfaces:
WorkflowPersistenceManager
ObjectBeanPersistenceManager
is the primary interface for HST-2-Persistence-aware application components.
An implementation of this interface should be able to convert content nodes to objects, and vice versa. Also it should have knowledges on how to create, update or remove a content node with node type and absolute path.
If the content models are not complex and so just simple node structures are enough for the requirements, then an implementation for this interface can probably provide an automatic bi-directional mappings.
However, in most real cases, the content models are very sophisticated, so they need careful workflow management to fulfill real requirements such as faceted selection, virtual nodes, approval or publishing management. Therefore, this sophisticated management should be implemented properly in separated classes.
Some sophisticated JCR repository engine already have their own workflow knowledges on how to create, update and remove content nodes based on node types. Or, some domain specific content-based application should know the knowledges on their own content models. In these cases, they can provide an implementation for this interface.
-
Method Summary
Modifier and TypeMethodDescriptioncreateAndReturn
(String absPath, String nodeTypeName, String name, boolean autoCreateFolders) Creates content node(s) with the specified node type at the specified absolute path.void
refresh()
InvokesSession.refresh(boolean)
withfalse
parameter.void
refresh
(boolean keepChanges) InvokesSession.refresh(boolean)
.void
Removes the content node which is mapped to the object.void
save()
Saves all pending changes.void
Updates the content node which is mapped to the object.void
update
(Object content, ContentNodeBinder customContentNodeBinder) Updates the content node which is mapped to the object by thecustomContentNodeBinder
provided by client.Methods inherited from interface org.hippoecm.hst.content.beans.manager.ObjectBeanManager
getObject, getObjectByUuid, getSession
-
Method Details
-
createAndReturn
String createAndReturn(String absPath, String nodeTypeName, String name, boolean autoCreateFolders) throws ObjectBeanPersistenceException Creates content node(s) with the specified node type at the specified absolute path.The absolute path could be regarded differently according to physical implementations. For example, an implementation can regard the path as a simple one to create a simple JCR node. On the other hand, a sophisticated implementation can regard the path as an input for a workflow-enabled document/folder path.
If
autoCreateFolders
is true, then folders will be automatically created.- Parameters:
absPath
- the absolute node pathnodeTypeName
- the node type name of the content objectname
- the content node nameautoCreateFolders
- the flag to create folders- Returns:
- the absolute path of the created node
- Throws:
ObjectBeanPersistenceException
-
update
Updates the content node which is mapped to the object.An implementation can provide binding the content object to the physical JCR node(s) and updates. An implementation can provide automatic content binding, or another requires pre-registered
ContentNodeBinder
map to do real bindings. It probably depends on the functionalities of underlying repository.Note: It is recommended as best practice and more semantically correct to always invoke
save()
to commit the changes to the repository after successfulupdate(Object)
call. In the future, the commit or rollback semantics could be more dependent on whethersave()
orrefresh()
/refresh(boolean)
is really invoked.- Parameters:
content
-- Throws:
ObjectBeanPersistenceException
-
update
void update(Object content, ContentNodeBinder customContentNodeBinder) throws ObjectBeanPersistenceException Updates the content node which is mapped to the object by thecustomContentNodeBinder
provided by client.Unlike
update(Object)
, the implementation should not try to do automatic or predefined bindings. Instead, it should invokecustomContentNodeBinder
to do bindings.Therefore, if a developer wants to customize the bindings, the developer should provide a
customContentNodeBinder
.Note: It is recommended as best practice and more semantically correct to always invoke
save()
to commit the changes to the repository after successfulupdate(Object, ContentNodeBinder)
call. In the future, the commit or rollback semantics could be more dependent on whethersave()
orrefresh()
/refresh(boolean)
is really invoked.- Parameters:
content
-customContentNodeBinder
-- Throws:
ObjectBeanPersistenceException
-
remove
Removes the content node which is mapped to the object.- Parameters:
content
-- Throws:
ObjectBeanPersistenceException
-
save
Saves all pending changes.- Throws:
ObjectBeanPersistenceException
-
refresh
InvokesSession.refresh(boolean)
withfalse
parameter.- Throws:
ObjectBeanPersistenceException
-
refresh
InvokesSession.refresh(boolean)
.- Parameters:
keepChanges
-- Throws:
ObjectBeanPersistenceException
-