All Implemented Interfaces:
Serializable, Tool, ValidExecution

Since:
20.0
See Also:
GCApi:
task
  • Field Details

  • Constructor Details

    • BTMeasureUpdate

      public BTMeasureUpdate()
  • Method Details

    • getIntegrationService

      protected AssetsIntegrationService getIntegrationService(PoolKit pk) throws DAValidateException
      Return the AssetsEventIntegrationService used to access other domains.
      Parameters:
      pk - the PoolKit
      Returns:
      the AssetsEventIntegrationService used 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 the BOMeasure object.
      Specified by:
      execute in class ValidExecutionBusinessTask<MeasureUpdateEvent>
      Parameters:
      event - the MeasureUpdateEvent
      pk - the PoolKit
      Throws:
      DAException - the DA exception
      DAValidateException - the DA validate exception
    • validateMeasure

      protected void validateMeasure(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException
      Validates the BOMeasure object data before its update.
      Parameters:
      measure - the BOMeasure object to be updated
      pk - the PoolKit pk
      Throws:
      DAValidateException - if there is a data validation exception
      DAException - 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 reference
      pk - the PoolKit
      Returns:
      the previous BOMeasure if found, or null if no previous measure exists
      Throws:
      DAValidateException - if validation of input data fails
      DAException - 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):
      • For non-counter measuring elements:
        • If previous measure exists: copies its value
        • If no previous measure: sets value to 0
      Additionally, if the measuring element has a catalog group and a previous measure exists, the catalog code from the previous measure is copied if present. Finally, performs counter alignment check and updates measure values accordingly.
      Parameters:
      measure - the measure to be marked as unreadable
      previousMeasure - the previous measure, if any
      pk - the pool kit for accessing integration services
      Throws:
      DAValidateException - if validation of measure data fails
      DAException - if there's an error during measure processing
    • 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 input BOMeasure
      Throws:
      DAValidateException - thrown if the catalog code is not allowed for the catalog group
      DAValidateException - the DA exception
      DAException
    • 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 validate
      pk - the PoolKit
      Throws:
      DAException - if there's an error accessing the data
      DAValidateException - if validation fails for any of the constraints
    • validateMeasureValues

      protected void validateMeasureValues(BOMeasure measure) throws DAValidateException
      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

      protected void applyAlignmentValues(BOMeasure measure, MeasureCalculateCounterAlignOutput output)
      Method that modifies the measure with the new values for the alignment.
      Parameters:
      measure - the new input measure
      output - the output of the event MeasureCalculateCounterAlignEvent
    • completeData

      protected void completeData(BOMeasure measure, BOMeasure previousMeasure)
      Method that completes the data of the measure.
      Parameters:
      measure - the measure to update
    • updateMeasure

      protected void updateMeasure(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException
      Updates the measure.
      Parameters:
      measure - the measure to update
      pk - the PoolKit
      Throws:
      DAValidateException - the DA validate exception
      DAException - the DA exception
    • notifyUpdate

      protected void notifyUpdate(BOMeasure measure, PoolKit pk) throws DAValidateException, DAException
      Notifies the measure update.
      Parameters:
      measure - the updated BOMeasure
      pk - the PoolKit
      Throws:
      DAValidateException - the DA validate exception
      DAException - 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 measure
      poolKit - the pool kit providing access to database connections and services
      Throws:
      DAValidateException - if validation fails during the alignment process
      DAException - if a data access error occurs during the alignment process
    • isValidExecution

      public boolean isValidExecution()
      Description copied from interface: ValidExecution
      Determines whether the current state is valid for execution.
      Returns:
      true if execution is valid, false otherwise