Package org.imixs.workflow.engine
Class WorkflowScheduler
- java.lang.Object
-
- org.imixs.workflow.engine.WorkflowScheduler
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAMEstatic intOFFSET_DAYSstatic intOFFSET_HOURSstatic intOFFSET_MINUTESstatic intOFFSET_SECONDSstatic intOFFSET_WORKDAYSprotected jakarta.enterprise.inject.Instance<QuerySelector>selectors-
Fields inherited from interface org.imixs.workflow.engine.scheduler.Scheduler
ITEM_ERRORMESSAGE, ITEM_LOGMESSAGE, ITEM_SCHEDULER_CLASS, ITEM_SCHEDULER_DEFINITION, ITEM_SCHEDULER_ENABLED, ITEM_SCHEDULER_NAME, ITEM_SCHEDULER_STATUS
-
-
Constructor Summary
Constructors Constructor Description WorkflowScheduler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CalendaraddWorkDays(Calendar baseDate, int days)This method adds workdays (MONDAY - FRIDAY) to a given calendar object.protected Collection<ItemCollection>findScheduledEvents(String aModelVersion)This method collects all scheduled workflow events.protected voidprocessWorkListByEvent(ItemCollection event, ItemCollection configItemCollection)This method processes all workitems for a specific scheduled event element of a workflow model.ItemCollectionrun(ItemCollection configItemCollection)This method process scheduled workitems.booleanworkItemInDue(ItemCollection doc, ItemCollection docActivity)This method checks if a workitem (doc) is in due.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
OFFSET_SECONDS
public static final int OFFSET_SECONDS
- See Also:
- Constant Field Values
-
OFFSET_MINUTES
public static final int OFFSET_MINUTES
- See Also:
- Constant Field Values
-
OFFSET_HOURS
public static final int OFFSET_HOURS
- See Also:
- Constant Field Values
-
OFFSET_DAYS
public static final int OFFSET_DAYS
- See Also:
- Constant Field Values
-
OFFSET_WORKDAYS
public static final int OFFSET_WORKDAYS
- See Also:
- Constant Field Values
-
selectors
@Inject @Any protected jakarta.enterprise.inject.Instance<QuerySelector> selectors
-
-
Method Detail
-
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:
runin interfaceScheduler- Parameters:
timer-- Returns:
- updated scheduler configuration
- Throws:
AccessDeniedExceptionSchedulerException
-
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:
ModelExceptionQueryExceptionException
-
-