Class WorkflowScheduler

java.lang.Object
org.imixs.workflow.engine.WorkflowScheduler
All Implemented Interfaces:
Scheduler

public class WorkflowScheduler extends Object implements Scheduler
This EJB implements a Imixs Scheduler Interface and scans workitems for scheduled activities.

The configuration of the scheduler is based on the Imixs Scheduler API.

Version:
1.0
Author:
rsoika
  • Field Details

  • Constructor Details

    • WorkflowScheduler

      public WorkflowScheduler()
  • Method Details

    • workItemInDue

      public boolean workItemInDue(ItemCollection doc, ItemCollection docActivity)
      This method checks if a workitem (doc) is in due. There are 4 different cases which will be compared: The case is determined by the keyScheduledBaseObject of the activity entity Basis : keyScheduledBaseObject "last process"=1, "last Modification"=2 "Creation"=3 "Field"=4 The logic is not the best one but it works. So we are open for any kind of improvements
      Returns:
      true if workitem is is due
    • addWorkDays

      public Calendar addWorkDays(Calendar baseDate, int days)
      This method adds workdays (MONDAY - FRIDAY) to a given calendar object. If the number of days is negative than this method subtracts the working days from the calendar object.
      Parameters:
      cal -
      days -
      Returns:
      new calendar instance
    • run

      public ItemCollection run(ItemCollection configItemCollection) throws SchedulerException
      This method process scheduled workitems. The method updates the property 'datLastRun' Because of bug: https://java.net/jira/browse/GLASSFISH-20673 we check the imixsDayOfWeek
      Specified by:
      run in interface Scheduler
      Parameters:
      timer -
      Returns:
      updated scheduler configuration
      Throws:
      AccessDeniedException
      SchedulerException
    • findScheduledEvents

      protected Collection<ItemCollection> findScheduledEvents(String aModelVersion) throws ModelException
      This method collects all scheduled workflow events. A scheduled workflow event is identified by the attribute keyScheduledActivity="1" The method goes through the latest or a specific Model Version
      Throws:
      ModelException
    • processWorkListByEvent

      protected void processWorkListByEvent(ItemCollection event, ItemCollection configItemCollection) throws ModelException, QueryException
      This method processes all workitems for a specific scheduled event element of a workflow model. A scheduled event element can define a selector (txtscheduledview). If no selector is defined, the default selector is used:

      ($taskid:"[TASKID]" AND $modelversion:"[MODELVERSION]")

      Parameters:
      event - - a event model element
      Throws:
      ModelException
      QueryException
      Exception