Package io.jmix.businesscalendar.model
Class BusinessCalendarImpl
java.lang.Object
io.jmix.businesscalendar.model.BusinessCalendarImpl
- All Implemented Interfaces:
BusinessCalendar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBusinessDay(DayOfWeek dayOfWeek, BusinessDay businessDay) addBusinessDay(LocalDate localDate, BusinessDay businessDay) booleanaddHoliday(Holiday holiday) getBusinessIntervalEndAfter(LocalDateTime dateTime) Returns a date-time of the next end of business interval relative to provided date-time: If initial date-time is within interval - returns end-time of this interval If initial date-time is outside of interval or points exact at its end-time - returns end-time of next intervalgetBusinessIntervalEndBefore(LocalDateTime dateTime) Returns a date-time of the previous end of business interval relative to provided date-time: Always returns end-time of previous interval.getBusinessIntervalStartAfter(LocalDateTime dateTime) Returns a date-time of the next start of business interval relative to provided date-time: Always returns start-time of next interval.getBusinessIntervalStartBefore(LocalDateTime dateTime) Returns a date-time of the previous start of business interval relative to provided date-time: If initial date-time is within interval - returns start-time of this interval If initial date-time is outside of interval or points exact at its start-time - returns start-time of previous intervalgetCode()Returns code of given business calendar which should be unique among all registered calendars.getDayInfo(LocalDate date) Provides info about day related to specific date.getDayInfo(LocalDateTime dateTime) Provides info about day related to specific date-time.getName()Returns human-readable name of given business calendar.org.springframework.util.MultiValueMap<DayOfWeek,BusinessDay> Returns source from which given calendar come from.booleanisBusinessDay(LocalDate date) Checks if provided date belongs to business days.booleanisBusinessTime(LocalDateTime dateTime) Checks if provided date-time belongs to business time.Returns a copy of provided date with the specified amount of business days subtracted.minus(LocalDateTime dateTime, int hoursToSubtract) Returns a copy of provided date-time with the specified amount of business hours subtracted.minus(LocalDateTime dateTime, Duration duration) Returns a copy of provided date-time with the specified duration in terms of working time subtracted.Returns a copy of provided date with the specified amount of business days added.plus(LocalDateTime dateTime, int hoursToAdd) Returns a copy of provided date-time with the specified amount of business hours added.plus(LocalDateTime dateTime, Duration duration) Returns a copy of provided date-time with the specified duration in terms of working time added.voidsetAdditionalBusinessDays(Map<LocalDate, BusinessDay> additionalBusinessDays) voidsetHolidays(Collection<Holiday> holidays) voidsetScheduledBusinessDays(org.springframework.util.MultiValueMap<DayOfWeek, BusinessDay> scheduledBusinessDays)
-
Constructor Details
-
BusinessCalendarImpl
-
-
Method Details
-
getName
Description copied from interface:BusinessCalendarReturns human-readable name of given business calendar.- Specified by:
getNamein interfaceBusinessCalendar- Returns:
- calendar's name
-
getCode
Description copied from interface:BusinessCalendarReturns code of given business calendar which should be unique among all registered calendars.- Specified by:
getCodein interfaceBusinessCalendar- Returns:
- calendar's unique identifier
-
getSource
Description copied from interface:BusinessCalendarReturns source from which given calendar come from. Possible variants areannotatedClassanddatabase.- Specified by:
getSourcein interfaceBusinessCalendar- Returns:
- calendar's source
- See Also:
-
getCustomProperties
-
getHolidays
-
getScheduledBusinessDays
-
getAdditionalBusinessDays
-
addHoliday
-
addBusinessDay
-
addBusinessDay
-
setHolidays
-
setScheduledBusinessDays
public void setScheduledBusinessDays(org.springframework.util.MultiValueMap<DayOfWeek, BusinessDay> scheduledBusinessDays) -
setAdditionalBusinessDays
-
isBusinessDay
Description copied from interface:BusinessCalendarChecks if provided date belongs to business days.- Specified by:
isBusinessDayin interfaceBusinessCalendar- Parameters:
date- date to be checked.- Returns:
- true if this date is business day.
-
getDayInfo
Description copied from interface:BusinessCalendarProvides info about day related to specific date. It contains info whether it is a business day and optional mark.- Specified by:
getDayInfoin interfaceBusinessCalendar- Parameters:
date- date to be checked- Returns:
- object with information about day related to provided date
-
isBusinessTime
Description copied from interface:BusinessCalendarChecks if provided date-time belongs to business time.- Specified by:
isBusinessTimein interfaceBusinessCalendar- Parameters:
dateTime- source date-time.- Returns:
- true if provided date-time is business time.
-
getDayInfo
Description copied from interface:BusinessCalendarProvides info about day related to specific date-time. It contains info whether it belongs to business time and optional mark.- Specified by:
getDayInfoin interfaceBusinessCalendar- Parameters:
dateTime- date-time to be checked- Returns:
- object with information about day related to provided date-time
-
plus
Description copied from interface:BusinessCalendarReturns a copy of provided date with the specified amount of business days added.- Specified by:
plusin interfaceBusinessCalendar- 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
Description copied from interface:BusinessCalendarReturns a copy of provided date with the specified amount of business days subtracted.- Specified by:
minusin interfaceBusinessCalendar- 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
Description copied from interface:BusinessCalendarReturns a copy of provided date-time with the specified amount of business hours added.- Specified by:
plusin interfaceBusinessCalendar- 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
Description copied from interface:BusinessCalendarReturns a copy of provided date-time with the specified amount of business hours subtracted.- Specified by:
minusin interfaceBusinessCalendar- 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
Description copied from interface:BusinessCalendarReturns a copy of provided date-time with the specified duration in terms of working time added.Extra caution is needed when
durationis 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:
plusin interfaceBusinessCalendar- 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
Description copied from interface:BusinessCalendarReturns a copy of provided date-time with the specified duration in terms of working time subtracted.Extra caution is needed when
durationis 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:
minusin interfaceBusinessCalendar- 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.
-
getBusinessIntervalStartAfter
Description copied from interface:BusinessCalendarReturns a date-time of the next start of business interval relative to provided date-time: Always returns start-time of next interval.- Specified by:
getBusinessIntervalStartAfterin interfaceBusinessCalendar- Parameters:
dateTime- initial date-time.- Returns:
- LocalDateTime with start-time of next interval.
-
getBusinessIntervalStartBefore
Description copied from interface:BusinessCalendarReturns a date-time of the previous start of business interval relative to provided date-time:- If initial date-time is within interval - returns start-time of this interval
- If initial date-time is outside of interval or points exact at its start-time - returns start-time of previous interval
- Specified by:
getBusinessIntervalStartBeforein interfaceBusinessCalendar- Parameters:
dateTime- initial date-time.- Returns:
- LocalDateTime with previous start-time.
-
getBusinessIntervalEndAfter
Description copied from interface:BusinessCalendarReturns a date-time of the next end of business interval relative to provided date-time:- If initial date-time is within interval - returns end-time of this interval
- If initial date-time is outside of interval or points exact at its end-time - returns end-time of next interval
- Specified by:
getBusinessIntervalEndAfterin interfaceBusinessCalendar- Parameters:
dateTime- initial date-time.- Returns:
- LocalDateTime with next end-time.
-
getBusinessIntervalEndBefore
Description copied from interface:BusinessCalendarReturns a date-time of the previous end of business interval relative to provided date-time: Always returns end-time of previous interval.- Specified by:
getBusinessIntervalEndBeforein interfaceBusinessCalendar- Parameters:
dateTime- initial date-time.- Returns:
- LocalDateTime with end-time of previous interval.
-