Class BTWorkLoadDistributionSearch
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
BOWorkLoadDistribution.
When the WorkLoadDistributionSearchEvent is launched
the BT notices the call and loads the list of BOWorkLoadDistribution basing on the event's input.
Permission:
- 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 TypeMethodDescriptionprotected DateaddShift(Date date, WorkLoadDistributionShiftUnit shiftUnit, int shiftQuantity) Adds a shift to the given date based on the specified shift unit and quantity.protected voidaddShifts(BOWorkLoadDistribution workLoadDistribution, WorkLoadDistributionShiftUnit shiftUnit, Long shiftQuantity) Add shifts to the work load distribution.protected voidexecute(WorkLoadDistributionSearchEvent event, PoolKit poolKit) Writes the searched work loads into the event journal.protected M2Mapperprotected List<overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe> getSourceTimeframes(List<BOWorkLoadDistribution> workLoadDistributions) Converts a list of WorkLoadDistribution objects to a list of Timeframe objects.protected voidgetTimeframes(List<BOWorkLoadDistribution> workLoadDistributionsByActivity, List<overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe> targetTimeframes, PoolKit poolKit) Distributes workload across target timeframes for a given set of work load distributions.protected BOWorkLoadDistributiongetWorkLoadDistribution(String activityCode, overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe timeframe, List<BOWorkLoadDistribution> workLoadDistributionsByActivity) Creates a newBOWorkLoadDistributionfor a given activity and timeframe.protected voidgroupedActivity(WorkLoadDistributionSearchFilter filter, List<BOWorkLoadDistribution> workLoadDistributions, PoolKit poolKit) Groups and processes work load distributions by activity.protected booleanisOverlapping(BOWorkLoadDistribution distribution, overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe timeframe) Checks if a given work load distribution overlaps with a specified timeframe.booleanDetermines whether the current state is valid for execution.protected List<BOActivity> searchActivities(WorkLoadDistributionSearchFilter filter, PoolKit poolKit) Searches for activities based on the provided filter.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
-
Constructor Details
-
BTWorkLoadDistributionSearch
public BTWorkLoadDistributionSearch()
-
-
Method Details
-
execute
protected void execute(WorkLoadDistributionSearchEvent event, PoolKit poolKit) throws DAException, DAValidateException Writes the searched work loads into the event journal.- Specified by:
executein classValidExecutionBusinessTask<WorkLoadDistributionSearchEvent>- Parameters:
event- the eventpoolKit- the pool kit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
addShifts
protected void addShifts(BOWorkLoadDistribution workLoadDistribution, WorkLoadDistributionShiftUnit shiftUnit, Long shiftQuantity) Add shifts to the work load distribution.It is possible to shift the start and end date of the work load distribution.
The shifting is done by adding the given shift quantity to the start and end date.
+ The shifting unit is given by the given shift unit.
The shifting unit can be one of the following:
- Parameters:
workLoadDistribution- the work load distributionshiftUnit- the shifting unitshiftQuantity- the shifting quantity
-
groupedActivity
protected void groupedActivity(WorkLoadDistributionSearchFilter filter, List<BOWorkLoadDistribution> workLoadDistributions, PoolKit poolKit) throws DAValidateException, DAException Groups and processes work load distributions by activity.This method performs the following operations:
- Groups work load distributions based on the specified grouping type
- Searches for activities based on the filter
- Generates timeframes for each activity
- Filters and processes work load distributions for each activity and timeframe
- Updates the main work load distributions list with the processed results
- Sorts the final list by activity code
- Parameters:
filter- the search filter containing grouping criteria and other parametersworkLoadDistributions- the list ofBOWorkLoadDistributionto be processedpoolKit- thePoolKit- Throws:
DAValidateException- if data validation failsDAException- if a data access error occurs
-
addShift
Adds a shift to the given date based on the specified shift unit and quantity.This method shifts the input date by the specified amount of time. The shift can be in days, weeks, or months.
- Parameters:
date- The original date to be shiftedshiftUnit- The unit of time for the shift (DAYS, WEEKS, or MONTHS)shiftQuantity- The number of units to shift the date by- Returns:
- The new date after applying the shift
-
getWorkLoadDistribution
protected BOWorkLoadDistribution getWorkLoadDistribution(String activityCode, overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe timeframe, List<BOWorkLoadDistribution> workLoadDistributionsByActivity) Creates a newBOWorkLoadDistributionfor a given activity and timeframe.This method performs the following operations:
- Creates a new BOWorkLoadDistribution object
- Sets the start and end dates based on the given timeframe
- Sets the activity code and duration
- Calculates the total number of tasks from overlapping distributions
- Parameters:
activityCode- the code of the activitytimeframe- the timeframe for which to create the distributionworkLoadDistributionsByActivity- list of existingBOWorkLoadDistributionfor the activity- Returns:
- a new
BOWorkLoadDistributionwith calculated values
-
getTimeframes
protected void getTimeframes(List<BOWorkLoadDistribution> workLoadDistributionsByActivity, List<overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe> targetTimeframes, PoolKit poolKit) throws DAValidateException, DAException Distributes workload across target timeframes for a given set of work load distributions.- Parameters:
workLoadDistributionsByActivity- List ofBOWorkLoadDistributionobjects to be distributedtargetTimeframes- List ofTimeframeobjects representing the target time periodspoolKit-PoolKitobject for database operations- Throws:
DAValidateException- if data validation failsDAException- if a data access error occurs
-
searchActivities
protected List<BOActivity> searchActivities(WorkLoadDistributionSearchFilter filter, PoolKit poolKit) throws DAValidateException, DAException Searches for activities based on the provided filter.This method creates an
ActivitySearchFilterusing the grouped activity from the input filter, and then uses the PlanningIntegrationService to search for activities.- Parameters:
filter- theWorkLoadDistributionSearchFiltercontaining search criteriapoolKit- thePoolKitfor database operations- Returns:
- a List of
BOActivityobjects matching the search criteria - Throws:
DAValidateException- if data validation failsDAException- if a data access error occurs
-
isOverlapping
protected boolean isOverlapping(BOWorkLoadDistribution distribution, overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe timeframe) Checks if a given work load distribution overlaps with a specified timeframe.- Parameters:
distribution- theBOWorkLoadDistributionto check for overlaptimeframe- theTimeframeto check against- Returns:
- true if there is an overlap, false otherwise
-
getSourceTimeframes
protected List<overit.geocall.wfm.planning.bl.workloaddistribution.Timeframe> getSourceTimeframes(List<BOWorkLoadDistribution> workLoadDistributions) Converts a list of WorkLoadDistribution objects to a list of Timeframe objects.- Parameters:
workLoadDistributions- a List ofBOWorkLoadDistributionobjects to be converted- Returns:
- a List of
Timeframeobjects representing the input WorkLoadDistributions
-
getM2Mapper
-
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
-