Class SequenceService

java.lang.Object
org.imixs.workflow.office.util.SequenceService

@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS") public class SequenceService extends Object
The SequcneceService is a singleton EJB which handles continuous sequenceNumbers for a workitem separated for each workflowGroup.

The sequence numbers are stored in the item 'sequencenumbers' of the configuration entity with the name "BASIC" in in the following format

[GROUP]=123

Optimistic Locking Problem

In earlier versions, the method runs in a OptimisticLockException in case that multiple processes run in parallel. To fix this the service is changed into a singleton. See issue #290.

Author:
rsoika
  • Field Details

  • Constructor Details

    • SequenceService

      public SequenceService()
  • Method Details

    • computeSequenceNumber

      public void computeSequenceNumber(org.imixs.workflow.ItemCollection documentContext) throws org.imixs.workflow.exceptions.AccessDeniedException
      This method computes the sequence number based on a configuration entity with the name "BASIC". The configuration provides a property 'sequencenumbers' with the current number range for each workflowGroup. If a Workitem have a WorkflowGroup with no corresponding entry the method will not compute a new number.

      This method loads and updates the configuration entity in a new transaction. In combination with the

      Throws:
      InvalidWorkitemException
      org.imixs.workflow.exceptions.AccessDeniedException
    • hasSequenceNumber

      public boolean hasSequenceNumber(org.imixs.workflow.ItemCollection documentContext)
      This method verifies if a sequence number already exists.

      The method also migrate the old item name 'numsequencenumber' into the new item name 'sequencenumber'

      Parameters:
      documentContext -