All Implemented Interfaces:
Serializable, Tool, ValidExecution

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

  • Constructor Details

    • BTMeasureInsert

      public BTMeasureInsert()
  • Method Details

    • execute

      protected void execute(MeasureInsertEvent event, PoolKit poolKit) throws DAException, DAValidateException
      Description copied from class: ValidExecutionBusinessTask
      Executes the actual business logic after validation has passed.
      Specified by:
      execute in class ValidExecutionBusinessTask<MeasureInsertEvent>
      Parameters:
      event - the input event to process
      poolKit - the PoolKit
      Throws:
      DAException - if a data access error occurs during execution
      DAValidateException - if validation fails during execution
    • validateInput

      protected void validateInput(BOMeasure measure, PoolKit poolKit) throws DAValidateException, DAException
      Validates the BOMeasure object data before its insertion.
      Parameters:
      measure - the BOMeasure object to be inserted
      poolKit - the PoolKit pk
      Throws:
      DAValidateException - if there is a data validation exception
      DAException - if a generic Exception object is thrown
    • loadPreviousMeasure

      protected BOMeasure loadPreviousMeasure(BOMeasure measure, PoolKit poolKit) throws DAValidateException, DAException
      Method that loads the previous measure related to the current measuring element and the date on which the current measure was taken.
      Returns:
      the previous measure
      Throws:
      DAValidateException
      DAException
    • 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
    • setImpossibleToRead

      public void setImpossibleToRead(BOMeasure inputMeasure, PoolKit poolKit) throws DAValidateException, DAException
      Sets a measure as impossible to read and aligns its 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:
      inputMeasure - the measure to be marked as impossible to read
      poolKit - the pool kit for accessing integration services
      Throws:
      DAValidateException - if validation of measure data fails
      DAException - if there's an error during measure processing
    • validateMeasureFeatures

      protected void validateMeasureFeatures(BOMeasure inputMeasure, PoolKit poolKit) throws DAException, DAValidateException
      Method that validates the data related to the measuring features, i.e. the characteristic and the catalog group.

      It also checks that if the characteristic is null we can't have the following properties:

      • measure mode
      • value
      • delta value
      • rotations
      Parameters:
      inputMeasure - the new input measure
      poolKit - the PoolKit
      Throws:
      DAException - thrown if there are data related loading errors
      DAValidateException - thrown if the data related to the measuring characteristic are not valid
    • validateCounterRotations

      protected void validateCounterRotations(BOMeasure inputMeasure, PoolKit poolKit) throws DAValidateException, DAException
      Validates counter rotations for a measure and applies alignment calculations.

      This method:

      • Performs counter alignment check
      • Validates if rotation input is required
      • Applies the calculated alignment values to the measure
      Parameters:
      inputMeasure - the measure to validate and align
      poolKit - the pool kit for accessing services
      Throws:
      DAValidateException - if rotation input is required but not provided
      DAException - if there's an error during alignment calculation
    • getIntegrationService

      public AssetsIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException
      Return the AssetsEventIntegrationService used to access other domains.
      Parameters:
      poolKit - the PoolKit
      Returns:
      the AssetsEventIntegrationService used to access services and events in other domains
      Throws:
      DAValidateException - thrown if there are data related loading errors
    • checkCatalogGroupMeasure

      protected void checkCatalogGroupMeasure(BOMeasure measure) throws DAValidateException
      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 new input measure
      Throws:
      DAValidateException - thrown if the catalog code is not allowed for the catalog group
    • checkCharacteristicMeasure

      protected void checkCharacteristicMeasure(BOMeasure measure) throws DAValidateException
      Method that checks if the measure is valid for the characteristic.

      For a characteristic that is not of type meter we also check that the user didn't specify the following properties:

      • measure mode
      • delta value
      • rotations
      • cumulative value
      Parameters:
      measure - the new input measure
      Throws:
      DAValidateException - thrown if the measure is not valid for the characteristic
    • completeMeasureMode

      protected void completeMeasureMode(BOMeasure measure)
    • validateMeasureValues

      protected void validateMeasureValues(BOMeasure measure) throws DAValidateException
      Validates that either value or deltaValue is present in the measure, but not both.

      This method enforces the following rules:

      • At least one of value or deltaValue must be provided
      • Value and deltaValue cannot both be present simultaneously
      • Sets the measure mode to DIFFERENCE if deltaValue is provided, ABSOLUTE otherwise
      Parameters:
      measure - the measure to validate
      Throws:
      DAValidateException - if both values are missing or if both values are present
    • 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
    • validateMeasureValueConstraints

      protected void validateMeasureValueConstraints(BOMeasure measure, PoolKit poolKit) throws DAValidateException, DAException
      Validates that measure values comply with characteristic-defined constraints.

      Performs the following validations:

      • Loads the characteristic associated with the measuring element
      • Validates numeric constraints (precision, range, etc.) on the measure value
      Parameters:
      measure - the measure to validate
      poolKit - the PoolKit for accessing services
      Throws:
      DAValidateException - if the measure values violate characteristic constraints
      DAException - if there are errors loading the characteristic data
    • completeData

      protected void completeData(BOMeasure inputMeasure)
      Method that completes the data of the measure.
      Parameters:
      inputMeasure - the new input measure
    • insertMeasure

      protected Long insertMeasure(BOMeasure measure, PoolKit poolKit) throws DAValidateException, DAException
      Inserts the given measure.
      Parameters:
      measure - the measure
      poolKit - the PoolKit
      Returns:
      the id of the inserted BOMeasure
      Throws:
      DAValidateException - the DA validate exception
      DAException - the DA exception
    • notifyInsert

      protected void notifyInsert(BOMeasure measure, PoolKit poolKit) throws DAValidateException, DAException
      Notifies the insertion of a new measure.
      Parameters:
      measure - the BOMeasure
      poolKit - the PoolKit
      Throws:
      DAValidateException - the DA validate exception
      DAException - the DA exception
    • 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