Class BTWorkOrderHeaderStatusDeductionFromOperations
java.lang.Object
overit.geocall.bl.BusinessTask<WorkOrderHeaderStatusDeductionFromOperationsEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<WorkOrderHeaderStatusDeductionFromOperationsEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<WorkOrderHeaderStatusDeductionFromOperationsEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.header.task.BTWorkOrderHeaderStatusDeductionFromOperations
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(WorkOrderHeaderStatusDeductionFromOperationsEvent.class)
public class BTWorkOrderHeaderStatusDeductionFromOperations
extends ValidPermissionBusinessTask<WorkOrderHeaderStatusDeductionFromOperationsEvent>
Business task in order to calculate the status of a
BOWorkOrderHeader using its operations.
When the WorkOrderHeaderStatusDeductionFromOperationsEvent is launched
the BT notices the call and calculates the status of the BOWorkOrderHeader basing on the event's input.
- Since:
- 19.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 TypeMethodDescriptioncalculateWorkOrderHeaderStatus(List<BOWorkOrderOperation> operations, PoolKit poolKit) Work Order state automaton.protected booleancheckDefaultOpenWOCondition(Set<Long> operationStates) Checks if the work order is in status openprotected voidexecute(WorkOrderHeaderStatusDeductionFromOperationsEvent event, PoolKit poolKit) Updates the status of aBOWorkOrderHeader.protected booleanexistsInSet(Set<Long> mainSet, Set<Long> valuesToFind) Check if at least one value of the valuesToFind parameter is contained in the mainSet parameter.getSchedulableOperationsStatus(List<BOWorkOrderOperation> operations, PoolKit poolKit) Loads the work order operations status related to schedulable operationsbooleanChecks if is valid execution.protected booleanisWaitingForTechnicalValidation(List<BOWorkOrderOperation> operations, PoolKit poolKit) Returns true if exists at least one work order operation that requires validation, false otherwiseprotected List<InterventionAggregate> loadWorkOrderInterventions(Set<Long> operations, PoolKit poolKit) Loads the not cancelled interventions related to the work order operations.protected List<BOWorkOrderOperation> loadWorkOrderOperations(Long workOrderId, PoolKit poolKit) Loads the operations of a Work Orderprotected booleanonlyCancelledOperations(Set<Long> schedulableOperationsStates) Returns true if all the work order (schedulable) operations are cancelled, false otherwiseprotected booleanonlyClosedOrCancelledActivities(Set<Long> schedulableOperationsStatus) Returns true if all the work order (schedulable) operations are closed or cancelled, false otherwiseprotected booleanonlyDraftOperations(List<BOWorkOrderOperation> operations) Checks the status of the Work Order OperationsremoveFromSet(Set<Long> mainSet, Set<Long> valuesToRemove) Clones the main set removing all the values defined in the valuesToRemove parameterMethods 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
-
BTWorkOrderHeaderStatusDeductionFromOperations
public BTWorkOrderHeaderStatusDeductionFromOperations()
-
-
Method Details
-
execute
protected void execute(WorkOrderHeaderStatusDeductionFromOperationsEvent event, PoolKit poolKit) throws DAException, DAValidateException Updates the status of aBOWorkOrderHeader.- Specified by:
executein classValidExecutionBusinessTask<WorkOrderHeaderStatusDeductionFromOperationsEvent>- Parameters:
event- theWorkOrderHeaderStatusRecalculateEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
loadWorkOrderOperations
protected List<BOWorkOrderOperation> loadWorkOrderOperations(Long workOrderId, PoolKit poolKit) throws DAValidateException, DAException Loads the operations of a Work Order- Parameters:
workOrderId- the Work Order idpoolKit- thePoolKit- Returns:
- all the work order operations
- Throws:
DAValidateExceptionDAException
-
calculateWorkOrderHeaderStatus
public Long calculateWorkOrderHeaderStatus(List<BOWorkOrderOperation> operations, PoolKit poolKit) throws DAValidateException, DAException Work Order state automaton.
The status is deducted starting from the operations.- Parameters:
operations- the operations of the Work OrderpoolKit- thePoolKit- Returns:
- the new work order header status
- Throws:
DAValidateExceptionDAException
-
removeFromSet
Clones the main set removing all the values defined in the valuesToRemove parameter- Parameters:
mainSet- the main setvaluesToRemove- the set with the values to remove- Returns:
- a copy of the main set without the elements contained in the valuesToRemove set
-
existsInSet
Check if at least one value of the valuesToFind parameter is contained in the mainSet parameter.- Parameters:
mainSet- the set with all the datavaluesToFind- the set with the values to find- Returns:
- true if at least one value of the valuesToFind parameter is contained in the mainSet parameter, false otherwise.
-
onlyDraftOperations
Checks the status of the Work Order Operations- Parameters:
operations- the Work Order Operations- Returns:
- true if all the work order operations are in a draft state, false otherwise
-
getSchedulableOperationsStatus
protected Set<Long> getSchedulableOperationsStatus(List<BOWorkOrderOperation> operations, PoolKit poolKit) throws DAValidateException, DAException Loads the work order operations status related to schedulable operations- Parameters:
operations- the operations of the Work OrderpoolKit- thePoolKit- Returns:
- the work order operations status related to schedulable operations
- Throws:
DAExceptionDAValidateException
-
checkDefaultOpenWOCondition
Checks if the work order is in status open- Parameters:
operationStates- the status of the schedulable operations- Returns:
- true if there is at least one open operation, false otherwise.
-
onlyClosedOrCancelledActivities
Returns true if all the work order (schedulable) operations are closed or cancelled, false otherwise- Parameters:
schedulableOperationsStatus- the status of the scheduled operations- Returns:
- true if all the work order (schedulable) operations are closed or cancelled, false otherwise
-
loadWorkOrderInterventions
protected List<InterventionAggregate> loadWorkOrderInterventions(Set<Long> operations, PoolKit poolKit) throws DAException, DAValidateException Loads the not cancelled interventions related to the work order operations.- Parameters:
operations- the work order operationspoolKit- thePoolKit- Returns:
- the interventions related to the work order operations.
- Throws:
DAExceptionDAValidateException
-
isWaitingForTechnicalValidation
protected boolean isWaitingForTechnicalValidation(List<BOWorkOrderOperation> operations, PoolKit poolKit) throws DAException, DAValidateException Returns true if exists at least one work order operation that requires validation, false otherwise- Parameters:
operations- the work order operationspoolKit- thePoolKit- Returns:
- true if exists at least one work order operation that requires validation, false otherwise
- Throws:
DAValidateExceptionDAException
-
onlyCancelledOperations
Returns true if all the work order (schedulable) operations are cancelled, false otherwise- Parameters:
schedulableOperationsStates-- Returns:
- true if all the work order (schedulable) operations are cancelled, false otherwise
-
isValidExecution
public boolean isValidExecution()Checks if is valid execution.- Returns:
- true, if successful
-