public class ProjectCalendar extends ProjectCalendarDays implements ProjectEntityWithMutableUniqueID, TimeUnitDefaultsContainer
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_BASE_CALENDAR_NAME
Default base calendar name to use when none is supplied.
|
DEFAULT_WORKING_AFTERNOON, DEFAULT_WORKING_MORNING
Modifier | Constructor and Description |
---|---|
|
ProjectCalendar(ProjectFile file)
Default constructor.
|
protected |
ProjectCalendar(ProjectFile file,
boolean temporaryCalendar)
Internal constructor to allow the temporary calendar flag to be set.
|
Modifier and Type | Method and Description |
---|---|
ProjectCalendarException |
addCalendarException(LocalDate date)
Add an exception to the calendar.
|
ProjectCalendarException |
addCalendarException(LocalDate fromDate,
LocalDate toDate)
Add an exception to the calendar.
|
ProjectCalendarException |
addCalendarException(RecurringData recurringData)
Add a recurring exception to the calendar.
|
ProjectCalendarHours |
addCalendarHours(DayOfWeek day)
Used to add working hours to the calendar.
|
ProjectCalendarWeek |
addWorkWeek()
Add an empty work week.
|
void |
clearCalendarExceptions()
Clears the list of calendar exceptions.
|
void |
clearWorkWeeks()
Clears the list of calendar exceptions.
|
List<ProjectCalendarException> |
getCalendarExceptions()
This method retrieves a list of exceptions to the current calendar.
|
Integer |
getCalendarMinutesPerDay()
Retrieve the number of minutes per day for this calendar.
|
Integer |
getCalendarMinutesPerMonth()
Retrieve the number of minutes per month for this calendar.
|
Integer |
getCalendarMinutesPerWeek()
Retrieve the number of minutes per week for this calendar.
|
Integer |
getCalendarMinutesPerYear()
Retrieve the number of minutes per year for this calendar.
|
LocalDateTime |
getDate(LocalDateTime date,
Duration duration)
Given a date and a duration, this method calculates the resulting date when the duration is added.
|
Integer |
getDaysPerMonth()
Retrieve the effective number of days per month for this calendar.
|
DayType |
getDayType(DayOfWeek day)
Retrieve the day type.
|
List<ProjectCalendar> |
getDerivedCalendars()
Retrieve a list of derived calendars.
|
Duration |
getDuration(LocalDateTime startDate,
LocalDateTime endDate)
This method is provided to allow an absolute period of time
represented by start and end dates into a duration in working
days based on this calendar instance.
|
ProjectCalendarException |
getException(LocalDate date)
Retrieve a calendar exception which applies to this date.
|
List<ProjectCalendarException> |
getExpandedCalendarExceptions()
This method retrieves a list of exceptions to the current calendar.
|
List<ProjectCalendarException> |
getExpandedCalendarExceptionsWithWorkWeeks()
Expand any exceptions in the calendar, and include any working weeks
defined by this calendar as exceptions.
|
LocalTime |
getFinishTime(LocalDate date)
Retrieves the time at which work finishes on the given date, or returns
null if this is a non-working day.
|
UUID |
getGUID()
Retrieve the calendar's GUID.
|
ProjectCalendarHours |
getHours(DayOfWeek day)
This method retrieves the calendar hours for the specified day.
|
ProjectCalendarHours |
getHours(LocalDate date)
This method retrieves the calendar hours for the specified date.
|
ProjectCalendarHours |
getHours(LocalDateTime date)
This method retrieves the calendar hours for the specified date.
|
Integer |
getMinutesPerDay()
Retrieve the effective number of minutes per day for this calendar.
|
Integer |
getMinutesPerMonth()
Retrieve the effective number of minutes per month for this calendar.
|
Integer |
getMinutesPerWeek()
Retrieve the effective number of minutes per week for this calendar.
|
Integer |
getMinutesPerYear()
Retrieve the effective number of minutes per year for this calendar.
|
LocalDateTime |
getNextWorkStart(LocalDateTime date)
Utility method to retrieve the next working date start time, given
a date and time as a starting point.
|
ProjectCalendar |
getParent()
Retrieve the parent calendar, or
null if the
calendar does not have a parent. |
ProjectFile |
getParentFile()
Accessor method allowing retrieval of ProjectFile reference.
|
Integer |
getParentUniqueID()
Retrieve the parent calendar unique ID.
|
boolean |
getPersonal()
Returns true if this is a personal calendar.
|
LocalDateTime |
getPreviousWorkFinish(LocalDateTime date)
Utility method to retrieve the previous working date finish time, given
a date and time as a starting point.
|
protected ProjectCalendarHours |
getRanges(DayOfWeek day)
Retrieves the working hours on the given day of the week.
|
protected ProjectCalendarHours |
getRanges(LocalDate date)
Retrieves the working hours on the given date.
|
int |
getResourceCount()
Retrieve the number of resources using this calendar.
|
List<Resource> |
getResources()
Retrieve a list of the resources which use this calendar.
|
LocalTime |
getStartTime(LocalDate date)
Retrieves the time at which work starts on the given date, or returns
null if this is a non-working day.
|
List<Task> |
getTasks()
Retrieve a list of tasks which use this calendar.
|
CalendarType |
getType()
Retrieve the calendar type.
|
Integer |
getUniqueID()
Accessor method to retrieve the unique ID of this calendar.
|
Duration |
getWork(DayOfWeek day,
TimeUnit format)
Retrieves the amount of work on a given day, and
returns it in the specified format.
|
Duration |
getWork(LocalDateTime startDate,
LocalDateTime endDate,
TimeUnit format)
This method retrieves a Duration instance representing the amount of
work between two dates based on this calendar.
|
Duration |
getWork(LocalDate date,
TimeUnit format)
Retrieves the amount of work on a given date, and
returns it in the specified format.
|
ProjectCalendarWeek |
getWorkWeek(LocalDate date)
Retrieve a work week which applies to this date.
|
List<ProjectCalendarWeek> |
getWorkWeeks()
Retrieve the work weeks associated with this calendar.
|
boolean |
isDerived()
Determine if this calendar is derived from another.
|
boolean |
isWorkingDate(LocalDate date)
This method allows the caller to determine if a given date is a
working day.
|
boolean |
isWorkingDay(DayOfWeek day)
Method indicating whether a day is a working or non-working day.
|
void |
remove()
Removes this calendar from the project.
|
void |
removeCalendarException(ProjectCalendarException exception)
Remove an exception from the calendar.
|
void |
removeCalendarHours(DayOfWeek day)
Used to remove working hours from the calendar.
|
void |
removeWorkWeek(ProjectCalendarWeek week)
Remove a work week from the calendar.
|
void |
setCalendarMinutesPerDay(Integer minutes)
Set the number of minutes per day for this calendar.
|
void |
setCalendarMinutesPerMonth(Integer minutes)
Set the number of minutes per month for this calendar.
|
void |
setCalendarMinutesPerWeek(Integer minutes)
Set the number of minutes per week for this calendar.
|
void |
setCalendarMinutesPerYear(Integer minutes)
Set the number of minutes per year for this calendar.
|
void |
setGUID(UUID value)
Set the calendar's GUID.
|
void |
setParent(ProjectCalendar calendar)
Sets the ProjectCalendar instance from which this calendar is derived.
|
void |
setPersonal(boolean personal)
Set the flag to indicate if this is personal calendar.
|
void |
setType(CalendarType type)
Set the calendar type.
|
void |
setUniqueID(Integer uniqueID)
Modifier method to set the unique ID of this calendar.
|
String |
toString() |
addDefaultCalendarDays, addDefaultCalendarHours, addDefaultCalendarHours, getCalendarDayType, getCalendarDayTypes, getCalendarHours, getCalendarHours, getName, setCalendarDayType, setName, setWorkingDay
public static final String DEFAULT_BASE_CALENDAR_NAME
public ProjectCalendar(ProjectFile file)
file
- the parent file to which this record belongs.protected ProjectCalendar(ProjectFile file, boolean temporaryCalendar)
file
- the parent file to which this record belongs.temporaryCalendar
- true if this is a temporary calendarpublic Integer getMinutesPerDay()
getMinutesPerDay
in interface TimeUnitDefaultsContainer
public Integer getMinutesPerWeek()
getMinutesPerWeek
in interface TimeUnitDefaultsContainer
public Integer getMinutesPerMonth()
getMinutesPerMonth
in interface TimeUnitDefaultsContainer
public Integer getMinutesPerYear()
getMinutesPerYear
in interface TimeUnitDefaultsContainer
public Integer getDaysPerMonth()
getDaysPerMonth
in interface TimeUnitDefaultsContainer
public void setCalendarMinutesPerDay(Integer minutes)
minutes
- number of minutespublic Integer getCalendarMinutesPerDay()
public void setCalendarMinutesPerWeek(Integer minutes)
minutes
- number of minutespublic Integer getCalendarMinutesPerWeek()
public void setCalendarMinutesPerMonth(Integer minutes)
minutes
- number of minutespublic Integer getCalendarMinutesPerMonth()
public void setCalendarMinutesPerYear(Integer minutes)
minutes
- number of minutespublic Integer getCalendarMinutesPerYear()
public ProjectCalendarWeek addWorkWeek()
public void removeWorkWeek(ProjectCalendarWeek week)
week
- week to removepublic void clearWorkWeeks()
public List<ProjectCalendarWeek> getWorkWeeks()
public ProjectCalendarException addCalendarException(LocalDate date)
date
- exception datepublic ProjectCalendarException addCalendarException(LocalDate fromDate, LocalDate toDate)
fromDate
- exception start datetoDate
- exception end datepublic ProjectCalendarException addCalendarException(RecurringData recurringData)
recurringData
- RecurringData instance used to define the exception occurrencespublic void removeCalendarException(ProjectCalendarException exception)
exception
- exception to removepublic void clearCalendarExceptions()
public List<ProjectCalendarException> getCalendarExceptions()
public List<ProjectCalendarException> getExpandedCalendarExceptions()
public List<ProjectCalendarException> getExpandedCalendarExceptionsWithWorkWeeks()
public ProjectCalendarHours addCalendarHours(DayOfWeek day)
addCalendarHours
in class ProjectCalendarDays
day
- day numberpublic void removeCalendarHours(DayOfWeek day)
removeCalendarHours
in class ProjectCalendarDays
day
- target daypublic void setParent(ProjectCalendar calendar)
calendar
- base calendar instancepublic ProjectCalendar getParent()
null
if the
calendar does not have a parent.public Integer getParentUniqueID()
public Duration getDuration(LocalDateTime startDate, LocalDateTime endDate)
startDate
- start of the periodendDate
- end of the periodpublic LocalTime getStartTime(LocalDate date)
date
- Date instancepublic LocalTime getFinishTime(LocalDate date)
date
- Date instancepublic LocalDateTime getDate(LocalDateTime date, Duration duration)
date
- dateduration
- durationpublic LocalDateTime getNextWorkStart(LocalDateTime date)
date
- date and time start pointpublic LocalDateTime getPreviousWorkFinish(LocalDateTime date)
date
- date and time start pointpublic DayType getDayType(DayOfWeek day)
day
- required daypublic boolean isWorkingDay(DayOfWeek day)
day
- required daypublic boolean isWorkingDate(LocalDate date)
date
- Date to be testedpublic ProjectCalendarHours getHours(DayOfWeek day)
day
- Day instancepublic ProjectCalendarHours getHours(LocalDate date)
date
- target datepublic ProjectCalendarHours getHours(LocalDateTime date)
date
- target datepublic void setUniqueID(Integer uniqueID)
setUniqueID
in interface ProjectEntityWithMutableUniqueID
uniqueID
- unique identifierpublic Integer getUniqueID()
getUniqueID
in interface ProjectEntityWithUniqueID
public UUID getGUID()
public void setGUID(UUID value)
value
- calendar GUIDpublic List<Task> getTasks()
public List<Resource> getResources()
public int getResourceCount()
public void remove()
public ProjectCalendarException getException(LocalDate date)
date
- target datepublic ProjectCalendarWeek getWorkWeek(LocalDate date)
date
- target datepublic Duration getWork(DayOfWeek day, TimeUnit format)
day
- target dayformat
- required formatpublic Duration getWork(LocalDate date, TimeUnit format)
date
- target dateformat
- required formatpublic Duration getWork(LocalDateTime startDate, LocalDateTime endDate, TimeUnit format)
startDate
- start dateendDate
- end dateformat
- required duration formatpublic List<ProjectCalendar> getDerivedCalendars()
protected ProjectCalendarHours getRanges(LocalDate date)
date
- required dateprotected ProjectCalendarHours getRanges(DayOfWeek day)
day
- required daypublic final ProjectFile getParentFile()
public boolean isDerived()
public CalendarType getType()
public void setType(CalendarType type)
null
type
- calendar typepublic boolean getPersonal()
public void setPersonal(boolean personal)
personal
- true if this is a personal calendarCopyright © 2000–2024 Packwood Software. All rights reserved.