Class BTImmediateSchedulingEnqueue
java.lang.Object
overit.geocall.bl.BusinessTask<ImmediateSchedulingEnqueueEvent>
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.task.BTImmediateSchedulingEnqueue
- All Implemented Interfaces:
Serializable,Tool
@Event(ImmediateSchedulingEnqueueEvent.class)
public class BTImmediateSchedulingEnqueue
extends BusinessTask<ImmediateSchedulingEnqueueEvent>
Business task to enqueue a new immediate scheduling processing.
This task listens to ImmediateSchedulingEnqueueEvent and:
- Searches for an existing last processing record for the given operation center and scheduling model
- If found and state is NOT in COMPLETED_STATES:
- If state is IN_PROGRESS and timeout has expired (based on property
company.fsm.emergencyresponse.timeout), considers it dead and proceeds - Otherwise, throws
Codes.ImmediateScheduling.PROCESSING_ALREADY_IN_PROGRESS
- If state is IN_PROGRESS and timeout has expired (based on property
- If found and state is in COMPLETED_STATES (or timeout expired), updates it with the new processing parameters and sets state to TO_BE_PROCESSED
- If not found, creates a new last processing record with state TO_BE_PROCESSED
- Creates a corresponding history record
This task does NOT launch the processing itself. A separate scheduled task will periodically check for records in TO_BE_PROCESSED state and process them.
This task is used both by:
- The scheduled task
BTImmediateSchedulingSchedulerto automatically enqueue processing based on calendar configuration - The UI when the user manually triggers an immediate scheduling process
- Since:
- 22.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbody(ImmediateSchedulingEnqueueEvent event, PoolKit poolKit) Implements this method to write the specific task logic to handle the input parameter.protected LongcreateHistory(BOImmediateSchedulingLastProcessing processing, PoolKit poolKit) Create a new history record for the processing.protected LocalizedStringCreate an empty localized error stringprotected BOImmediateSchedulingLastProcessinggetLastProcessing(Long operationCenter, Long schedulingModel, PoolKit poolKit) Get the last processing for the given operation center and scheduling model.protected booleanisProcessingDead(BOImmediateSchedulingLastProcessing processing, Date now) Checks if a processing is considered dead (timeout expired).Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTImmediateSchedulingEnqueue
public BTImmediateSchedulingEnqueue()
-
-
Method Details
-
body
protected void body(ImmediateSchedulingEnqueueEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:BusinessTaskImplements this method to write the specific task logic to handle the input parameter.- Specified by:
bodyin classBusinessTask<ImmediateSchedulingEnqueueEvent>- Parameters:
event- the object upon which the task will works onpoolKit- the poolkit containing the reference to the database connection that can be used- Throws:
DAException- in case of database errorDAValidateException- in case of database validation error
-
isProcessingDead
Checks if a processing is considered dead (timeout expired).A processing is considered dead if:
- It is in IN_PROGRESS state, AND
- The processing start date is set, AND
- More than
company.fsm.emergencyresponse.timeoutminutes have passed since the processing start date
- Parameters:
processing- the processing to checknow- the current date/time- Returns:
- true if the processing is dead, false otherwise
-
getLastProcessing
protected BOImmediateSchedulingLastProcessing getLastProcessing(Long operationCenter, Long schedulingModel, PoolKit poolKit) throws DAException, DAValidateException Get the last processing for the given operation center and scheduling model.This method searches for the last processing record without filtering by state. The caller is responsible for checking the state and deciding whether to update or throw an error.
- Parameters:
operationCenter- the operation center IDschedulingModel- the scheduling model IDpoolKit- the pool kit- Returns:
- the last processing, or null if none found
- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
createHistory
protected Long createHistory(BOImmediateSchedulingLastProcessing processing, PoolKit poolKit) throws DAException, DAValidateException Create a new history record for the processing.This method creates a record in the history table (RIMMEDIATESCHEDPROCESSING) immediately when a new processing is scheduled, allowing the processing task to write exclusions and other data directly to the history table during execution.
- Parameters:
processing- the processing to create history forpoolKit- the pool kit- Returns:
- the ID of the created history record
- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
getEmptyError
Create an empty localized error string- Returns:
- an empty localized string
-