Class ImmediateSchedulingProcessingHelper

java.lang.Object
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.ImmediateSchedulingProcessingHelper

public class ImmediateSchedulingProcessingHelper extends Object
State manager for immediate scheduling processing and history records. Handles state transitions, log association, and error tracking in a centralized way.

This helper manages both:

  • Last processing record (AIMMEDIATESCHEDULINGLASTPROC) - the current/latest processing state
  • Historical processing record (SIMMEDIATESCHEDPROCESSING) - the historical archive

This is a customizable helper that can be instantiated via Factory.

Since:
22.0
  • Constructor Details

    • ImmediateSchedulingProcessingHelper

      public ImmediateSchedulingProcessingHelper()
  • Method Details

    • makeHelper

      public static ImmediateSchedulingProcessingHelper makeHelper()
      Factory method to create a new instance of the state manager.
      Returns:
      a new instance of ImmediateSchedulingProcessingHelper
    • updateProcessingState

      public void updateProcessingState(BOImmediateSchedulingLastProcessing lastProcessing, Long state, Exception exception, Date endDate, PoolKit poolKit) throws DAException, DAValidateException
      Updates the processing state for both last processing and history records.

      This method:

      • Updates the state, end date, and error message (if any) in the last processing record
      • Updates the corresponding historical record with the same information
      • Copies statistics (num work orders assigned/not assigned) from last processing to history
      Parameters:
      lastProcessing - the last processing record to update
      state - the new state (e.g., PROCESSED_OK, PROCESSED_KO)
      exception - the exception (null if no error)
      endDate - the processing end date
      poolKit - the pool kit
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • updateProcessingWithLog

      public void updateProcessingWithLog(Long processingId, Long logId, PoolKit poolKit) throws DAException, DAValidateException
      Updates the last processing record with the log ID.

      This associates the processing with the scheduling log (SIMMEDIATESCHEDLOG) for traceability and debugging purposes.

      Parameters:
      processingId - the last processing ID
      logId - the log ID to associate
      poolKit - the pool kit
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • updateHistoryWithLog

      public void updateHistoryWithLog(Long historicalId, Long logId, PoolKit poolKit) throws DAException, DAValidateException
      Updates the historical processing record with the log ID.

      This associates the historical processing with the scheduling log (SIMMEDIATESCHEDLOG) for traceability and debugging purposes.

      Parameters:
      historicalId - the historical processing ID
      logId - the log ID to associate
      poolKit - the pool kit
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • createLocalizedError

      protected LocalizedString createLocalizedError(String errorMessage)
      Creates a localized error string from a plain error message.

      This method creates a LocalizedString with the error message in all available languages.

      Parameters:
      errorMessage - the error message
      Returns:
      the localized error string
    • writeTrackingRecord

      public void writeTrackingRecord(BOImmediateSchedulingLastProcessing lastProcessing, Date endDate, PoolKit poolKit) throws DAException, DAValidateException
      Writes the tracking record with the processing end date.

      This method:

      • Searches for an existing tracking record for the given operation center and scheduling model
      • If found, updates the appropriate end date field (lastImmediateEndDate or lastReprocessingEndDate)
      • If not found, creates a new tracking record with the end date

      This tracking table is used by BTImmediateSchedulingScheduler to determine when the last processing ended and whether a new processing should be scheduled.

      Parameters:
      lastProcessing - the last processing record
      endDate - the processing end date
      poolKit - the pool kit
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • updateTrackingRecord

      protected void updateTrackingRecord(BOImmediateSchedulingTracking tracking, Date endDate, Boolean isReprocessing, PoolKit poolKit) throws DAException, DAValidateException
      Throws:
      DAException
      DAValidateException
    • insertTrackingRecord

      protected void insertTrackingRecord(Long operationCenter, Long schedulingModel, Date endDate, Boolean isReprocessing, PoolKit poolKit) throws DAException, DAValidateException
      Throws:
      DAException
      DAValidateException