Class AmetysObjectWorkflowStore
- java.lang.Object
-
- org.ametys.plugins.workflow.store.AbstractJackrabbitWorkflowStore
-
- org.ametys.plugins.workflow.store.AmetysObjectWorkflowStore
-
- All Implemented Interfaces:
com.opensymphony.workflow.spi.WorkflowStore
,AmetysWorkflowStore
- Direct Known Subclasses:
WebAmetysObjectWorkflowStore
public class AmetysObjectWorkflowStore extends AbstractJackrabbitWorkflowStore
Workflow store that creates local entries for an Ametys object. Each entry belong to an ametys object as soon as the entry is created.
-
-
Field Summary
Fields Modifier and Type Field Description protected WorkflowAwareAmetysObject
_ametysObject
The ametys objectprotected com.opensymphony.workflow.spi.WorkflowEntry
_inMemoryEntry
Temporary entry created in memoryprivate boolean
_preserveHistory
-
Fields inherited from class org.ametys.plugins.workflow.store.AbstractJackrabbitWorkflowStore
__ACTION_ID_PROPERTY, __CALLER_PROPERTY, __CURRENT_STEP_NODE, __DUE_DATE_PROPERTY, __ENTRY_NODE_PREFIX, __ENTRY_NT, __FINISH_DATE_PROPERTY, __HISTORY_STEP_NODE, __ID_PROPERTY, __NAMESPACE, __NAMESPACE_PREFIX, __NEXT_ENTRY_ID_PROPERTY, __NEXT_STEP_ID_PROPERTY, __NM_PREFIX, __OWNER_PROPERTY, __PREVIOUS_STEPS_PROPERTY, __ROOT_NODE, __ROOT_NT, __START_DATE_PROPERTY, __STATE_PROPERTY, __STATUS_PROPERTY, __STEP_ID_PROPERTY, __STEP_NT, __WF_NAME_PROPERTY, _log, _repository
-
-
Constructor Summary
Constructors Constructor Description AmetysObjectWorkflowStore(Repository repository, WorkflowAwareAmetysObject ametysObject)
Creates a workflow store for Ametys object.AmetysObjectWorkflowStore(Repository repository, WorkflowAwareAmetysObject ametysObject, boolean preserveHistory)
Creates a workflow store for Ametys object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_createRootNode()
Create the root node.private WorkflowAwareAmetysObject
_ensureBaseVersion(WorkflowAwareAmetysObject ametysObject)
protected Node
_getAmetysObjectNode()
Provides the ametys object node in the current sessionprotected long
_getNextEntryId()
Generate an unique entry id.protected Node
_getOrCreateParentEntryNode(Node root, long id)
Retrieves the parent node of a workflow entry.protected Node
_getRootNode(Session session)
Get the workflow store root nodeprotected Session
_getSession()
Open a session to the _repository.protected void
_release(Session session)
Release a session.void
bindAmetysObject(WorkflowAwareAmetysObject ametysObject)
Bind an ametys object to this store.WorkflowAwareAmetysObject
getAmetysObject()
Ametys object getterboolean
shouldClearHistory()
Returns true if the history steps have to be removed when the workflow reaches its final stepprotected void
storeNewEntry(com.opensymphony.workflow.spi.WorkflowEntry workflowEntry)
Store a new workflow entry into the JCR repository-
Methods inherited from class org.ametys.plugins.workflow.store.AbstractJackrabbitWorkflowStore
__toCalendar, _getNextStepId, buildFieldExpression, buildNestedExpression, clearHistory, createCurrentStep, createEntry, deleteInstance, findCurrentSteps, findEntry, findHistorySteps, getCondition, getEntryNode, getFirstFieldExpression, getHistoryStepNode, getPredicate, getPropertyName, getPropertySet, getSortCriteria, init, markFinished, moveToHistory, query, query, removeEntry, setEntryState, translateValue
-
-
-
-
Field Detail
-
_ametysObject
protected WorkflowAwareAmetysObject _ametysObject
The ametys object
-
_inMemoryEntry
protected com.opensymphony.workflow.spi.WorkflowEntry _inMemoryEntry
Temporary entry created in memory
-
_preserveHistory
private boolean _preserveHistory
-
-
Constructor Detail
-
AmetysObjectWorkflowStore
public AmetysObjectWorkflowStore(Repository repository, WorkflowAwareAmetysObject ametysObject)
Creates a workflow store for Ametys object. The history steps will be clear on workflow completion.- Parameters:
repository
- the JCR Repository to use.ametysObject
- The ametys object for this store. Can be null in case of an object creation.
-
AmetysObjectWorkflowStore
public AmetysObjectWorkflowStore(Repository repository, WorkflowAwareAmetysObject ametysObject, boolean preserveHistory)
Creates a workflow store for Ametys object.- Parameters:
repository
- the JCR Repository to use.ametysObject
- The ametys object for this store. Can be null in case of an object creation.preserveHistory
- Set to true to preserve history steps when workflow is complete.
-
-
Method Detail
-
shouldClearHistory
public boolean shouldClearHistory()
Description copied from interface:AmetysWorkflowStore
Returns true if the history steps have to be removed when the workflow reaches its final step- Returns:
- true if the history history has to be cleared.
-
getAmetysObject
public WorkflowAwareAmetysObject getAmetysObject()
Ametys object getter- Returns:
- The ametys object
-
_getSession
protected Session _getSession() throws RepositoryException
Description copied from class:AbstractJackrabbitWorkflowStore
Open a session to the _repository.- Overrides:
_getSession
in classAbstractJackrabbitWorkflowStore
- Returns:
- the session opened.
- Throws:
RepositoryException
- if an error occurs.
-
_release
protected void _release(Session session)
Description copied from class:AbstractJackrabbitWorkflowStore
Release a session.Default implementation calls logout on the session.
- Overrides:
_release
in classAbstractJackrabbitWorkflowStore
- Parameters:
session
- the session to release.
-
_getAmetysObjectNode
protected Node _getAmetysObjectNode() throws RepositoryException
Provides the ametys object node in the current session- Returns:
- node
- Throws:
RepositoryException
- on repository error
-
_createRootNode
protected void _createRootNode() throws RepositoryException
Description copied from class:AbstractJackrabbitWorkflowStore
Create the root node.- Specified by:
_createRootNode
in classAbstractJackrabbitWorkflowStore
- Throws:
RepositoryException
- if an error occurs.
-
_getRootNode
protected Node _getRootNode(Session session) throws RepositoryException
Description copied from class:AbstractJackrabbitWorkflowStore
Get the workflow store root node- Specified by:
_getRootNode
in classAbstractJackrabbitWorkflowStore
- Parameters:
session
- the session to use- Returns:
- The workflow store root node
- Throws:
RepositoryException
- if an error occurs.
-
_getOrCreateParentEntryNode
protected Node _getOrCreateParentEntryNode(Node root, long id) throws RepositoryException
Description copied from class:AbstractJackrabbitWorkflowStore
Retrieves the parent node of a workflow entry. Creates non existing ancestor nodes when necessary.- Specified by:
_getOrCreateParentEntryNode
in classAbstractJackrabbitWorkflowStore
- Parameters:
root
- The workflow store root nodeid
- The workflow entry id- Returns:
- The parent node
- Throws:
RepositoryException
- on repository error
-
_getNextEntryId
protected long _getNextEntryId() throws RepositoryException
Description copied from class:AbstractJackrabbitWorkflowStore
Generate an unique entry id.- Overrides:
_getNextEntryId
in classAbstractJackrabbitWorkflowStore
- Returns:
- A new entry id.
- Throws:
RepositoryException
- if an error occurs.
-
storeNewEntry
protected void storeNewEntry(com.opensymphony.workflow.spi.WorkflowEntry workflowEntry) throws com.opensymphony.workflow.StoreException
Store a new workflow entry into the JCR repository- Overrides:
storeNewEntry
in classAbstractJackrabbitWorkflowStore
- Parameters:
workflowEntry
- The new entry- Throws:
com.opensymphony.workflow.StoreException
- on error
-
bindAmetysObject
public void bindAmetysObject(WorkflowAwareAmetysObject ametysObject) throws com.opensymphony.workflow.StoreException
Bind an ametys object to this store. Must be done in case of an object creation. As soon as the ametys object is created, the store must be notified to persist the workflow entry into the repository.- Parameters:
ametysObject
- The ametys object to bind- Throws:
com.opensymphony.workflow.StoreException
- on error
-
_ensureBaseVersion
private WorkflowAwareAmetysObject _ensureBaseVersion(WorkflowAwareAmetysObject ametysObject)
-
-