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

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 Details

  • Constructor Details

    • AmetysObjectWorkflowStore

      public AmetysObjectWorkflowStore(javax.jcr.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(javax.jcr.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 Details

    • 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

      Ametys object getter
      Returns:
      The ametys object
    • _getSession

      protected javax.jcr.Session _getSession() throws javax.jcr.RepositoryException
      Description copied from class: AbstractJackrabbitWorkflowStore
      Open a session to the _repository.
      Overrides:
      _getSession in class AbstractJackrabbitWorkflowStore
      Returns:
      the session opened.
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • _release

      protected void _release(javax.jcr.Session session)
      Description copied from class: AbstractJackrabbitWorkflowStore
      Release a session.

      Default implementation calls logout on the session.

      Overrides:
      _release in class AbstractJackrabbitWorkflowStore
      Parameters:
      session - the session to release.
    • _getAmetysObjectNode

      protected javax.jcr.Node _getAmetysObjectNode() throws javax.jcr.RepositoryException
      Provides the ametys object node in the current session
      Returns:
      node
      Throws:
      javax.jcr.RepositoryException - on repository error
    • _createRootNode

      protected void _createRootNode() throws javax.jcr.RepositoryException
      Description copied from class: AbstractJackrabbitWorkflowStore
      Create the root node.
      Specified by:
      _createRootNode in class AbstractJackrabbitWorkflowStore
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • _getRootNode

      protected javax.jcr.Node _getRootNode(javax.jcr.Session session) throws javax.jcr.RepositoryException
      Description copied from class: AbstractJackrabbitWorkflowStore
      Get the workflow store root node
      Specified by:
      _getRootNode in class AbstractJackrabbitWorkflowStore
      Parameters:
      session - the session to use
      Returns:
      The workflow store root node
      Throws:
      javax.jcr.RepositoryException - if an error occurs.
    • _getOrCreateParentEntryNode

      protected javax.jcr.Node _getOrCreateParentEntryNode(javax.jcr.Node root, long id) throws javax.jcr.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 class AbstractJackrabbitWorkflowStore
      Parameters:
      root - The workflow store root node
      id - The workflow entry id
      Returns:
      The parent node
      Throws:
      javax.jcr.RepositoryException - on repository error
    • _getNextEntryId

      protected long _getNextEntryId() throws javax.jcr.RepositoryException
      Description copied from class: AbstractJackrabbitWorkflowStore
      Generate an unique entry id.
      Overrides:
      _getNextEntryId in class AbstractJackrabbitWorkflowStore
      Returns:
      A new entry id.
      Throws:
      javax.jcr.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 class AbstractJackrabbitWorkflowStore
      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