Class ImmediateSchedulingWorkOrderHelper
java.lang.Object
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.ImmediateSchedulingWorkOrderHelper
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalizedStringCreates an empty localized error (all languages empty).protected LocalizedStringcreateLocalizedError(String message) Creates a localized error message with the same text in all languages.protected BOImmediateSchedulingWorkOrderloadWorkOrder(Long workOrderId) Factory method to create a new instance of the helper.voidmarkWorkOrderFailed(Long workOrderId, Exception exception) Marks a work order as failed with an exception.voidmarkWorkOrderFailed(Long workOrderId, Exception exception, boolean incrementCounter) Marks a work order as failed with an exception.voidmarkWorkOrderFailed(Long workOrderId, String errorMessage) Marks a work order as failed.voidmarkWorkOrderFailed(Long workOrderId, String errorMessage, boolean incrementCounter) Marks a work order as failed.voidmarkWorkOrderSuccess(Long workOrderId, Long foremanWorkshiftId, Long agendaId) Marks a work order as successfully processed.voidpopulateWorkOrderHistory(Long historicalProcessingId, PoolKit poolKit) Populates the work order history table (SIMMEDIATESCHEDULINGWOHISTORY) with records from the active table.
-
Constructor Details
-
ImmediateSchedulingWorkOrderHelper
public ImmediateSchedulingWorkOrderHelper()
-
-
Method Details
-
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 occursDAValidateException- 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 occursDAValidateException- 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 messageincrementCounter- whether to increment the processing counter (true for permanent errors, false for transient errors)- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
loadWorkOrder
protected BOImmediateSchedulingWorkOrder loadWorkOrder(Long workOrderId) throws DAException, DAValidateException - Throws:
DAExceptionDAValidateException
-
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 occursDAValidateException- 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 failureincrementCounter- whether to increment the processing counter (true for permanent errors, false for transient errors)- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
createEmptyError
Creates an empty localized error (all languages empty).- Returns:
- empty localized string
-
createLocalizedError
Creates a localized error message with the same text in all languages.- Parameters:
message- the error message- Returns:
- localized error string
-
populateWorkOrderHistory
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
-