Class BTWorkOrderHeaderHistory
java.lang.Object
overit.geocall.bl.BusinessTask<Void>
overit.geocallapp.utilities.core.bl.common.task.BTHistory
overit.geocallapp.wfm.workorders.bl.header.task.BTWorkOrderHeaderHistory
- All Implemented Interfaces:
Serializable,Tool
Business task in order to save a history of
BOWorkOrderHeader. - Since:
- 16.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.task.BTHistory
currentDBValues, dao, daoHistory, elaboratedRows, filters, HISTORY_CACHE_NAME, HISTORY_TABLE_TRANSLATE_FIELD_CACHE, historyFieldsMap, historyWritten, LOG, newHistoryRecordId, operationCode, operationMode, operationType, TYPE_COMMAND_AND_HISTORY, TYPE_ONLY_HISTORY, validModes, values -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HashGettercustomizeChangedFields(List<String> changedHistoryFields) Hook method for customizing history record values based on changed fields.protected StringReturns a descriptive name for this history task.protected StringReturns the prefix used in field names of the entity table.Returns a list of history table fields to exclude from change detection.protected StringReturns the name of the field in the history table that references the previous history record.protected StringReturns the name of the field in the history table that stores the creation date.protected StringReturns the name of the field in the entity table that references the history table.protected StringReturns the name of the field in the history table that references the entity table.protected StringReturns the name of the field in the history table that stores the operation code.protected StringReturns the prefix used in field names of the history table.protected StringReturns the name of the field in the history table that stores stack trace information.protected voidInitializes the DAOs used by this history task.protected booleanDetermines whether to record the current stack trace in the history record.protected HashGettertranslateFields(Map<String, Object> hgValues) Translates entity field values to their corresponding history field values.protected voidwriteHistoryRecord(Map<String, Object> currentValues, HashGetter previousHistoryRecord, PoolKit pk) Writes a new history record to the history table.Methods inherited from class overit.geocallapp.utilities.core.bl.common.task.BTHistory
applyCommand, body, buildMap, createHistoryRecord, customizeFieldMap, getChangedFields, getCustomFieldsToExclude, getElaboratedRows, getFieldsToExclude, getHistoryRecordId, getHistorySequenceField, getHistoryTableField, getHistoryUserField, getOperationCodeValue, getStackTraceString, getValidOperationModes, insertHistoryRecord, isDelete, isHistoryWritten, isInsert, isUpdate, loadCurrentDBData, loadPreviousHistoryRecord, loadTranslatedFieldMap, postElaboration, preElaboration, setCommandAndHistoryParams, setHistoryParams, validateParamsMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTWorkOrderHeaderHistory
public BTWorkOrderHeaderHistory()
-
-
Method Details
-
getBTDescription
Description copied from class:BTHistoryReturns a descriptive name for this history task. This name is used for logging purposes to identify the specific history task being executed.- Specified by:
getBTDescriptionin classBTHistory- Returns:
- a string describing the task
-
initializeDAO
protected void initializeDAO()Description copied from class:BTHistoryInitializes the DAOs used by this history task. Implementations must set:- dao: for entity table operations (insert/update/delete)
- daoHistory: for history table operations
- Specified by:
initializeDAOin classBTHistory
-
getEntityTablePrefix
Description copied from class:BTHistoryReturns the prefix used in field names of the entity table.- Specified by:
getEntityTablePrefixin classBTHistory- Returns:
- the prefix string used in field names of the entity table
-
getHistoryTablePrefix
Description copied from class:BTHistoryReturns the prefix used in field names of the history table.- Specified by:
getHistoryTablePrefixin classBTHistory- Returns:
- the prefix string used in field names of the history table
-
getHistoryDateField
Description copied from class:BTHistoryReturns the name of the field in the history table that stores the creation date.- Specified by:
getHistoryDateFieldin classBTHistory- Returns:
- the name of the date field in the history table
-
getHistoryField
Description copied from class:BTHistoryReturns the name of the field in the entity table that references the history table.- Specified by:
getHistoryFieldin classBTHistory- Returns:
- the name of the field in the entity table that references the history table
-
getForeignHistoryField
Description copied from class:BTHistoryReturns the name of the field in the history table that references the previous history record.- Specified by:
getForeignHistoryFieldin classBTHistory- Returns:
- the name of the field in the history table that references the previous history record
-
getHistoryForeignField
Description copied from class:BTHistoryReturns the name of the field in the history table that references the entity table.- Specified by:
getHistoryForeignFieldin classBTHistory- Returns:
- the name of the field in the history table that references the entity table
-
getHistoryOperationField
Description copied from class:BTHistoryReturns the name of the field in the history table that stores the operation code.- Specified by:
getHistoryOperationFieldin classBTHistory- Returns:
- the name of the operation code field in the history table
-
getStackTraceField
Description copied from class:BTHistoryReturns the name of the field in the history table that stores stack trace information. By default, this method returns null, indicating that stack trace recording is not enabled. Subclasses can override this method to enable stack trace recording.- Overrides:
getStackTraceFieldin classBTHistory- Returns:
- the name of the stack trace field in the history table, or null if stack trace recording is not enabled
-
traceCurrentStack
protected boolean traceCurrentStack()Description copied from class:BTHistoryDetermines whether to record the current stack trace in the history record. By default, this method returns false, indicating that stack trace recording is not enabled. Subclasses can override this method to enable stack trace recording based on specific conditions.- Overrides:
traceCurrentStackin classBTHistory- Returns:
- true if the current stack trace should be recorded, false otherwise
-
customizeChangedFields
Description copied from class:BTHistoryHook method for customizing history record values based on changed fields. This method is called before inserting a new history record when a previous history record exists.- Overrides:
customizeChangedFieldsin classBTHistory- Parameters:
changedHistoryFields- the list of field names that have changed- Returns:
- a HashGetter containing custom values to add to the history record
-
getExcludedHistoryFieldsFromComparison
Description copied from class:BTHistoryReturns a list of history table fields to exclude from change detection. This method builds a list of fields that should be ignored when comparing history records to determine if changes have occurred. These include:- Standard audit fields (DELETED, INSERTED, UPDATED)
- Primary key fields of the history table
- Foreign key to the previous history record
- Operation code field
- Date field
- Overrides:
getExcludedHistoryFieldsFromComparisonin classBTHistory- Returns:
- a list of field names to exclude from history record comparisons
-
translateFields
Description copied from class:BTHistoryTranslates entity field values to their corresponding history field values. This method applies the field mapping to convert entity data into the format required for the history table. It:- Maps entity field names to history field names using the translation map
- Adds the foreign key reference to the entity record
- Sets the operation code (INSERT/UPDATE/DELETE)
- Sets the timestamp for the history record
- Sets the user ID if user tracking is enabled
- Overrides:
translateFieldsin classBTHistory- Parameters:
hgValues- the entity data to translate- Returns:
- a new
HashGettercontaining the translated values for the history record
-
writeHistoryRecord
protected void writeHistoryRecord(Map<String, Object> currentValues, HashGetter previousHistoryRecord, PoolKit pk) throws DAValidateException, DAExceptionDescription copied from class:BTHistoryWrites a new history record to the history table. This method performs the actual insertion of a history record based on the current entity values and, optionally, the previous history record. It:- Translates entity field values to history field values
- Identifies changed fields if a previous history record exists
- Adds stack trace information if enabled
- Inserts the new history record
- Updates the entity record to reference the new history record
- Overrides:
writeHistoryRecordin classBTHistory- Parameters:
currentValues- the current entity valuespreviousHistoryRecord- the previous history record, or null if none existspk- thePoolKit- Throws:
DAValidateException- if validation fails during record insertionDAException- if a data access error occurs during record insertion
-