java.lang.Object
overit.geocall.bl.BusinessTask<ImmediateSchedulingEnqueueEvent>
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.task.BTImmediateSchedulingEnqueue
All Implemented Interfaces:
Serializable, Tool

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 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 BTImmediateSchedulingScheduler to 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 Details

    • BTImmediateSchedulingEnqueue

      public BTImmediateSchedulingEnqueue()
  • Method Details

    • body

      protected void body(ImmediateSchedulingEnqueueEvent event, PoolKit poolKit) throws DAException, DAValidateException
      Description copied from class: BusinessTask
      Implements this method to write the specific task logic to handle the input parameter.
      Specified by:
      body in class BusinessTask<ImmediateSchedulingEnqueueEvent>
      Parameters:
      event - the object upon which the task will works on
      poolKit - the poolkit containing the reference to the database connection that can be used
      Throws:
      DAException - in case of database error
      DAValidateException - in case of database validation error
    • isProcessingDead

      protected boolean isProcessingDead(BOImmediateSchedulingLastProcessing processing, Date now)
      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.timeout minutes have passed since the processing start date
      Parameters:
      processing - the processing to check
      now - 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 ID
      schedulingModel - the scheduling model ID
      poolKit - the pool kit
      Returns:
      the last processing, or null if none found
      Throws:
      DAException - if a database error occurs
      DAValidateException - 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 for
      poolKit - the pool kit
      Returns:
      the ID of the created history record
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • getEmptyError

      protected LocalizedString getEmptyError()
      Create an empty localized error string
      Returns:
      an empty localized string