public class WorkflowPersistenceManagerImpl extends ObjectBeanManagerImpl implements WorkflowPersistenceManager
WorkflowPersistenceManager
interface with Hippo Repository Workflow API.
This implementation does not provide automatic bindings from content object to JCR node(s).
So, client codes should provide custom binders for their own node types. These custom binders map can be
given by a constructor argument, or a custom binder can be given by an argument of update(Object, ContentNodeBinder)
method.
Another useful option is to make a content POJO object implement ContentNodeBinder
interface.
When client codes invoke update(Object)
method, this implementation will look up the custom binder
from the internal map at first. If there's nothing found, then this implementation will check if the content POJO
object is an instance of ContentNodeBinder
. If it is, this implementation will use the content POJO object itself
as a ContentNodeBinder
.
If this implementation cannot find any ContentNodeBinder
, it will do updating the content without any bindings.
Modifier and Type | Field and Description |
---|---|
protected Map<String,ContentNodeBinder> |
contentNodeBinders
Custom content node binders map, which is used to look up a custom binder for a node type.
|
protected String |
defaultWorkflowCategory
The workflow category name to localize the new document
|
protected String |
documentAdditionWorkflowCategory
The workflow category name to add a new document.
|
protected String |
documentNodeWorkflowCategory
The workflow category name to get a document workflow.
|
protected String |
folderAdditionWorkflowCategory
The workflow category name to add a new folder.
|
protected String |
folderNodeTypeName
Hippo Repository specific predefined folder node type name
|
protected String |
folderNodeWorkflowCategory
The workflow category name to get a folder workflow.
|
protected StringCodec |
uriEncoding
The codec which is used for the node names
|
protected QualifiedWorkflowCallbackHandler |
workflowCallbackHandler
Qualified Workflow callback handler
|
objectConverter, session
Constructor and Description |
---|
WorkflowPersistenceManagerImpl(javax.jcr.Session session,
ObjectConverter objectConverter)
Constructor
|
WorkflowPersistenceManagerImpl(javax.jcr.Session session,
ObjectConverter objectConverter,
Map<String,ContentNodeBinder> contentNodeBinders)
Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
createAndReturn(String absPath,
String nodeTypeName,
String name,
boolean autoCreateFolders)
Creates content node(s) with the specified node type at the specified absolute path.
|
protected javax.jcr.Node |
createMissingFolders(String absPath) |
protected String |
createNodeByWorkflow(javax.jcr.Node folderNode,
String nodeTypeName,
String name) |
String |
getDocumentAdditionWorkflowCategory()
Gets the workflow category name used to add a document.
|
String |
getDocumentNodeWorkflowCategory()
Gets the workflow category name used to get a document workflow.
|
String |
getFolderAdditionWorkflowCategory()
Gets the workflow category name used to add a folder.
|
String |
getFolderNodeTypeName()
Gets the folder node type name which is used to create folders.
|
String |
getFolderNodeWorkflowCategory()
Gets the workflow category name used to get a folder workflow.
|
Workflow |
getWorkflow(String category,
Document document) |
Workflow |
getWorkflow(String category,
javax.jcr.Node node) |
void |
refresh()
Invokes
Session.refresh(boolean) with false parameter. |
void |
refresh(boolean keepChanges)
Invokes
Session.refresh(boolean) . |
void |
remove(Object content)
Removes the content node which is mapped to the object.
|
void |
save()
Saves all pending changes.
|
void |
setDocumentAdditionWorkflowCategory(String documentAdditionWorkflowCategory)
Sets the workflow category name used to add a document.
|
void |
setDocumentNodeWorkflowCategory(String documentNodeWorkflowCategory)
Sets the workflow category name used to get a document workflow.
|
void |
setFolderAdditionWorkflowCategory(String folderAdditionWorkflowCategory)
Sets the workflow category name used to add a folder.
|
void |
setFolderNodeTypeName(String folderNodeTypeName)
Sets the folder node type name which is used to create folders.
|
void |
setFolderNodeWorkflowCategory(String folderNodeWorkflowCategory)
Sets the workflow category name used to get a folder workflow.
|
void |
setWorkflowCallbackHandler(QualifiedWorkflowCallbackHandler<? extends Workflow> workflowCallbackHandler) |
void |
update(Object content)
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 the
customContentNodeBinder
provided by client. |
getObject, getObjectByUuid, getSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getObject, getObjectByUuid, getSession
protected Map<String,ContentNodeBinder> contentNodeBinders
protected String folderNodeTypeName
protected String folderNodeWorkflowCategory
protected String documentNodeWorkflowCategory
protected String documentAdditionWorkflowCategory
protected String folderAdditionWorkflowCategory
protected QualifiedWorkflowCallbackHandler workflowCallbackHandler
protected StringCodec uriEncoding
protected String defaultWorkflowCategory
public WorkflowPersistenceManagerImpl(javax.jcr.Session session, ObjectConverter objectConverter)
session
- the session for this manager contextobjectConverter
- the object converter to do mapping from JCR nodes to content POJO objectspublic WorkflowPersistenceManagerImpl(javax.jcr.Session session, ObjectConverter objectConverter, Map<String,ContentNodeBinder> contentNodeBinders)
session
- the session for this manager contextobjectConverter
- the object converter to do mapping from JCR nodes to content POJO objectscontentNodeBinders
- the predefined content node binders map which item is node type name key and custom binder object value.public String createAndReturn(String absPath, String nodeTypeName, String name, boolean autoCreateFolders) throws ObjectBeanPersistenceException
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.
createAndReturn
in interface ObjectBeanPersistenceManager
absPath
- the absolute node pathnodeTypeName
- the node type name of the content objectname
- the content node nameautoCreateFolders
- the flag to create foldersObjectBeanPersistenceException
protected javax.jcr.Node createMissingFolders(String absPath) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
protected String createNodeByWorkflow(javax.jcr.Node folderNode, String nodeTypeName, String name) throws ObjectBeanPersistenceException
ObjectBeanPersistenceException
public void update(Object content) throws ObjectBeanPersistenceException
This will look up a proper custom content node binder from the internal map. (contentNodeBinders
).
If it is not found there, this implementation will check if the content object is an instance of ContentNodeBinder
interface.
If so, the content object will be used as a custom binder.
If there's no content node binder found, then this implementation will do updating only without any bindings.
update
in interface ObjectBeanPersistenceManager
content
- the object to updateObjectBeanPersistenceException
public void update(Object content, ContentNodeBinder customContentNodeBinder) throws ObjectBeanPersistenceException
customContentNodeBinder
provided by client.
Unlike update(Object)
, the implementation should not try to do automatic or predefined bindings.
Instead, it should invoke customContentNodeBinder
to do bindings.
Therefore, if a developer wants to customize the bindings, the developer should provide a customContentNodeBinder
.
update
in interface ObjectBeanPersistenceManager
content
- the object to updatecustomContentNodeBinder
- the custom ContentNodeBinder
ObjectBeanPersistenceException
public void remove(Object content) throws ObjectBeanPersistenceException
remove
in interface ObjectBeanPersistenceManager
content
- the object to removeObjectBeanPersistenceException
public void save() throws ObjectBeanPersistenceException
save
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void refresh() throws ObjectBeanPersistenceException
Session.refresh(boolean)
with false
parameter.refresh
in interface ObjectBeanPersistenceManager
ObjectBeanPersistenceException
public void refresh(boolean keepChanges) throws ObjectBeanPersistenceException
Session.refresh(boolean)
.refresh
in interface ObjectBeanPersistenceManager
keepChanges
- whether to keep changes or notObjectBeanPersistenceException
public void setFolderNodeTypeName(String folderNodeTypeName)
folderNodeTypeName
- the name of the folderpublic String getFolderNodeTypeName()
folderNodeTypeName
public String getFolderNodeWorkflowCategory()
folderNodeWorkflowCategory
public void setFolderNodeWorkflowCategory(String folderNodeWorkflowCategory)
folderNodeWorkflowCategory
- sets the folderNodeWorkflowCategorypublic String getDocumentNodeWorkflowCategory()
public void setDocumentNodeWorkflowCategory(String documentNodeWorkflowCategory)
documentNodeWorkflowCategory
- the documentNodeWorkflowCategory to setpublic String getFolderAdditionWorkflowCategory()
public void setFolderAdditionWorkflowCategory(String folderAdditionWorkflowCategory)
folderAdditionWorkflowCategory
- the folderAdditionWorkflowCategory to setpublic String getDocumentAdditionWorkflowCategory()
public void setDocumentAdditionWorkflowCategory(String documentAdditionWorkflowCategory)
documentAdditionWorkflowCategory
- the documentAdditionWorkflowCategory to setpublic void setWorkflowCallbackHandler(QualifiedWorkflowCallbackHandler<? extends Workflow> workflowCallbackHandler)
setWorkflowCallbackHandler
in interface WorkflowPersistenceManager
public Workflow getWorkflow(String category, javax.jcr.Node node) throws javax.jcr.RepositoryException
getWorkflow
in interface WorkflowPersistenceManager
javax.jcr.RepositoryException
public Workflow getWorkflow(String category, Document document) throws javax.jcr.RepositoryException
getWorkflow
in interface WorkflowPersistenceManager
javax.jcr.RepositoryException
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.