Class BTInterventionResourceUpdate
java.lang.Object
overit.geocall.bl.BusinessTask<InterventionResourceUpdateEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<InterventionResourceUpdateEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<InterventionResourceUpdateEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.intervention.resource.task.BTInterventionResourceUpdate
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(InterventionResourceUpdateEvent.class)
public class BTInterventionResourceUpdate
extends ValidPermissionBusinessTask<InterventionResourceUpdateEvent>
Business task to update a intervention resource.
Permission:
Error Code:
- Since:
- 18.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 voidcheckWorkOrderStatus(BOInterventionResource interventionResource, PoolKit poolKit) Checks the status of the work order associated with the providedBOInterventionResource.protected voidexecute(InterventionResourceUpdateEvent event, PoolKit poolKit) Executes the intervention resource update process.protected BOInterventionResourcegetExistingInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) Retrieves the existingBOInterventionResourceto be updated.protected WorkOrdersIntegrationServicegetIntegrationService(PoolKit poolKit) Retrieves the WorkOrdersIntegrationService instance.protected LonggetNearestWorkShift(BOInterventionResource interventionResource, PoolKit poolKit) Retrieves the nearest work shift for the given intervention resource.protected BOWorkOrderOperationgetWorkOrderOperation(BOInterventionResource interventionResource, PoolKit poolKit) Retrieves theBOWorkOrderOperationassociated with the providedBOInterventionResource.booleanDetermines whether the current state is valid for execution.protected voidmanageWorkOrderOperationResource(BOInterventionResource interventionResource, BOInterventionResource existingInterventionResource, PoolKit poolKit) Updates aBOWorkOrderOperationResourcebased on the providedBOInterventionResource.protected voidnotifyInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) Sends an intervention resource notification.protected voidupdateInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) Updates aBOInterventionResource.protected voidupdateValidationStatus(PoolKit poolKit) Updates the validation status by calling theInterventionOutcomeValidationStatusUpdateEventprotected voidupdateWorkOrder(PoolKit poolKit) Updates the work order header after an intervention resource has been inserted.protected voidupdateWorkOrderOperationResource(BOWorkOrderOperationResource workOrderOperationResource, PoolKit poolKit) Updates an existingBOWorkOrderOperationResource.protected voidvalidate(BOInterventionResource interventionResource, BOInterventionResource existingInterventionResource, PoolKit poolKit) Check on mandatory fields and visibility of properties.protected voidvalidateDates(BOInterventionResource interventionResource) Validates the date-related properties of the providedBOInterventionResource.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
-
intervention
-
workOrderOperation
-
-
Constructor Details
-
BTInterventionResourceUpdate
public BTInterventionResourceUpdate()
-
-
Method Details
-
execute
protected void execute(InterventionResourceUpdateEvent event, PoolKit poolKit) throws DAException, DAValidateException Executes the intervention resource update process.This method performs the following steps:
- Validates the provided
BOInterventionResourceinstance - Updates the intervention resource
- Updates the work order operation resource
- Updates the work order
- Notifies about the intervention resource update
- Updates the intervention outcome validation status
- Specified by:
executein classValidExecutionBusinessTask<InterventionResourceUpdateEvent>- Parameters:
event- theInterventionResourceUpdateEventcontaining the inputBOInterventionResourcepoolKit- thePoolKit- Throws:
DAException- if any data access exception occursDAValidateException- if any data validation exception occurs
- Validates the provided
-
validate
protected void validate(BOInterventionResource interventionResource, BOInterventionResource existingInterventionResource, PoolKit poolKit) throws DAValidateException, DAException Check on mandatory fields and visibility of properties.- Parameters:
interventionResource- theBOInterventionResourceexistingInterventionResource- the existingBOInterventionResourceto be updatedpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validateDates
protected void validateDates(BOInterventionResource interventionResource) throws DAValidateException Validates the date-related properties of the providedBOInterventionResource.- Parameters:
interventionResource- theBOInterventionResourceto validate- Throws:
DAValidateException- if any of the date-related properties are missing or invalid
-
getExistingInterventionResource
protected BOInterventionResource getExistingInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) throws DAValidateException, DAException Retrieves the existingBOInterventionResourceto be updated.- Parameters:
interventionResource- theBOInterventionResourceto use as a filterpoolKit- thePoolKitto use for the search- Returns:
- a list of
BOInterventionResourceobjects matching the filter - Throws:
DAValidateException- if any required properties are missing in theBOInterventionResourceDAException- if an error occurs during the search
-
checkWorkOrderStatus
protected void checkWorkOrderStatus(BOInterventionResource interventionResource, PoolKit poolKit) throws DAValidateException, DAException Checks the status of the work order associated with the providedBOInterventionResource.- Parameters:
interventionResource- theBOInterventionResourceto check the work order status forpoolKit- thePoolKit- Throws:
DAValidateException- if the work order is in a closed, aligned, or cancelled stateDAException- if an error occurs during the check
-
getWorkOrderOperation
protected BOWorkOrderOperation getWorkOrderOperation(BOInterventionResource interventionResource, PoolKit poolKit) throws DAValidateException, DAException Retrieves theBOWorkOrderOperationassociated with the providedBOInterventionResource.- Parameters:
interventionResource- theBOInterventionResourceto use for retrieving theBOWorkOrderOperationpoolKit- thePoolKitto use for the retrieval- Returns:
- the
BOWorkOrderOperationassociated with the providedBOInterventionResource - Throws:
DAValidateException- if any validation error occurs during the retrievalDAException- if an error occurs during the retrieval
-
updateInterventionResource
protected void updateInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) throws DAException, DAValidateException Updates aBOInterventionResource.- Parameters:
interventionResource- theBOInterventionResourceto updatepoolKit- thePoolKit- Throws:
DAValidateException- If there is a validation error.DAException- If an error occurs during the data access.
-
getNearestWorkShift
protected Long getNearestWorkShift(BOInterventionResource interventionResource, PoolKit poolKit) throws DAException, DAValidateException Retrieves the nearest work shift for the given intervention resource.- Parameters:
interventionResource- theBOInterventionResourceto find the nearest work shift forpoolKit- thePoolKit- Returns:
- the id of the nearest work shift, or null if no work shift is found
- Throws:
DAValidateException- If there is a validation error.DAException- If an error occurs during the data access.
-
manageWorkOrderOperationResource
protected void manageWorkOrderOperationResource(BOInterventionResource interventionResource, BOInterventionResource existingInterventionResource, PoolKit poolKit) throws DAValidateException, DAException Updates aBOWorkOrderOperationResourcebased on the providedBOInterventionResource. If a matchingBOWorkOrderOperationResourceis found, the spent time is updated. Otherwise, a newBOWorkOrderOperationResourceis created.- Parameters:
interventionResource- theBOInterventionResourceexistingInterventionResource-poolKit- thePoolKit- Throws:
DAValidateException- If there is a validation error.DAException- If an error occurs during the data access.
-
updateWorkOrderOperationResource
protected void updateWorkOrderOperationResource(BOWorkOrderOperationResource workOrderOperationResource, PoolKit poolKit) throws DAValidateException, DAException Updates an existingBOWorkOrderOperationResource.- Parameters:
workOrderOperationResource- theBOWorkOrderOperationResourceto updatepoolKit- thePoolKit- Throws:
DAValidateException- If there is a validation error.DAException- If an error occurs during the data access.
-
updateWorkOrder
Updates the work order header after an intervention resource has been inserted.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- if there is a validation errorDAException- if there is a data access exception
-
notifyInterventionResource
protected void notifyInterventionResource(BOInterventionResource interventionResource, PoolKit poolKit) throws DAValidateException, DAException Sends an intervention resource notification.- Parameters:
interventionResource- TheBOInterventionResourceobject representing the intervention resource.poolKit- ThePoolKit- Throws:
DAValidateException- If there is a validation error.DAException- If an error occurs during the data access.
-
updateValidationStatus
Updates the validation status by calling theInterventionOutcomeValidationStatusUpdateEvent- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getIntegrationService
protected WorkOrdersIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException Retrieves the WorkOrdersIntegrationService instance. If the instance hasn't been created yet, it will be created and stored for future use.- Parameters:
poolKit- ThePoolKit.- Returns:
- The
WorkOrdersIntegrationServiceinstance. - Throws:
DAValidateException- If any validation error occurs.
-
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
-