Class CalendarWeeklyBucketService


public class CalendarWeeklyBucketService extends CalendarBucketService
The CalendarWeeklyBucketService is the implementation of CalendarBucketService using a calendar week duration as a time unit. Starting from starDate param, it generates a bucket that begins at the first day of the week (that is greater or equal then the startDate) and is large a number of calendar weeks specified in the timeSize property (mind that, the end of the bucket must be less or equal than the endDate param). At the end the total number of buckets created is totalBuckets = calendarWeeksBetweenParamDates / timeSize Example: startDate = 15/01/2024 endDate = 07/06/2024 calendarWeeksBetweenParamDates = 20 timeSize = 2 totalBuckets = 20 / 2 = 10 buckets (bucket1 from 15/01/2024 to 21/01/2024) (bucket2 from 22/01/2024 to 28/01/2024) ... (bucket10 from 27/05/2024 to 02/06/2024)
Since:
19.0
  • Constructor Details

    • CalendarWeeklyBucketService

      protected CalendarWeeklyBucketService(Long roughPlanning, TimeUnit timeUnit, Long timeSize)
  • Method Details

    • canBucketBeCreated

      protected boolean canBucketBeCreated(Date startBucketDate, Date endDate)
      Description copied from class: CalendarBucketService
      It establishes whether a bucket can be created
      Specified by:
      canBucketBeCreated in class CalendarBucketService
      Parameters:
      startBucketDate - starting bucket date
      endDate - upper limit end date to establish that a bucket can be created
      Returns:
      a boolean
    • getEndBucketDate

      protected Date getEndBucketDate(Date startBucketDate)
      Description copied from class: CalendarBucketService
      Returns an end date for the bucket creation
      Specified by:
      getEndBucketDate in class CalendarBucketService
      Parameters:
      startBucketDate - starting bucket date
      Returns:
      a date
    • getInitialStartBucketDate

      protected Date getInitialStartBucketDate(Date startDate)
      Description copied from class: CalendarBucketService
      Returns an initial date for the bucket creation
      Specified by:
      getInitialStartBucketDate in class CalendarBucketService
      Parameters:
      startDate - the lower limit for buckets creation
      Returns:
      a date