Class BusinessCalendarImpl

java.lang.Object
io.jmix.businesscalendar.model.BusinessCalendarImpl
All Implemented Interfaces:
BusinessCalendar

public class BusinessCalendarImpl extends Object implements BusinessCalendar
  • Constructor Details

    • BusinessCalendarImpl

      public BusinessCalendarImpl(String name, String code, String source)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: BusinessCalendar
      Returns human-readable name of given business calendar.
      Specified by:
      getName in interface BusinessCalendar
      Returns:
      calendar's name
    • getCode

      public String getCode()
      Description copied from interface: BusinessCalendar
      Returns code of given business calendar which should be unique among all registered calendars.
      Specified by:
      getCode in interface BusinessCalendar
      Returns:
      calendar's unique identifier
    • getSource

      public String getSource()
      Description copied from interface: BusinessCalendar
      Returns source from which given calendar come from. Possible variants are annotatedClass and database.
      Specified by:
      getSource in interface BusinessCalendar
      Returns:
      calendar's source
      See Also:
    • getCustomProperties

      public Map<String,String> getCustomProperties()
    • getHolidays

      public Set<Holiday> getHolidays()
    • getScheduledBusinessDays

      public org.springframework.util.MultiValueMap<DayOfWeek,BusinessDay> getScheduledBusinessDays()
    • getAdditionalBusinessDays

      public Map<LocalDate,BusinessDay> getAdditionalBusinessDays()
    • addHoliday

      public boolean addHoliday(Holiday holiday)
    • addBusinessDay

      public BusinessDay addBusinessDay(LocalDate localDate, BusinessDay businessDay)
    • addBusinessDay

      public void addBusinessDay(DayOfWeek dayOfWeek, BusinessDay businessDay)
    • setHolidays

      public void setHolidays(Collection<Holiday> holidays)
    • setScheduledBusinessDays

      public void setScheduledBusinessDays(org.springframework.util.MultiValueMap<DayOfWeek,BusinessDay> scheduledBusinessDays)
    • setAdditionalBusinessDays

      public void setAdditionalBusinessDays(Map<LocalDate,BusinessDay> additionalBusinessDays)
    • isBusinessDay

      public boolean isBusinessDay(LocalDate date)
      Description copied from interface: BusinessCalendar
      Checks if provided date belongs to business days.
      Specified by:
      isBusinessDay in interface BusinessCalendar
      Parameters:
      date - date to be checked.
      Returns:
      true if this date is business day.
    • isBusinessTime

      public boolean isBusinessTime(LocalDateTime dateTime)
      Description copied from interface: BusinessCalendar
      Checks if provided date-time belongs to business time.
      Specified by:
      isBusinessTime in interface BusinessCalendar
      Parameters:
      dateTime - source date-time.
      Returns:
      true if provided date-time is business time.
    • plus

      public LocalDate plus(LocalDate date, int daysToAdd)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date with the specified amount of business days added.
      Specified by:
      plus in interface BusinessCalendar
      Parameters:
      date - source date.
      daysToAdd - count of business days to add.
      Returns:
      a LocalDate based on provided with the specified amount of provided business days added.
    • minus

      public LocalDate minus(LocalDate date, int daysToSubtract)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date with the specified amount of business days subtracted.
      Specified by:
      minus in interface BusinessCalendar
      Parameters:
      date - source date.
      daysToSubtract - count of business days to subtract.
      Returns:
      a LocalDate based on provided with the specified amount of provided business days subtracted.
    • plus

      public LocalDateTime plus(LocalDateTime dateTime, int hoursToAdd)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date-time with the specified amount of business hours added.
      Specified by:
      plus in interface BusinessCalendar
      Parameters:
      dateTime - source date-time.
      hoursToAdd - count of working hours to added.
      Returns:
      a LocalDateTime based on provided date-time with the addition of provided working hours made.
    • minus

      public LocalDateTime minus(LocalDateTime dateTime, int hoursToSubtract)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date-time with the specified amount of business hours subtracted.
      Specified by:
      minus in interface BusinessCalendar
      Parameters:
      dateTime - source date-time.
      hoursToSubtract - count of working hours to subtract.
      Returns:
      a LocalDateTime based on provided date-time with the extraction of provided working hours made.
    • plus

      public LocalDateTime plus(LocalDateTime dateTime, Duration duration)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date-time with the specified duration in terms of working time added.

      Extra caution is needed when duration is obtained using the number of days. In this case the resulting date-time will be calculated by adding 24*days business hours that might be not desired behavior.

      Specified by:
      plus in interface BusinessCalendar
      Parameters:
      dateTime - source date-time.
      duration - duration in terms of working time to be added.
      Returns:
      a LocalDateTime based on provided date-time with the addition of provided duration made.
    • minus

      public LocalDateTime minus(LocalDateTime dateTime, Duration duration)
      Description copied from interface: BusinessCalendar
      Returns a copy of provided date-time with the specified duration in terms of working time subtracted.

      Extra caution is needed when duration is obtained using the number of days. In this case the resulting date-time will be calculated by subtracting 24*days business hours that might be not desired behavior.

      Specified by:
      minus in interface BusinessCalendar
      Parameters:
      dateTime - source date-time.
      duration - duration in terms of working time to be subtracted.
      Returns:
      a LocalDateTime based on provided date-time with the extraction of provided duration made.