Class BTBundleOperationCancel
java.lang.Object
overit.geocall.bl.BusinessTask<BundleOperationCancelEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<BundleOperationCancelEvent>
overit.geocallapp.wfm.bundler.bl.task.BTBundler<BundleOperationCancelEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.bundler.bundle.task.BTBundleOperationCancel
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(BundleOperationCancelEvent.class)
public class BTBundleOperationCancel
extends BTBundler<BundleOperationCancelEvent>
Business task in order to cancel a
When the
BOBundleOperation. When the
BundleOperationCancelEvent is launched the BT notices the
call and cancels the BOBundleOperation basing on the event's input.
Required fields:
- bundle operation id
Permission:
Error Code:
Codes.OPERATION_NOT_PERMITTED: Operation not allowedCodes.Bundler.BUNDLE_NOT_SCHEDULABLECodes.Bundler.BUNDLE_OPERATIONS_NOT_FOUND_IN_BUNDLECodes.Bundler.BUNDLE_OPERATIONS_NOT_SCHEDULABLE
Visibility:
- active bundle operations that belongs to the specified bundle
- work order operations associated to the specified bundle
- appointment associated to the specified bundle operation
- skill and skill division associated to the specified bundle
- Since:
- 11.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateBundleAttributes(Bundle bundle, PoolKit poolKit) Calculates all theBundleattributes.protected voidcancelBundleOperations(Bundle bundle, Collection<BOBundleOperation> bundleOperations, PoolKit poolKit) Cancels the givenBOBundleOperations, unlinks the relatedBOAppointment, recalculates the links between the remainingBOBundleOperations and finally updates the relatedBundle.protected voidchangeBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) Updates the status of the givenBOBundleOperationtoBOBundleOperationStatus.Values.CANCELLED.protected voidChecks if the user has the required permission.protected voiddeleteSkillDivisions(Bundle bundle, PoolKit poolKit) Deletes all the existing relation between the skill divisions and the givenBundle.protected voiddeleteSkills(Bundle bundle, PoolKit poolKit) Deletes all the existing relation between the skills and the givenBundle.protected voidexecute(BundleOperationCancelEvent event, PoolKit poolKit) Cancels the specifiedBOBundleOperationassociated to the givenBundle.protected WorkOrdersIntegrationServicegetIntegrationService(PoolKit poolKit) Retrieves theWorkOrdersIntegrationServiceinstance.protected LonginsertSkill(BOBundleSkill bundleSkill, PoolKit poolKit) Inserts the relation between the currentBundleand a skill.protected LonginsertSkillDivision(BOBundleSkillDivision bundleSkillDivision, PoolKit poolKit) Inserts the relation between the currentBundleand a skill division.protected voidlinkWorkOrderOperations(List<Long> woOperationIds, PoolKit poolKit) Creates the new links between the given theBOWorkOrderOperations.protected BundleloadBundle(Long bundleId, PoolKit poolKit) Loads theBundlerelated to the given id.protected List<BOBundleOperation> loadBundleOperations(Bundle bundle, Collection<Long> bundleOperations, PoolKit poolKit) Loads theBOBundleOperations from theBundle.protected List<BOWorkOrderOperation> loadWorkOrderOperations(List<Long> ids, PoolKit poolKit) Loads all theBOWorkOrderOperations related to the give list of ids.protected voidnotifyBundleOperationCancel(BOBundleOperation bundleOperation, PoolKit poolKit) Notifies the cancellation of the givenBOBundleOperation.protected voidrecalculateLinks(Bundle bundle, Collection<BOBundleOperation> bundleOperations, PoolKit poolKit) Recalculates the links of the remainingBOBundleOperations.protected LongsaveBundle(Bundle bundle, PoolKit poolKit) Saves theBundleand adds the relation with the skills and skill divisions.protected voidUnbundles the specifiedBundle.protected voidunlinkWorkOrderOperations(Bundle bundle, PoolKit poolKit) Unlinks all theBOWorkOrderOperations associated to the givenBundle.protected voidupdateBundle(Bundle bundle, PoolKit poolKit) Updates theBundle, recalculates all its attributes, including the skills and skill divisions.protected voidupdateHeader(BOBundleHeader bundleHeader, PoolKit poolKit) Updates the givenBOBundleHeader.protected voidvalidate(Bundle bundle, Collection<BOBundleOperation> bundleOperations) Checks if the bundle state isBOBundleStatus.Values.SCHEDULABLEand if the operations are found on theBundle.Methods inherited from class overit.geocallapp.wfm.bundler.bl.task.BTBundler
getException, isValidExecution, throwExceptionIfInvalidMethods 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
-
BTBundleOperationCancel
public BTBundleOperationCancel()
-
-
Method Details
-
execute
protected void execute(BundleOperationCancelEvent event, PoolKit poolKit) throws DAException, DAValidateException Cancels the specifiedBOBundleOperationassociated to the givenBundle.- Specified by:
executein classValidExecutionBusinessTask<BundleOperationCancelEvent>- Parameters:
event- theBundleOperationCancelEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
checkUserPermission
Checks if the user has the required permission.- Throws:
DAValidateException- the DA validate exception
-
loadBundle
Loads theBundlerelated to the given id.- Parameters:
bundleId- theBundleidpoolKit- thePoolKit- Returns:
- the loaded
Bundle - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadBundleOperations
protected List<BOBundleOperation> loadBundleOperations(Bundle bundle, Collection<Long> bundleOperations, PoolKit poolKit) throws DAValidateException, DAException Loads theBOBundleOperations from theBundle.- Parameters:
bundle- theBundlebundleOperations- the bundleOperationspoolKit- thePoolKit- Returns:
- collection of
BOBundleOperations found in the bundle - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
validate
protected void validate(Bundle bundle, Collection<BOBundleOperation> bundleOperations) throws DAValidateException Checks if the bundle state isBOBundleStatus.Values.SCHEDULABLEand if the operations are found on theBundle. and if the operations state isBOBundleOperationStatus.Values.SCHEDULABLE.- Parameters:
bundle- theBundlebundleOperations- theBOBundleOperations- Throws:
DAValidateException- the DA validate exception
-
unbundle
Unbundles the specifiedBundle.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
cancelBundleOperations
protected void cancelBundleOperations(Bundle bundle, Collection<BOBundleOperation> bundleOperations, PoolKit poolKit) throws DAValidateException, DAException Cancels the givenBOBundleOperations, unlinks the relatedBOAppointment, recalculates the links between the remainingBOBundleOperations and finally updates the relatedBundle.- Parameters:
bundle- theBundlebundleOperations- theBOBundleOperationspoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
changeBundleOperationStatus
protected void changeBundleOperationStatus(BOBundleOperation bundleOperation, PoolKit poolKit) throws DAValidateException, DAException Updates the status of the givenBOBundleOperationtoBOBundleOperationStatus.Values.CANCELLED.- Parameters:
bundleOperation- theBOBundleOperationpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
recalculateLinks
protected void recalculateLinks(Bundle bundle, Collection<BOBundleOperation> bundleOperations, PoolKit poolKit) throws DAValidateException, DAException Recalculates the links of the remainingBOBundleOperations.- Parameters:
bundle- theBundlebundleOperations- theBOBundleOperationspoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
unlinkWorkOrderOperations
protected void unlinkWorkOrderOperations(Bundle bundle, PoolKit poolKit) throws DAValidateException, DAException Unlinks all theBOWorkOrderOperations associated to the givenBundle.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrderOperations
protected List<BOWorkOrderOperation> loadWorkOrderOperations(List<Long> ids, PoolKit poolKit) throws DAValidateException, DAException Loads all theBOWorkOrderOperations related to the give list of ids.- Parameters:
ids- list ofBOWorkOrderOperationspoolKit- thePoolKit- Returns:
- a list of loaded
BOWorkOrderOperations - 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 between the given theBOWorkOrderOperations.- Parameters:
woOperationIds- list ofBOWorkOrderOperationidspoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateBundle
Updates theBundle, recalculates all its attributes, including the skills and skill divisions.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
deleteSkills
Deletes all the existing relation between the skills and the givenBundle.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
deleteSkillDivisions
protected void deleteSkillDivisions(Bundle bundle, PoolKit poolKit) throws DAValidateException, DAException Deletes all the existing relation between the skill divisions and the givenBundle.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
calculateBundleAttributes
protected void calculateBundleAttributes(Bundle bundle, PoolKit poolKit) throws DAValidateException, DAException Calculates all theBundleattributes.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
saveBundle
Saves theBundleand adds the relation with the skills and skill divisions.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Returns:
- the saved
Bundleid - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateHeader
protected void updateHeader(BOBundleHeader bundleHeader, PoolKit poolKit) throws DAValidateException, DAException Updates the givenBOBundleHeader.- Parameters:
bundleHeader- theBOBundleHeaderpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
insertSkill
protected Long insertSkill(BOBundleSkill bundleSkill, PoolKit poolKit) throws DAValidateException, DAException Inserts the relation between the currentBundleand a skill.- Parameters:
bundleSkill- theBOBundleSkillpoolKit- thePoolKit- Returns:
- the inserted
BOBundleSkillid - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
insertSkillDivision
protected Long insertSkillDivision(BOBundleSkillDivision bundleSkillDivision, PoolKit poolKit) throws DAValidateException, DAException Inserts the relation between the currentBundleand a skill division.- Parameters:
bundleSkillDivision- theBOBundleSkillDivisionpoolKit- thePoolKit- Returns:
- the inserted
BOBundleSkillDivisionid - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
notifyBundleOperationCancel
protected void notifyBundleOperationCancel(BOBundleOperation bundleOperation, PoolKit poolKit) throws DAValidateException, DAException Notifies the cancellation of the givenBOBundleOperation.- Parameters:
bundleOperation- theBOBundleOperationpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getIntegrationService
protected WorkOrdersIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException Retrieves theWorkOrdersIntegrationServiceinstance. 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.
-