Class ImmediateSchedulingProcessingHelper
java.lang.Object
overit.geocallapp.wfm.scheduling.bl.immediatescheduling.processing.ImmediateSchedulingProcessingHelper
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalizedStringcreateLocalizedError(String errorMessage) Creates a localized error string from a plain error message.protected voidinsertTrackingRecord(Long operationCenter, Long schedulingModel, Date endDate, Boolean isReprocessing, PoolKit poolKit) Factory method to create a new instance of the state manager.voidupdateHistoryWithLog(Long historicalId, Long logId, PoolKit poolKit) Updates the historical processing record with the log ID.voidupdateProcessingState(BOImmediateSchedulingLastProcessing lastProcessing, Long state, Exception exception, Date endDate, PoolKit poolKit) Updates the processing state for both last processing and history records.voidupdateProcessingWithLog(Long processingId, Long logId, PoolKit poolKit) Updates the last processing record with the log ID.protected voidupdateTrackingRecord(BOImmediateSchedulingTracking tracking, Date endDate, Boolean isReprocessing, PoolKit poolKit) voidwriteTrackingRecord(BOImmediateSchedulingLastProcessing lastProcessing, Date endDate, PoolKit poolKit) Writes the tracking record with the processing end date.
-
Constructor Details
-
ImmediateSchedulingProcessingHelper
public ImmediateSchedulingProcessingHelper()
-
-
Method Details
-
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 updatestate- the new state (e.g., PROCESSED_OK, PROCESSED_KO)exception- the exception (null if no error)endDate- the processing end datepoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- 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 IDlogId- the log ID to associatepoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- 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 IDlogId- the log ID to associatepoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
createLocalizedError
Creates a localized error string from a plain error message.This method creates a
LocalizedStringwith 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
BTImmediateSchedulingSchedulerto determine when the last processing ended and whether a new processing should be scheduled.- Parameters:
lastProcessing- the last processing recordendDate- the processing end datepoolKit- the pool kit- Throws:
DAException- if a database error occursDAValidateException- if validation fails
-
updateTrackingRecord
protected void updateTrackingRecord(BOImmediateSchedulingTracking tracking, Date endDate, Boolean isReprocessing, PoolKit poolKit) throws DAException, DAValidateException - Throws:
DAExceptionDAValidateException
-
insertTrackingRecord
protected void insertTrackingRecord(Long operationCenter, Long schedulingModel, Date endDate, Boolean isReprocessing, PoolKit poolKit) throws DAException, DAValidateException - Throws:
DAExceptionDAValidateException
-