Package de.xima.fc.timing.worker
Class TimePointWorker
- java.lang.Object
-
- de.xima.fc.timing.worker.TimePointWorker
-
- All Implemented Interfaces:
org.quartz.Job
public class TimePointWorker extends Object
Worker for invoking a trigger of the new workflow for theEWorkflowTriggerType.FC_TIME_POINT
trigger.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
KEY_LAST_SCHEDULED_STATE_UUID
Key for the UUID of the state for which the job was scheduled most recently.protected static String
KEY_PREVIOUS_FIRE_TIME
The last trigger fire time, as anInstant.getEpochSecond()
protected static String
KEY_PROCESS_DB_ID
protected static String
KEY_PROCESS_ID
Deprecated.UseKEY_PROCESS_DB_ID
.protected static String
KEY_RETRY_COUNT
protected static String
KEY_TRIGGER_ID
protected static String
KEY_TRIGGER_NAME
protected static String
KEY_UNIQUE_ID
protected static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description TimePointWorker()
A new instance of the state timer job for invoking a trigger of typeEWorkflowTriggerType.FC_TIME_POINT
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static void
addCommonEntries(org.quartz.JobDataMap dataMap, Vorgang formRecord, WorkflowTrigger trigger, Instant triggerFireInstant)
protected boolean
checkPreconditions(org.quartz.JobExecutionContext ctx, WorkflowTriggerWorkerParams<TData> params)
Optional check for the preconditions before the trigger is invoked.static org.quartz.JobDataMap
createJobMap(Vorgang formRecord, WorkflowTrigger trigger, FcTimePointProps props, Instant triggerFireInstant)
Creates the job data map for the quartz job required by a workflow trigger of typeEWorkflowTriggerType.FC_TIME_POINT
.void
execute(org.quartz.JobExecutionContext ctx)
protected void
invokeTrigger(org.quartz.JobExecutionContext ctx, WorkflowTriggerWorkerParams<TData> params)
protected boolean
isDeleteJobAfterwards(org.quartz.JobExecutionContext ctx)
static UUID
readLastScheduledStateUuid(org.quartz.JobDataMap jobDataMap)
Reads the UUID of theWorkflowState
for which the job was scheduled most recently from the job map created by this worker.static Instant
readPreviousFireTime(org.quartz.JobDataMap jobDataMap)
Reads the last fire time from the job map created by this worker.static String
readProcessDbId(org.quartz.JobDataMap jobDataMap)
Reads theprocess database ID
from the job map created by this worker.static String
readProcessId(org.quartz.JobDataMap jobDataMap)
Deprecated.static long
readRetryCount(org.quartz.JobDataMap jobDataMap)
Reads theprocess ID
from the job map created by this worker.static String
readTriggerName(org.quartz.JobDataMap jobDataMap)
Reads the name of theWorkflowState
s from the job map created by this worker.static String
readUniqueId(org.quartz.JobDataMap jobDataMap)
Reads the unique ID from the job map created by this worker that indicates the identity of the job.
-
-
-
Field Detail
-
KEY_LAST_SCHEDULED_STATE_UUID
protected static final String KEY_LAST_SCHEDULED_STATE_UUID
Key for the UUID of the state for which the job was scheduled most recently.- See Also:
- Constant Field Values
-
KEY_PREVIOUS_FIRE_TIME
protected static final String KEY_PREVIOUS_FIRE_TIME
The last trigger fire time, as anInstant.getEpochSecond()
- See Also:
- Constant Field Values
-
KEY_PROCESS_DB_ID
protected static final String KEY_PROCESS_DB_ID
- See Also:
- Constant Field Values
-
KEY_PROCESS_ID
@Deprecated protected static final String KEY_PROCESS_ID
Deprecated.UseKEY_PROCESS_DB_ID
. The process ID may change.Theprocess ID
of the form record.- See Also:
- Constant Field Values
-
KEY_RETRY_COUNT
protected static final String KEY_RETRY_COUNT
- See Also:
- Constant Field Values
-
KEY_TRIGGER_ID
protected static final String KEY_TRIGGER_ID
- See Also:
- Constant Field Values
-
KEY_TRIGGER_NAME
protected static final String KEY_TRIGGER_NAME
- See Also:
- Constant Field Values
-
KEY_UNIQUE_ID
protected static final String KEY_UNIQUE_ID
- See Also:
- Constant Field Values
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Detail
-
TimePointWorker
public TimePointWorker()
A new instance of the state timer job for invoking a trigger of typeEWorkflowTriggerType.FC_TIME_POINT
.
-
-
Method Detail
-
isDeleteJobAfterwards
protected boolean isDeleteJobAfterwards(org.quartz.JobExecutionContext ctx)
-
createJobMap
public static org.quartz.JobDataMap createJobMap(Vorgang formRecord, WorkflowTrigger trigger, FcTimePointProps props, Instant triggerFireInstant)
Creates the job data map for the quartz job required by a workflow trigger of typeEWorkflowTriggerType.FC_TIME_POINT
.- Parameters:
formRecord
- Form record to which the trigger applies.trigger
- The actual workflow trigger.props
- Deserialized properties model of the trigger.triggerFireInstant
- Instant for when the trigger was originally scheduled. May be different from the fire time of the quartz trigger.- Returns:
- The job data map with the details for the worker.
-
readLastScheduledStateUuid
public static UUID readLastScheduledStateUuid(org.quartz.JobDataMap jobDataMap)
Reads the UUID of theWorkflowState
for which the job was scheduled most recently from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The UUIDs of the
WorkflowState
s contained in the given job map.
-
execute
public final void execute(org.quartz.JobExecutionContext ctx) throws org.quartz.JobExecutionException
- Specified by:
execute
in interfaceorg.quartz.Job
- Throws:
org.quartz.JobExecutionException
-
checkPreconditions
protected boolean checkPreconditions(org.quartz.JobExecutionContext ctx, WorkflowTriggerWorkerParams<TData> params)
Optional check for the preconditions before the trigger is invoked. Optional because the workflow event runner checks the preconditions as well.- Parameters:
ctx
- Current job execution context.params
- Parameters for the trigger.- Returns:
true
to proceed with firing the trigger,false
otherwise.
-
invokeTrigger
protected void invokeTrigger(org.quartz.JobExecutionContext ctx, WorkflowTriggerWorkerParams<TData> params) throws CouldNotLockFormRecordException
- Throws:
CouldNotLockFormRecordException
-
readPreviousFireTime
public static Instant readPreviousFireTime(org.quartz.JobDataMap jobDataMap)
Reads the last fire time from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The previous fire time that was stored when the trigger was created / updated.
-
readProcessDbId
public static String readProcessDbId(org.quartz.JobDataMap jobDataMap)
Reads theprocess database ID
from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The process ID stored in the given job map.
-
readProcessId
@Deprecated public static String readProcessId(org.quartz.JobDataMap jobDataMap)
Deprecated.UsereadProcessDbId(JobDataMap)
. The process ID may change.Reads theprocess ID
from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The process ID stored in the given job map.
-
readRetryCount
public static long readRetryCount(org.quartz.JobDataMap jobDataMap)
Reads theprocess ID
from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The process ID stored in the given job map.
-
readTriggerName
public static String readTriggerName(org.quartz.JobDataMap jobDataMap)
Reads the name of theWorkflowState
s from the job map created by this worker.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The name of the
WorkflowTrigger
s contained in the given job map.
-
readUniqueId
public static String readUniqueId(org.quartz.JobDataMap jobDataMap)
Reads the unique ID from the job map created by this worker that indicates the identity of the job. This ID is changed each time the JOB is created or updated.- Parameters:
jobDataMap
- The job map created by worker.- Returns:
- The process ID stored in the given job map.
-
addCommonEntries
protected static void addCommonEntries(org.quartz.JobDataMap dataMap, Vorgang formRecord, WorkflowTrigger trigger, Instant triggerFireInstant)
-
-