Class BTBundleAttributesCalculate
java.lang.Object
overit.geocall.bl.BusinessTask<BundleAttributesCalculateEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<BundleAttributesCalculateEvent>
overit.geocallapp.wfm.bundler.bl.task.BTBundler<BundleAttributesCalculateEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.bundler.bundling.task.BTBundleAttributesCalculate
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(BundleAttributesCalculateEvent.class)
public class BTBundleAttributesCalculate
extends BTBundler<BundleAttributesCalculateEvent>
Business task in order to calculate a
When the
BOBundleHeader attributes. When the
BundleAttributesCalculateEvent is launched
the BT notices the call and calculates the BOBundleHeader attributes basing on the event's input. - Since:
- 10.1
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateSchedulingAttributes(Bundle bundle, List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Calculates the scheduling attributes for the currentBundle.protected voidcheckFinalMaxTeamCardinality(Bundle bundle) Checks if the calculated maximum team cardinality of theBundleis greater than the minimum one.protected voidcreateBundleSkill(Bundle bundle, Long skillId, Long cardinality) Creates aBOBundleSkillstarting from the given skill and its cardinality.protected voidcreateBundleSkill(Bundle bundle, BOSkillConfigurationSkill skillConfigurationSkill) Creates aBOBundleSkillstarting from the givenBOSkillConfigurationSkill.protected voidcreateBundleSkillDivision(Bundle bundle, BOSkillConfigurationDivision skillConfigurationDivision) Creates aBOBundleSkillDivisionstarting from the givenBOSkillConfigurationSkill.protected voidcreateBundleSkillOverride(Bundle bundle, BOSkillOverrideConfigurationSkill skillOverrideConfigurationSkill) Creates aBOBundleSkillstarting from the givenBOSkillOverrideConfigurationSkill.protected voidcreateSkillAndSkillDivision(Bundle bundle, List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) protected voidcreateSkillAndSkillDivisionByConfiguration(Bundle bundle, Long skillConfigurationId, BundleEntitiesCache cache, PoolKit poolKit) Starting from theBOSkillConfiguration, it creates all the skills and skill divisions for the currentBundle.protected voidcreateSkillAndSkillDivisionByConfigurationOverride(Bundle bundle, Long skillOverrideConfigurationId, PoolKit poolKit) Starting from theBOSkillOverrideConfiguration, it creates all the skills for the currentBundle.protected voidexecute(BundleAttributesCalculateEvent event, PoolKit poolKit) Starting from the givenBundleAttributesCalculateEventinput, it calculates the scheduling attributes for the currentBundleand creates theBOSkills andBOSkillDivisions.protected DategetBundleAppointmentEndDate(List<BOWorkOrderHeader> workOrders) Returns theBundlemain appointment end date based on the list of related work orders.protected DategetBundleAppointmentStartDate(List<BOWorkOrderHeader> workOrders) Returns theBundlemain appointment start date based on the list of related work orders.protected LonggetBundleCardinality(List<BOWorkOrderOperation> woOperations) Returns theBundlecardinality based on the related list ofBOWorkOrderOperations.protected LonggetBundleDefaultDuration(List<BOWorkOrderOperation> woOperations, PoolKit poolKit) Returns theBundledefault duration based on the related list ofBOWorkOrderOperations.protected DategetBundleEndDate(List<BOWorkOrderHeader> workOrders) Returns theBundleend date based on the list of related work order.protected StringgetBundleMicrocluster(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) protected LonggetBundleMinTimeForDay(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Returns the bundle minimum time for day based on the related list ofBOWorkOrderOperations.protected LonggetBundleMinTimeForSuspension(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Returns the bundle minimum time for suspension based on the related list ofBOWorkOrderOperations.protected DategetBundleStartDate(List<BOWorkOrderHeader> workOrders) Returns theBundlestart date based on the list of related work order.protected DoublegetBundleXCoordinate(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) protected DoublegetBundleYCoordinate(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) protected Stream<BOActivity> getOperationActivities(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Loads from theBundleEntitiesCacheeveryBOActivitythat is related to aBOWorkOrderOperationin theBundle.protected BOSkillOverrideConfigurationgetSkillOverrideConfiguration(Long skillOverrideConfigurationId, PoolKit poolKit) Returns theBOSkillOverrideConfigurationwhich corresponds to the given id.protected List<BOSkillOverrideConfigurationSkill> getSkillOverrideConfigurationSkills(Long skillOverrideConfigurationId, PoolKit poolKit) Returns the list ofBOSkillOverrideConfigurationSkillfiltering by the correspondingBOSkillOverrideConfigurationid.protected BOAddressgetWorkOrderOperationAddress(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) Returns theBOAddressrelated to the givenBOWorkOrderOperation.protected booleanisBundleBooking(List<BOWorkOrderHeader> workOrders, PoolKit poolKit) Checks whether any of theBOWorkOrderHeaderrelated to the currentBundleis considered as booking.protected BooleanisBundleMultiDay(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundleextends on multiple days or not.protected BooleanisBundleOnCallExcluded(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundlehas on call resources and therefore it must be excluded.protected BooleanisBundleOnDutyOnly(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundlerequires only resources that are currently on duty or not.protected List<BOWorkOrderOperation> loadWorkOrderOperations(Bundle bundle, PoolKit poolKit) Loads the list of all theBOWorkOrderOperations related to the currentBundle.protected voidresetSchedulingAttributes(Bundle bundle) Resets the scheduling attributes of the currentBundle.protected voidsetBundleCardinalities(Bundle bundle, Long skillMin, Long skillMax) Calculates the bundle cardinalities basing on the given skill cardinalities.protected voidsetBundleCardinalities(Bundle bundle, BOSkillConfiguration skillConfiguration) Calculates the bundle cardinalities basing on the givenBOSkillConfiguration.protected voidsetBundleCardinalitiesOverride(Bundle bundle, BOSkillOverrideConfiguration skillOverrideConfiguration) Calculates the bundle cardinalities basing on the givenBOSkillOverrideConfiguration.protected voidsetOperationsRequirements(Bundle bundle, List<BOWorkOrderOperation> woOperations, PoolKit poolKit) Sets the aggregated requirements for the bundle based on all its operations.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
-
BTBundleAttributesCalculate
public BTBundleAttributesCalculate()
-
-
Method Details
-
execute
protected void execute(BundleAttributesCalculateEvent event, PoolKit poolKit) throws DAException, DAValidateException Starting from the givenBundleAttributesCalculateEventinput, it calculates the scheduling attributes for the currentBundleand creates theBOSkills andBOSkillDivisions.- Specified by:
executein classValidExecutionBusinessTask<BundleAttributesCalculateEvent>- Parameters:
event- theBundleAttributesCalculateEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
resetSchedulingAttributes
Resets the scheduling attributes of the currentBundle.- Parameters:
bundle- the currentBundle
-
loadWorkOrderOperations
protected List<BOWorkOrderOperation> loadWorkOrderOperations(Bundle bundle, PoolKit poolKit) throws DAValidateException, DAException Loads the list of all theBOWorkOrderOperations related to the currentBundle.- Parameters:
bundle- theBundlepoolKit- thePoolKit- Returns:
- a list of
BOWorkOrderOperation - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
calculateSchedulingAttributes
protected void calculateSchedulingAttributes(Bundle bundle, List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) throws DAValidateException, DAException Calculates the scheduling attributes for the currentBundle.- Parameters:
bundle- the currentBundlewoOperations- list ofBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
setOperationsRequirements
protected void setOperationsRequirements(Bundle bundle, List<BOWorkOrderOperation> woOperations, PoolKit poolKit) throws DAException, DAValidateException Sets the aggregated requirements for the bundle based on all its operations. This method loads all requirements from the operations and aggregates them at bundle level.- Parameters:
bundle- theBundlewoOperations- list of the relatedBOWorkOrderOperationpoolKit- thePoolKit- Throws:
DAException- if database access failsDAValidateException- if validation fails
-
getBundleCardinality
Returns theBundlecardinality based on the related list ofBOWorkOrderOperations.- Parameters:
woOperations- list of the relatedBOWorkOrderOperation- Returns:
- the bundle cardinality
-
getWorkOrderOperationAddress
protected BOAddress getWorkOrderOperationAddress(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) Returns theBOAddressrelated to the givenBOWorkOrderOperation.- Parameters:
woOperation- the givenBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the work order operation address
-
getBundleXCoordinate
protected Double getBundleXCoordinate(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) - Parameters:
woOperation- the givenBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the bundle X coordinate
-
getBundleYCoordinate
protected Double getBundleYCoordinate(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) - Parameters:
woOperation- the givenBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the bundle Y coordinate
-
getBundleMicrocluster
protected String getBundleMicrocluster(BOWorkOrderOperation woOperation, BundleEntitiesCache cache, PoolKit poolKit) - Parameters:
woOperation- the givenBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the bundle microcluster
-
getBundleDefaultDuration
protected Long getBundleDefaultDuration(List<BOWorkOrderOperation> woOperations, PoolKit poolKit) throws DAValidateException, DAException Returns theBundledefault duration based on the related list ofBOWorkOrderOperations.- Parameters:
woOperations- list of the relatedBOWorkOrderOperationpoolKit- thePoolKit- Returns:
- the bundle default duration
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getOperationActivities
protected Stream<BOActivity> getOperationActivities(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Loads from theBundleEntitiesCacheeveryBOActivitythat is related to aBOWorkOrderOperationin theBundle.- Parameters:
woOperations- list ofBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the list of
BOActivity
-
isBundleMultiDay
protected Boolean isBundleMultiDay(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundleextends on multiple days or not.- Parameters:
woOperations- list ofBOWorkOrderOperationof theBundlecache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- true if the bundle must be multi day, false otherwise
-
isBundleOnDutyOnly
protected Boolean isBundleOnDutyOnly(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundlerequires only resources that are currently on duty or not.- Parameters:
woOperations- list ofBOWorkOrderOperationof theBundlecache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- true if the bundle must be "on duty only", false otherwise
-
isBundleOnCallExcluded
protected Boolean isBundleOnCallExcluded(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Checks whether any of theBOActivityof the currentBundlehas on call resources and therefore it must be excluded.- Parameters:
woOperations- list of BO work order operation elementscache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- true if the bundle must be "on call excluded", false otherwise
-
getBundleMinTimeForDay
protected Long getBundleMinTimeForDay(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Returns the bundle minimum time for day based on the related list ofBOWorkOrderOperations.- Parameters:
woOperations- list ofBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the bundle minimum time for day
-
getBundleMinTimeForSuspension
protected Long getBundleMinTimeForSuspension(List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) Returns the bundle minimum time for suspension based on the related list ofBOWorkOrderOperations.- Parameters:
woOperations- list ofBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Returns:
- the bundle minimum time for suspension
-
getBundleStartDate
Returns theBundlestart date based on the list of related work order.- Parameters:
workOrders- list of related work orders- Returns:
- the bundle start date
-
getBundleEndDate
Returns theBundleend date based on the list of related work order.- Parameters:
workOrders- list of related work orders- Returns:
- the bundle end date
-
isBundleBooking
protected boolean isBundleBooking(List<BOWorkOrderHeader> workOrders, PoolKit poolKit) throws DAException, DAValidateException Checks whether any of theBOWorkOrderHeaderrelated to the currentBundleis considered as booking.- Parameters:
workOrders- list of relatedBOWorkOrderHeaderspoolKit- thePoolKit- Returns:
- true if is bundle is to be considered booking, false otherwise
- Throws:
DAExceptionDAValidateException
-
getBundleAppointmentStartDate
Returns theBundlemain appointment start date based on the list of related work orders.- Parameters:
workOrders- list of related work orders- Returns:
- the bundle appointment start date
-
getBundleAppointmentEndDate
Returns theBundlemain appointment end date based on the list of related work orders.- Parameters:
workOrders- list of related work orders- Returns:
- the bundle appointment end date
-
checkFinalMaxTeamCardinality
Checks if the calculated maximum team cardinality of theBundleis greater than the minimum one. If it is not, then the maximum is set equal to the minimum.- Parameters:
bundle- the currentBundle
-
createSkillAndSkillDivision
protected void createSkillAndSkillDivision(Bundle bundle, List<BOWorkOrderOperation> woOperations, BundleEntitiesCache cache, PoolKit poolKit) throws DAValidateException, DAException - Parameters:
bundle- theBundlewoOperations- list of the relatedBOWorkOrderOperationcache- theBundleEntitiesCachepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createSkillAndSkillDivisionByConfiguration
protected void createSkillAndSkillDivisionByConfiguration(Bundle bundle, Long skillConfigurationId, BundleEntitiesCache cache, PoolKit poolKit) throws DAValidateException, DAException Starting from theBOSkillConfiguration, it creates all the skills and skill divisions for the currentBundle.- Parameters:
bundle- the currentBundleskillConfigurationId- theBOActivitySkillConfigurationidcache- theBundleEntitiesCachepoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
setBundleCardinalities
Calculates the bundle cardinalities basing on the givenBOSkillConfiguration.- Parameters:
bundle- the currentBundleskillConfiguration- the consideredBOSkillConfiguration
-
createBundleSkill
Creates aBOBundleSkillstarting from the givenBOSkillConfigurationSkill.- Parameters:
bundle- the currentBundleskillConfigurationSkill- the givenBOSkillConfigurationSkill.
-
createBundleSkillDivision
protected void createBundleSkillDivision(Bundle bundle, BOSkillConfigurationDivision skillConfigurationDivision) Creates aBOBundleSkillDivisionstarting from the givenBOSkillConfigurationSkill.- Parameters:
bundle-BundleskillConfigurationDivision- the givenBOSkillConfigurationSkill.
-
createSkillAndSkillDivisionByConfigurationOverride
protected void createSkillAndSkillDivisionByConfigurationOverride(Bundle bundle, Long skillOverrideConfigurationId, PoolKit poolKit) throws DAValidateException, DAException Starting from theBOSkillOverrideConfiguration, it creates all the skills for the currentBundle.- Parameters:
bundle- the currentBundleskillOverrideConfigurationId- theBOSkillOverrideConfigurationidpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getSkillOverrideConfiguration
protected BOSkillOverrideConfiguration getSkillOverrideConfiguration(Long skillOverrideConfigurationId, PoolKit poolKit) throws DAValidateException, DAException Returns theBOSkillOverrideConfigurationwhich corresponds to the given id.- Parameters:
skillOverrideConfigurationId- theBOSkillOverrideConfigurationidpoolKit- thePoolKit- Returns:
- the corresponding
BOSkillOverrideConfiguration - Throws:
DAValidateExceptionDAException
-
setBundleCardinalitiesOverride
protected void setBundleCardinalitiesOverride(Bundle bundle, BOSkillOverrideConfiguration skillOverrideConfiguration) Calculates the bundle cardinalities basing on the givenBOSkillOverrideConfiguration.- Parameters:
bundle- the currentBundleskillOverrideConfiguration- the consideredBOSkillOverrideConfiguration
-
getSkillOverrideConfigurationSkills
protected List<BOSkillOverrideConfigurationSkill> getSkillOverrideConfigurationSkills(Long skillOverrideConfigurationId, PoolKit poolKit) throws DAValidateException, DAException Returns the list ofBOSkillOverrideConfigurationSkillfiltering by the correspondingBOSkillOverrideConfigurationid.- Parameters:
skillOverrideConfigurationId- theBOSkillOverrideConfigurationidpoolKit- thePoolKit- Returns:
- the list of
BOSkillOverrideConfigurationSkill - Throws:
DAValidateExceptionDAException
-
createBundleSkillOverride
protected void createBundleSkillOverride(Bundle bundle, BOSkillOverrideConfigurationSkill skillOverrideConfigurationSkill) Creates aBOBundleSkillstarting from the givenBOSkillOverrideConfigurationSkill.- Parameters:
bundle- the currentBundleskillOverrideConfigurationSkill- the givenBOSkillOverrideConfigurationSkill.
-
setBundleCardinalities
Calculates the bundle cardinalities basing on the given skill cardinalities.- Parameters:
bundle- the currentBundleskillMin- the skill min cardinalityskillMax- the skill max cardinality
-
createBundleSkill
Creates aBOBundleSkillstarting from the given skill and its cardinality.- Parameters:
bundle- the currentBundleskillConfigurationSkill- the givenBOSkillConfigurationSkill.
-