public abstract class AbstractJackrabbitWorkflowStore extends Object implements AmetysWorkflowStore
Modifier and Type | Field and Description |
---|---|
(package private) static String |
__ACTION_ID_PROPERTY
Action id property for step node.
|
(package private) static String |
__CALLER_PROPERTY
Caller property for step node.
|
(package private) static String |
__CURRENT_STEP_NODE
Current step node name.
|
(package private) static String |
__DUE_DATE_PROPERTY
Due date property for step node.
|
(package private) static String |
__ENTRY_NODE_PREFIX
Entry node name prefix.
|
(package private) static String |
__ENTRY_NT
Entry node type.
|
(package private) static String |
__FINISH_DATE_PROPERTY
Finish date property for step node.
|
(package private) static String |
__HISTORY_STEP_NODE
History step node name.
|
(package private) static String |
__ID_PROPERTY
ID for entry and step node.
|
static String |
__NAMESPACE
Namespace for node type names, node names and property names.
|
static String |
__NAMESPACE_PREFIX
Prefix used for this namespace.
|
(package private) static String |
__NEXT_ENTRY_ID_PROPERTY
Next entry id property for root node.
|
(package private) static String |
__NEXT_STEP_ID_PROPERTY
Next step id property for entry node.
|
static String |
__NM_PREFIX
Prefix with colon for this namespace.
|
(package private) static String |
__OWNER_PROPERTY
Owner property for step node.
|
(package private) static String |
__PREVIOUS_STEPS_PROPERTY
Previous steps ids property for step node.
|
(package private) static String |
__ROOT_NODE
Root node name.
|
static String |
__ROOT_NT
Root node type.
|
(package private) static String |
__START_DATE_PROPERTY
Start date property for step node.
|
(package private) static String |
__STATE_PROPERTY
State property for entry node.
|
(package private) static String |
__STATUS_PROPERTY
Status property for step node.
|
(package private) static String |
__STEP_ID_PROPERTY
Step id property for step node.
|
(package private) static String |
__STEP_NT
Step node type.
|
(package private) static String |
__WF_NAME_PROPERTY
Workflow name property for entry node.
|
protected Log |
_log
Log instance for logging events, errors, warnigs, etc.
|
protected Repository |
_repository
JCR Repsoitory
|
Constructor and Description |
---|
AbstractJackrabbitWorkflowStore(Repository repository)
Create a JackrabbitWorkflowStore.
|
Modifier and Type | Method and Description |
---|---|
protected static Calendar |
__toCalendar(Date date)
Convert a Date to a Calendar.
|
protected abstract void |
_createRootNode()
Create the root node.
|
protected long |
_getNextEntryId()
Generate an unique entry id.
|
protected long |
_getNextStepId(Node entry)
Generate an unique step id for an entry.
|
protected abstract Node |
_getOrCreateParentEntryNode(Node root,
long id)
Retrieves the parent node of a workflow entry.
|
protected abstract Node |
_getRootNode(Session session)
Get the workflow store root node
|
protected Session |
_getSession()
Open a session to the _repository.
|
protected void |
_release(Session session)
Release a session.
|
private String |
buildFieldExpression(com.opensymphony.workflow.query.FieldExpression expr)
Build a field expression.
|
protected String |
buildFieldExpression(com.opensymphony.workflow.query.WorkflowQuery query)
Build a field expression.
|
protected String |
buildNestedExpression(com.opensymphony.workflow.query.NestedExpression nestedExpr)
Build a nested expression.
|
void |
clearHistory(long entryId)
Removes all history steps of an instance from the database.
All future calls to the history will return an empty List of Step. |
com.opensymphony.workflow.spi.Step |
createCurrentStep(long entryId,
int stepId,
String owner,
Date startDate,
Date dueDate,
String status,
long[] previousIds) |
com.opensymphony.workflow.spi.WorkflowEntry |
createEntry(String workflowName) |
void |
deleteInstance(long entryId)
Deletes a workflow instance from the database.
All future calls from the workflow to this instance will failed. |
List |
findCurrentSteps(long entryId) |
com.opensymphony.workflow.spi.WorkflowEntry |
findEntry(long entryId) |
List |
findHistorySteps(long entryId) |
protected String |
getCondition(com.opensymphony.workflow.query.WorkflowQuery query)
Get the condition from the query.
|
Node |
getEntryNode(Session session,
long entryId)
Retrieve an entry node from its id.
|
protected com.opensymphony.workflow.query.FieldExpression |
getFirstFieldExpression(com.opensymphony.workflow.query.Expression expression)
Retrieve the first field expression from an expression.
|
(package private) Node |
getHistoryStepNode(Session session,
long entryId,
long stepId)
Retrieve an history step node from its id for a particular entry.
|
protected String |
getPredicate(com.opensymphony.workflow.query.WorkflowExpressionQuery query)
Build a predicate from the query.
|
protected String |
getPropertyName(int field)
Retrieve a propertyName from a field id.
|
com.opensymphony.module.propertyset.PropertySet |
getPropertySet(long entryId) |
protected String |
getSortCriteria(com.opensymphony.workflow.query.WorkflowExpressionQuery query)
Get the JCR sort criteria from the query.
|
void |
init(Map props) |
com.opensymphony.workflow.spi.Step |
markFinished(com.opensymphony.workflow.spi.Step step,
int actionId,
Date finishDate,
String status,
String caller) |
void |
moveToHistory(com.opensymphony.workflow.spi.Step step) |
List |
query(com.opensymphony.workflow.query.WorkflowExpressionQuery query) |
List |
query(com.opensymphony.workflow.query.WorkflowQuery query) |
void |
removeEntry(long entryId)
Remove a workflow entry
|
void |
setEntryState(long entryId,
int state) |
protected void |
storeNewEntry(com.opensymphony.workflow.spi.WorkflowEntry workflowEntry)
Store a new workflow entry into the JCR repository
|
protected String |
translateValue(Object value)
Convert and maybe escape a value to support XPath grammar.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
shouldClearHistory
public static final String __NAMESPACE
public static final String __NAMESPACE_PREFIX
public static final String __NM_PREFIX
public static final String __ROOT_NT
static final String __ENTRY_NT
static final String __STEP_NT
static final String __ROOT_NODE
static final String __ENTRY_NODE_PREFIX
static final String __CURRENT_STEP_NODE
static final String __HISTORY_STEP_NODE
static final String __NEXT_ENTRY_ID_PROPERTY
static final String __ID_PROPERTY
static final String __WF_NAME_PROPERTY
static final String __STATE_PROPERTY
static final String __NEXT_STEP_ID_PROPERTY
static final String __STEP_ID_PROPERTY
static final String __ACTION_ID_PROPERTY
static final String __OWNER_PROPERTY
static final String __CALLER_PROPERTY
static final String __START_DATE_PROPERTY
static final String __DUE_DATE_PROPERTY
static final String __FINISH_DATE_PROPERTY
static final String __STATUS_PROPERTY
static final String __PREVIOUS_STEPS_PROPERTY
protected Repository _repository
public AbstractJackrabbitWorkflowStore(Repository repository)
repository
- the JCR Repository to use.protected Session _getSession() throws RepositoryException
RepositoryException
- if an error occurs.protected void _release(Session session)
Default implementation calls logout on the session.
session
- the session to release.protected static Calendar __toCalendar(Date date)
date
- The date to convert.public void init(Map props) throws com.opensymphony.workflow.StoreException
init
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
protected abstract void _createRootNode() throws RepositoryException
RepositoryException
- if an error occurs.protected abstract Node _getRootNode(Session session) throws RepositoryException
session
- the session to useRepositoryException
- if an error occurs.public void setEntryState(long entryId, int state) throws com.opensymphony.workflow.StoreException
setEntryState
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public com.opensymphony.module.propertyset.PropertySet getPropertySet(long entryId) throws com.opensymphony.workflow.StoreException
getPropertySet
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public com.opensymphony.workflow.spi.Step createCurrentStep(long entryId, int stepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds) throws com.opensymphony.workflow.StoreException
createCurrentStep
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public com.opensymphony.workflow.spi.WorkflowEntry createEntry(String workflowName) throws com.opensymphony.workflow.StoreException
createEntry
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
protected void storeNewEntry(com.opensymphony.workflow.spi.WorkflowEntry workflowEntry) throws com.opensymphony.workflow.StoreException
workflowEntry
- The new entrycom.opensymphony.workflow.StoreException
- on errorpublic void removeEntry(long entryId) throws com.opensymphony.workflow.StoreException
entryId
- The id of workflow entrycom.opensymphony.workflow.StoreException
- if an error occurredprotected abstract Node _getOrCreateParentEntryNode(Node root, long id) throws RepositoryException
root
- The workflow store root nodeid
- The workflow entry idRepositoryException
- on repository errorpublic Node getEntryNode(Session session, long entryId) throws RepositoryException
session
- the session to use.entryId
- the id of the entry.RepositoryException
- if there is no entry for this id.Node getHistoryStepNode(Session session, long entryId, long stepId) throws RepositoryException
session
- The session to use.entryId
- The id of the entry.stepId
- The id of the step.RepositoryException
- if no step matches or multiple steps match.protected long _getNextEntryId() throws RepositoryException
RepositoryException
- if an error occurs.protected long _getNextStepId(Node entry) throws RepositoryException
entry
- The entry.RepositoryException
- if an error occurs.public List findCurrentSteps(long entryId) throws com.opensymphony.workflow.StoreException
findCurrentSteps
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public com.opensymphony.workflow.spi.WorkflowEntry findEntry(long entryId) throws com.opensymphony.workflow.StoreException
findEntry
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public List findHistorySteps(long entryId) throws com.opensymphony.workflow.StoreException
findHistorySteps
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public com.opensymphony.workflow.spi.Step markFinished(com.opensymphony.workflow.spi.Step step, int actionId, Date finishDate, String status, String caller) throws com.opensymphony.workflow.StoreException
markFinished
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public void moveToHistory(com.opensymphony.workflow.spi.Step step) throws com.opensymphony.workflow.StoreException
moveToHistory
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public List query(com.opensymphony.workflow.query.WorkflowQuery query) throws com.opensymphony.workflow.StoreException
query
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
public void clearHistory(long entryId) throws com.opensymphony.workflow.StoreException
AmetysWorkflowStore
clearHistory
in interface AmetysWorkflowStore
entryId
- the id of a workflow instance.com.opensymphony.workflow.StoreException
- if an error occurs.public void deleteInstance(long entryId) throws com.opensymphony.workflow.StoreException
AmetysWorkflowStore
deleteInstance
in interface AmetysWorkflowStore
entryId
- The id of a workflow instance.com.opensymphony.workflow.StoreException
- if an error occurs.protected String getCondition(com.opensymphony.workflow.query.WorkflowQuery query) throws com.opensymphony.workflow.StoreException
query
- The query.com.opensymphony.workflow.StoreException
- if the query is not valid.protected String buildFieldExpression(com.opensymphony.workflow.query.WorkflowQuery query) throws com.opensymphony.workflow.StoreException
query
- The query.com.opensymphony.workflow.StoreException
- if the query is not valid.public List query(com.opensymphony.workflow.query.WorkflowExpressionQuery query) throws com.opensymphony.workflow.StoreException
query
in interface com.opensymphony.workflow.spi.WorkflowStore
com.opensymphony.workflow.StoreException
protected String getSortCriteria(com.opensymphony.workflow.query.WorkflowExpressionQuery query) throws com.opensymphony.workflow.StoreException
query
- The query.com.opensymphony.workflow.StoreException
- if the criteria is not valid.protected com.opensymphony.workflow.query.FieldExpression getFirstFieldExpression(com.opensymphony.workflow.query.Expression expression)
expression
- the expression to inspect.protected String getPredicate(com.opensymphony.workflow.query.WorkflowExpressionQuery query) throws com.opensymphony.workflow.StoreException
query
- The query.com.opensymphony.workflow.StoreException
- if the query is not valid.protected String buildNestedExpression(com.opensymphony.workflow.query.NestedExpression nestedExpr) throws com.opensymphony.workflow.StoreException
nestedExpr
- The nested expression.com.opensymphony.workflow.StoreException
- if the expression is not valid.private String buildFieldExpression(com.opensymphony.workflow.query.FieldExpression expr) throws com.opensymphony.workflow.StoreException
expr
- The field expression.com.opensymphony.workflow.StoreException
- if the expression is not valid.protected String translateValue(Object value) throws com.opensymphony.workflow.StoreException
value
- The value to translate.com.opensymphony.workflow.StoreException
- if the value cannot be translated.protected String getPropertyName(int field) throws com.opensymphony.workflow.StoreException
field
- The field id.com.opensymphony.workflow.StoreException
- if the field is not valid.FieldExpression