Class BTMeasuringElementUpdate
java.lang.Object
overit.geocall.bl.BusinessTask<MeasuringElementUpdateEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<MeasuringElementUpdateEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<MeasuringElementUpdateEvent>
overit.geocallapp.wfm.orchestrator.assets.bl.measuringelement.task.BTMeasuringElementUpdate
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(MeasuringElementUpdateEvent.class)
public class BTMeasuringElementUpdate
extends ValidPermissionBusinessTask<MeasuringElementUpdateEvent>
Business task in order to update a
When the
Permissions: Error codes:
BOMeasuringElement. When the
MeasuringElementUpdateEvent is launched the BT notices the call and
updates the BOMeasuringElement according to the event's input. Permissions: Error codes:
Codes.INVALID_PROPERTY_VALUEfor code, description and statusCodes.FIELDS_LENGTHfor code and descriptionCodes.NOT_FOUNDfor technical object, status, counter direction, characteristic, measurement unit and catalog groupCodes.MeasuringElement.UNDEFINED_CHARACTERISTIC_AND_CATALOG_GROUPCodes.MeasuringElement.INVALID_CHARACTERISTIC_USAGECodes.MeasuringElement.PROPERTY_NOT_ALLOWED_FOR_CHARACTERISTICCodes.MeasuringElement.PROPERTY_NOT_ALLOWED_WITHOUT_CHARACTERISTICCodes.MeasuringElement.MEASUREMENT_CATALOG_GROUP_REQUIREDCodes.MeasuringElement.ONLY_STATUS_ADMISSIBLE_FOR_UPDATE
- Since:
- 20.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckUniqueness(BOMeasuringElement measuringElement, PoolKit pk) Validates that no other measuring element exists with the same code for the given technical object.protected voidexecute(MeasuringElementUpdateEvent event, PoolKit pk) Updates theBOMeasuringElementobject.protected AssetsIntegrationServiceReturns an instance ofAssetsIntegrationService.booleanDetermines whether the current state is valid for execution.protected voidvalidateForUpdate(BOMeasuringElement measuringElement, PoolKit pk) Validates a measuring element for update when no measures exist.protected voidvalidateInput(BOMeasuringElement measuringElement, PoolKit pk) Validates theBOMeasuringElementobject data before its update.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
-
Constructor Details
-
BTMeasuringElementUpdate
public BTMeasuringElementUpdate()
-
-
Method Details
-
getIntegrationService
Returns an instance ofAssetsIntegrationService.- Parameters:
pk- thePoolKit- Returns:
- an instance of
AssetsIntegrationService - Throws:
DAValidateException- the DA validate exception
-
execute
protected void execute(MeasuringElementUpdateEvent event, PoolKit pk) throws DAException, DAValidateException Updates theBOMeasuringElementobject.- Specified by:
executein classValidExecutionBusinessTask<MeasuringElementUpdateEvent>- Parameters:
event- theMeasuringElementUpdateEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validateInput
protected void validateInput(BOMeasuringElement measuringElement, PoolKit pk) throws DAValidateException, DAException Validates theBOMeasuringElementobject data before its update.- Parameters:
measuringElement- theBOMeasuringElementobject to be updatedpk- thePoolKitpk- Throws:
DAValidateException- if there is a data validation exceptionDAException- if a genericExceptionobject is thrown
-
validateForUpdate
protected void validateForUpdate(BOMeasuringElement measuringElement, PoolKit pk) throws DAValidateException, DAException Validates a measuring element for update when no measures exist.Performs the following validations:
- Validates code and description properties (length and non-empty)
- Validates status exists and is valid
- Checks uniqueness of code within technical object
- Validates counter direction if specified
- Ensures either characteristic or catalog group is defined
- If characteristic is present:
- Validates characteristic exists and has valid usage
- Validates measurement unit and max length
- Validates counter-related properties for meter characteristics
- If catalog group is present, validates it exists and is of measurement type
- Parameters:
measuringElement- the measuring element to validatepk- the pool kit for accessing services- Throws:
DAValidateException- if any validation failsDAException- if there's an error accessing services
-
checkUniqueness
protected void checkUniqueness(BOMeasuringElement measuringElement, PoolKit pk) throws DAValidateException, DAException Validates that no other measuring element exists with the same code for the given technical object.The method searches for measuring elements with the same code and technical object, excluding the current measuring element being updated (by ID comparison).
- Parameters:
measuringElement- the measuring element to check for uniquenesspk- the pool kit for accessing integration services- Throws:
DAValidateException- withCodes.CODE_ALREADY_DEFINEDif another measuring element with the same code exists for the technical objectDAException- if there's an error during the search operation
-
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
-