All Implemented Interfaces:
Serializable, Tool, ValidExecution

Business task in order to load a list of 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
  • 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:
      execute in class ValidExecutionBusinessTask<WorkLoadDistributionSearchEvent>
      Parameters:
      event - the event
      poolKit - the pool kit
      Throws:
      DAException - the DA exception
      DAValidateException - 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 distribution
      shiftUnit - the shifting unit
      shiftQuantity - 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 parameters
      workLoadDistributions - the list of BOWorkLoadDistribution to be processed
      poolKit - the PoolKit
      Throws:
      DAValidateException - if data validation fails
      DAException - if a data access error occurs
    • addShift

      protected Date addShift(Date date, WorkLoadDistributionShiftUnit shiftUnit, int shiftQuantity)
      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 shifted
      shiftUnit - 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 new BOWorkLoadDistribution for 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 activity
      timeframe - the timeframe for which to create the distribution
      workLoadDistributionsByActivity - list of existing BOWorkLoadDistribution for the activity
      Returns:
      a new BOWorkLoadDistribution with 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 of BOWorkLoadDistribution objects to be distributed
      targetTimeframes - List of Timeframe objects representing the target time periods
      poolKit - PoolKit object for database operations
      Throws:
      DAValidateException - if data validation fails
      DAException - 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 ActivitySearchFilter using the grouped activity from the input filter, and then uses the PlanningIntegrationService to search for activities.

      Parameters:
      filter - the WorkLoadDistributionSearchFilter containing search criteria
      poolKit - the PoolKit for database operations
      Returns:
      a List of BOActivity objects matching the search criteria
      Throws:
      DAValidateException - if data validation fails
      DAException - 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 - the BOWorkLoadDistribution to check for overlap
      timeframe - the Timeframe to 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 of BOWorkLoadDistribution objects to be converted
      Returns:
      a List of Timeframe objects representing the input WorkLoadDistributions
    • getM2Mapper

      protected M2Mapper getM2Mapper()
    • isValidExecution

      public boolean isValidExecution()
      Description copied from interface: ValidExecution
      Determines whether the current state is valid for execution.
      Returns:
      true if execution is valid, false otherwise