Class BTMeasureUpdate
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
BOMeasure.
When the MeasureUpdateEvent is launched the BT notices the call and
updates the BOMeasure according to the event's input.
Permissions:
Error codes:
Codes.INVALID_PROPERTY_VALUECodes.Measure.STATUS_NOT_COMPLIANT_FOR_OPERATIONCodes.Measure.PROPERTY_NOT_ALLOWED_FOR_MEASURING_ELEMENTCodes.Measure.CATALOG_CODE_NOT_ALLOWED_FOR_GROUPCodes.Measure.CATALOG_CODE_NOT_ALLOWED_FOR_GROUPCodes.Measure.PROPERTY_NOT_ALLOWEDCodes.Measure.VALUE_CONSTRAINTS_NOT_RESPECTEDCodes.Measure.DELTA_VALUE_UPDATE_NOT_ALLOWEDCodes.Measure.MEASURE_CHANGES_NOT_ALLOWED_FOR_STATUS_UPDATECodes.Measure.CONSTRAINT_VALUE_NOT_RESPECTED
- Since:
- 20.0
- See Also:
- GCApi:
- task
-
Field Summary
FieldsFields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidalignNextMeasure(BOMeasure inputMeasure, PoolKit poolKit) Aligns the next chronological measure after a measure has been updated, specifically for quantitative measures of non-counter measuring elements.protected voidapplyAlignmentValues(BOMeasure measure, MeasureCalculateCounterAlignOutput output) Method that modifies the measure with the new values for the alignment.protected voidcompleteData(BOMeasure measure, BOMeasure previousMeasure) Method that completes the data of the measure.protected voidexecute(MeasureUpdateEvent event, PoolKit pk) Updates theBOMeasureobject.protected AssetsIntegrationServiceReturn theAssetsEventIntegrationServiceused to access other domains.protected voidhandleUnreadableMeasure(BOMeasure measure, BOMeasure previousMeasure, PoolKit pk) Handles an unreadable measure by setting appropriate default values based on measuring element characteristics.booleanDetermines whether the current state is valid for execution.protected BOMeasureloadPreviousMeasure(BOMeasure measure, PoolKit pk) Loads the previous measure for a given measuring element and date.protected voidnotifyUpdate(BOMeasure measure, PoolKit pk) Notifies the measure update.protected voidupdateMeasure(BOMeasure measure, PoolKit pk) Updates the measure.protected voidvalidateCatalogCode(BOMeasure measure, PoolKit pk) Method that checks if the catalog code is allowed for the catalog group.protected voidvalidateCharacteristic(BOMeasure measure, PoolKit pk) Validates the measure's characteristic and its associated properties.protected voidvalidateMeasure(BOMeasure measure, PoolKit pk) Validates theBOMeasureobject data before its update.protected voidvalidateMeasureValues(BOMeasure measure) Validates measure values for meter-type measuring elements.Methods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
checkValidExecution, getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
measuringElement
-
-
Constructor Details
-
BTMeasureUpdate
public BTMeasureUpdate()
-
-
Method Details
-
getIntegrationService
Return theAssetsEventIntegrationServiceused to access other domains.- Parameters:
pk- thePoolKit- Returns:
- the
AssetsEventIntegrationServiceused to access services and events in other domains - Throws:
DAValidateException- thrown if there are data related loading errors
-
execute
protected void execute(MeasureUpdateEvent event, PoolKit pk) throws DAException, DAValidateException Updates theBOMeasureobject.- Specified by:
executein classValidExecutionBusinessTask<MeasureUpdateEvent>- Parameters:
event- theMeasureUpdateEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validateMeasure
protected void validateMeasure(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException Validates theBOMeasureobject data before its update.- Parameters:
measure- theBOMeasureobject to be updatedpk- thePoolKitpk- Throws:
DAValidateException- if there is a data validation exceptionDAException- the DA exception
-
loadPreviousMeasure
protected BOMeasure loadPreviousMeasure(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException Loads the previous measure for a given measuring element and date.- Parameters:
measure- the current measure containing the measuring date and element referencepk- thePoolKit- Returns:
- the previous
BOMeasureif found, or null if no previous measure exists - Throws:
DAValidateException- if validation of input data failsDAException- if there's an error accessing the data store
-
handleUnreadableMeasure
protected void handleUnreadableMeasure(BOMeasure measure, BOMeasure previousMeasure, PoolKit pk) throws DAValidateException, DAException Handles an unreadable measure by setting appropriate default values based on measuring element characteristics.The method handles the following cases when the measuring element has a characteristic:
- For counter-based measuring elements (with counter direction):
- Sets measure mode to
BOMeasureMode.Values.DIFFERENCE - Sets delta value to 0
- Sets measure mode to
- For non-counter measuring elements:
- If previous measure exists: copies its value
- If no previous measure: sets value to 0
- Parameters:
measure- the measure to be marked as unreadablepreviousMeasure- the previous measure, if anypk- the pool kit for accessing integration services- Throws:
DAValidateException- if validation of measure data failsDAException- if there's an error during measure processing
- For counter-based measuring elements (with counter direction):
-
validateCatalogCode
protected void validateCatalogCode(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException Method that checks if the catalog code is allowed for the catalog group.
It also checks that if the catalog group is null we can't have the catalog code.- Parameters:
measure- the inputBOMeasure- Throws:
DAValidateException- thrown if the catalog code is not allowed for the catalog groupDAValidateException- the DA exceptionDAException
-
validateCharacteristic
protected void validateCharacteristic(BOMeasure measure, PoolKit pk) throws DAException, DAValidateException Validates the measure's characteristic and its associated properties.The validation process includes:
- If measuring element has a characteristic:
- Validates numeric constraints for the measure value
- For meter-type characteristics (with counter direction): ensures the measure mode is set and the value is not set when mode is DIFFERENCE
- For non-meter characteristics: ensures meter-specific properties are not set (mode, delta value, rotations, cumulative value)
- Performs counter alignment validation
- If no characteristic is present:
- Ensures no characteristic-specific properties are set (mode, value, delta value, rotations)
- Parameters:
measure- the measure to validatepk- thePoolKit- Throws:
DAException- if there's an error accessing the dataDAValidateException- if validation fails for any of the constraints
- If measuring element has a characteristic:
-
validateMeasureValues
Validates measure values for meter-type measuring elements.This method performs validation checks on measure values when dealing with meter-type elements:
- If delta value changes, sets mode to DIFFERENCE
- If absolute value changes, sets mode to ABSOLUTE
- Ensures either value or delta value is provided
- Prevents simultaneous changes to both value and delta value
- Parameters:
measure- the measure to validate- Throws:
DAValidateException- if:- Both value and delta value are missing
- Both value and delta value are changed simultaneously
-
applyAlignmentValues
Method that modifies the measure with the new values for the alignment.- Parameters:
measure- the new input measureoutput- the output of the eventMeasureCalculateCounterAlignEvent
-
completeData
Method that completes the data of the measure.- Parameters:
measure- the measure to update
-
updateMeasure
Updates the measure.- Parameters:
measure- the measure to updatepk- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
notifyUpdate
Notifies the measure update.- Parameters:
measure- the updatedBOMeasurepk- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
alignNextMeasure
protected void alignNextMeasure(BOMeasure inputMeasure, PoolKit poolKit) throws DAValidateException, DAException Aligns the next chronological measure after a measure has been updated, specifically for quantitative measures of non-counter measuring elements.This method identifies and processes the next measure in sequence to ensure data consistency following an update to the current measure. Unlike counter-type measuring elements, which have special handling for rotations and cumulative values, this method focuses on the simpler alignment needs of standard quantitative measurements.
For non-counter quantitative measures, the alignment primarily involves:
- Recalculating delta values between the updated measure and the next measure
- Ensuring proper value propagation in the measurement sequence
- Maintaining the integrity of the measurement chain
This method is called after a measure update operation to ensure that subsequent measures properly reflect the changes made to the current measure.
- Parameters:
inputMeasure- the measure that was just updated and will serve as the reference for finding and aligning the next measurepoolKit- the pool kit providing access to database connections and services- Throws:
DAValidateException- if validation fails during the alignment processDAException- if a data access error occurs during the alignment process
-
isValidExecution
public boolean isValidExecution()Description copied from interface:ValidExecutionDetermines whether the current state is valid for execution.- Returns:
- true if execution is valid, false otherwise
-