Class ImmediateSchedulingWorkOrderHelper

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

public class ImmediateSchedulingWorkOrderHelper extends Object
Helper for immediate scheduling work orders and processing. Handles state transitions, counter updates, and history population in a centralized way.

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

Since:
22.0
  • Constructor Details

    • ImmediateSchedulingWorkOrderHelper

      public ImmediateSchedulingWorkOrderHelper()
  • Method Details

    • makeHelper

      public static ImmediateSchedulingWorkOrderHelper makeHelper()
      Factory method to create a new instance of the helper.
      Returns:
      a new instance of ImmediateSchedulingWorkOrderHelper
    • markWorkOrderSuccess

      public void markWorkOrderSuccess(Long workOrderId, Long foremanWorkshiftId, Long agendaId) throws DAException, DAValidateException
      Marks a work order as successfully processed. This update is performed in an independent transaction.
      Parameters:
      workOrderId - the work order ID (AISWID)
      foremanWorkshiftId - the foreman workshift ID assigned to the work order
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • markWorkOrderFailed

      public void markWorkOrderFailed(Long workOrderId, String errorMessage) throws DAException, DAValidateException
      Marks a work order as failed. This update is performed in an independent transaction.
      Parameters:
      workOrderId - the work order ID (AISWID)
      errorMessage - the error message
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • markWorkOrderFailed

      public void markWorkOrderFailed(Long workOrderId, String errorMessage, boolean incrementCounter) throws DAException, DAValidateException
      Marks a work order as failed. This update is performed in an independent transaction.
      Parameters:
      workOrderId - the work order ID (AISWID)
      errorMessage - the error message
      incrementCounter - whether to increment the processing counter (true for permanent errors, false for transient errors)
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • loadWorkOrder

      protected BOImmediateSchedulingWorkOrder loadWorkOrder(Long workOrderId) throws DAException, DAValidateException
      Throws:
      DAException
      DAValidateException
    • markWorkOrderFailed

      public void markWorkOrderFailed(Long workOrderId, Exception exception) throws DAException, DAValidateException
      Marks a work order as failed with an exception. This update is performed in an independent transaction.

      For DAValidateException, extracts the translated error message with parameters. For other exceptions, uses getMessage() or the exception class name if message is null.

      Parameters:
      workOrderId - the work order ID (AISWID)
      exception - the exception that caused the failure
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • markWorkOrderFailed

      public void markWorkOrderFailed(Long workOrderId, Exception exception, boolean incrementCounter) throws DAException, DAValidateException
      Marks a work order as failed with an exception. This update is performed in an independent transaction.

      For DAValidateException, extracts the translated error message with parameters. For other exceptions, uses getMessage() or the exception class name if message is null.

      Parameters:
      workOrderId - the work order ID (AISWID)
      exception - the exception that caused the failure
      incrementCounter - whether to increment the processing counter (true for permanent errors, false for transient errors)
      Throws:
      DAException - if a database error occurs
      DAValidateException - if validation fails
    • createEmptyError

      protected LocalizedString createEmptyError()
      Creates an empty localized error (all languages empty).
      Returns:
      empty localized string
    • createLocalizedError

      protected LocalizedString createLocalizedError(String message)
      Creates a localized error message with the same text in all languages.
      Parameters:
      message - the error message
      Returns:
      localized error string
    • populateWorkOrderHistory

      public void populateWorkOrderHistory(Long historicalProcessingId, PoolKit poolKit)
      Populates the work order history table (SIMMEDIATESCHEDULINGWOHISTORY) with records from the active table.

      This method:

      • Searches for all work orders with AISWID_AISW = immediateSchedulingId
      • For each work order, creates a corresponding history record
      • Sets SISWID_SISP to historicalProcessingId (the SIMMEDIATESCHEDPROCESSING ID)
      • Copies all other fields from the master record
      Parameters:
      historicalProcessingId - the historical processing ID (SISPID)
      poolKit - the pool kit