Class BTBundleWorkOrderOperationStateChange
java.lang.Object
overit.geocall.bl.BusinessTask<WorkOrderOperationStateChangeEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<WorkOrderOperationStateChangeEvent>
overit.geocallapp.wfm.bundler.bl.task.BTBundler<WorkOrderOperationStateChangeEvent>
overit.geocallapp.wfm.core.bl.bundler.task.BTBundleWorkOrderOperationStateChange
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(WorkOrderOperationStateChangeEvent.class)
public class BTBundleWorkOrderOperationStateChange
extends BTBundler<WorkOrderOperationStateChangeEvent>
Business task in order to change the state of the
When the
Bundle related to
the given BOWorkOrderOperation, according to its state change. When the
WorkOrderOperationStateChangeEvent is launched the BT
notices the call and changes the state of the related Bundle basing
on the event's input. Error Code:
- Since:
- 10.1
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecute(WorkOrderOperationStateChangeEvent event, PoolKit poolKit) If the givenBOWorkOrderOperationis associated to an activeBundle, the state of the relatedBOBundleOperationis changed.protected LonggetBundleOperationStatusFromOutcome(BOBundleOperation bundleOperation, BOWorkOrderOperation woOperation, PoolKit poolKit) Searches for the valid status for theBOBundleOperation: when the givenBOWorkOrderOperationis already associated to aBOAgendaOutcome, the only possible status value isBOBundleOperationStatus.Values.CLOSED.Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.CLOSED.Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.IN_PROGRESS.protected LonggetNewBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) Returns the id of theBOBundleOperationStatusthat corresponds to the status of the givenBOWorkOrderOperation.Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.PLANNED.protected voidlinkWorkOrderOperations(List<Long> woOperationIds, PoolKit poolKit) Creates the new links for the remainingBOWorkOrderOperations of the givenBundle.protected BundleloadBundle(Long workOrderOperationId, PoolKit poolKit) Loads the activeBundlerelated to the givenBOWorkOrderOperationid.protected BOWorkOrderOperationloadWorkOrderOperation(Long workOrderOperationId, PoolKit poolKit) Loads theBOWorkOrderOperationfrom the given input.protected List<BOWorkOrderOperation> loadWorkOrderOperations(List<Long> ids, PoolKit poolKit) Loads the list of relatedBOWorkOrderOperationfrom the given ids.protected voidrecalculateLinks(Bundle bundle, BOBundleOperation bundleOperation, PoolKit poolKit) Recalculates the links between theBOWorkOrderOperations by unlinking all of them and relinking the ones remaining after removing the given one.booleanControls whether an exception should be thrown when execution is invalid.protected voidunlinkWorkOrderOperations(Bundle bundle, PoolKit poolKit) Unlinks of the parentBOWorkOrderOperationfrom all its children.protected LongupdateBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) Updates theBOBundleOperationstatus by callingBundleOperationStatusUpdateEvent, only if the status change is permitted.protected voidupdateSchedulingLinks(Bundle bundle, Long unlinkingOperation, List<Long> remainingOperations, PoolKit poolKit) Updates the relations between the existing active schedulings.Methods inherited from class overit.geocallapp.wfm.bundler.bl.task.BTBundler
getException, isValidExecutionMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, checkValidExecution, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTBundleWorkOrderOperationStateChange
public BTBundleWorkOrderOperationStateChange()
-
-
Method Details
-
throwExceptionIfInvalid
public boolean throwExceptionIfInvalid()Description copied from interface:ValidExecutionControls whether an exception should be thrown when execution is invalid. This method allows implementing classes to specify their exception-throwing behavior whenValidExecution.isValidExecution()returns false. If this method returns true, callers should throw the exception returned byValidExecution.getException().- Specified by:
throwExceptionIfInvalidin interfaceValidExecution- Overrides:
throwExceptionIfInvalidin classBTBundler<WorkOrderOperationStateChangeEvent>- Returns:
- true if an exception should be thrown for invalid execution, false otherwise
-
execute
protected void execute(WorkOrderOperationStateChangeEvent event, PoolKit poolKit) throws DAException, DAValidateException If the givenBOWorkOrderOperationis associated to an activeBundle, the state of the relatedBOBundleOperationis changed.- Specified by:
executein classValidExecutionBusinessTask<WorkOrderOperationStateChangeEvent>- Parameters:
event- theWorkOrderOperationStateChangeEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
loadBundle
protected Bundle loadBundle(Long workOrderOperationId, PoolKit poolKit) throws DAValidateException, DAException Loads the activeBundlerelated to the givenBOWorkOrderOperationid.- Parameters:
workOrderOperationId- theBOWorkOrderOperationidpoolKit- thePoolKit- Returns:
- the related
Bundle - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateBundleOperationStatus
protected Long updateBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) throws DAValidateException, DAException Updates theBOBundleOperationstatus by callingBundleOperationStatusUpdateEvent, only if the status change is permitted.- Parameters:
bundleOperation-BOBundleOperationpoolKit- thePoolKit- Returns:
- the value of the new calculated
BOBundleOperationStatusfor the current bundle operation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getNewBundleOperationStatus
protected Long getNewBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) throws DAValidateException, DAException Returns the id of theBOBundleOperationStatusthat corresponds to the status of the givenBOWorkOrderOperation.- Parameters:
bundleOperation- theBOBundleOperationpoolKit- thePoolKit- Returns:
- the new value of
BOBundleOperationstatus - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getBundleOperationStatusFromOutcome
protected Long getBundleOperationStatusFromOutcome(BOBundleOperation bundleOperation, BOWorkOrderOperation woOperation, PoolKit poolKit) throws DAValidateException, DAException Searches for the valid status for theBOBundleOperation: when the givenBOWorkOrderOperationis already associated to aBOAgendaOutcome, the only possible status value isBOBundleOperationStatus.Values.CLOSED. Otherwise the valueBOBundleOperationStatus.Values.SCHEDULABLEis returned.- Parameters:
bundleOperation- theBOBundleOperationwoOperation- the givenBOWorkOrderOperationpoolKit- thePoolKit- Returns:
- the corresponding valid
BOBundleOperationStatusvalue - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrderOperation
protected BOWorkOrderOperation loadWorkOrderOperation(Long workOrderOperationId, PoolKit poolKit) throws DAValidateException, DAException Loads theBOWorkOrderOperationfrom the given input.- Parameters:
workOrderOperationId- theBOWorkOrderOperationidpoolKit- thePoolKit- Returns:
- the loaded
BOWorkOrderOperation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getPlannedWOOperationStates
Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.PLANNED.- Returns:
- the list of planned
BOWorkOrderOperationStateids.
-
getInProgressWOOperationStates
Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.IN_PROGRESS.- Returns:
- the list of planned
BOWorkOrderOperationStateids.
-
getClosedWOOperationStates
Returns the list ofBOWorkOrderOperationStatethat are valid in order to change theBOBundleOperationstate toBOBundleOperationStatus.Values.CLOSED.- Returns:
- the list of planned
BOWorkOrderOperationStateids.
-
loadWorkOrderOperations
protected List<BOWorkOrderOperation> loadWorkOrderOperations(List<Long> ids, PoolKit poolKit) throws DAValidateException, DAException Loads the list of relatedBOWorkOrderOperationfrom the given ids.- Parameters:
ids- list of neededBOWorkOrderOperationidspoolKit- thePoolKit- Returns:
- a list of needed
BOWorkOrderOperation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
unlinkWorkOrderOperations
protected void unlinkWorkOrderOperations(Bundle bundle, PoolKit poolKit) throws DAValidateException, DAException Unlinks of the parentBOWorkOrderOperationfrom all its children.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
linkWorkOrderOperations
protected void linkWorkOrderOperations(List<Long> woOperationIds, PoolKit poolKit) throws DAValidateException, DAException Creates the new links for the remainingBOWorkOrderOperations of the givenBundle.- Parameters:
woOperationIds- the wo operation idspoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
recalculateLinks
protected void recalculateLinks(Bundle bundle, BOBundleOperation bundleOperation, PoolKit poolKit) throws DAValidateException, DAException Recalculates the links between theBOWorkOrderOperations by unlinking all of them and relinking the ones remaining after removing the given one.- Parameters:
bundle- the currentBundlebundleOperation- the currentBOBundleOperationrelated to theBOWorkOrderOperationto removepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateSchedulingLinks
protected void updateSchedulingLinks(Bundle bundle, Long unlinkingOperation, List<Long> remainingOperations, PoolKit poolKit) throws DAValidateException, DAException Updates the relations between the existing active schedulings.- Parameters:
bundle- the currentBundleunlinkingOperation- the id of theBOWorkOrderOperationto unlinkremainingOperations- list of all theBOWorkOrderOperationthat will remain linkedpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-