|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mpxj.ProjectCalendarWeek
net.sf.mpxj.ProjectCalendar
public final class ProjectCalendar
This class represents the a Calendar Definition record. Both base calendars and calendars derived from base calendars are represented by instances of this class. The class is used to define the working and non-working days of the week. The default calendar defines Monday to Friday as working days.
| Field Summary | |
|---|---|
static String |
DEFAULT_BASE_CALENDAR_NAME
Default base calendar name to use when none is supplied. |
| Fields inherited from class net.sf.mpxj.ProjectCalendarWeek |
|---|
DEFAULT_WORKING_AFTERNOON, DEFAULT_WORKING_MORNING |
| Constructor Summary | |
|---|---|
ProjectCalendar(ProjectFile file)
Default constructor. |
|
ProjectCalendar(ProjectFile file,
ProjectCalendar taskCalendar,
ProjectCalendar resourceCalendar)
Create a calendar based on the intersection of a task calendar and a resource calendar. |
|
| Method Summary | |
|---|---|
ProjectCalendarException |
addCalendarException(Date fromDate,
Date toDate)
Used to add exceptions to the calendar. |
ProjectCalendarHours |
addCalendarHours(Day day)
Used to add working hours to the calendar. |
protected void |
addDerivedCalendar(ProjectCalendar calendar)
Add a reference to a calendar derived from this one. |
ProjectCalendarWeek |
addWorkWeek()
Add an empty work week. |
void |
attachHoursToDay(ProjectCalendarHours hours)
Attaches a pre-existing set of hours to the correct day within the calendar. |
void |
copy(ProjectCalendar cal)
Copy the settings from another calendar to this calendar. |
List<ProjectCalendarException> |
getCalendarExceptions()
This method retrieves a list of exceptions to the current calendar. |
Date |
getDate(Date startDate,
Duration duration,
boolean returnNextWorkStart)
Given a start date and a duration, this method calculates the end date. |
List<ProjectCalendar> |
getDerivedCalendars()
Retrieve a list of derived calendars. |
Duration |
getDuration(Date startDate,
Date 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(Date date)
Retrieve a calendar calendar exception which applies to this date. |
Date |
getFinishTime(Date date)
Retrieves the time at which work finishes on the given date, or returns null if this is a non-working day. |
Date |
getNextWorkStart(Date date)
Utility method to retrieve the next working date start time, given a date and time as a starting point. |
ProjectCalendar |
getParent()
If this week is derived from a another week, this method will return the parent week. |
ProjectFile |
getParentFile()
Accessor method allowing retrieval of ProjectFile reference. |
Date |
getPreviousWorkFinish(Date date)
Utility method to retrieve the previous working date finish time, given a date and time as a starting point. |
Resource |
getResource()
Retrieve the resource to which this calendar is linked. |
Date |
getStartDate(Date finishDate,
Duration duration)
Given a finish date and a duration, this method calculates backwards to the start date. |
Date |
getStartTime(Date date)
Retrieves the time at which work starts on the given date, or returns null if this is a non-working day. |
Integer |
getUniqueID()
Accessor method to retrieve the unique ID of this calendar. |
Duration |
getWork(Date startDate,
Date endDate,
TimeUnit format)
This method retrieves a Duration instance representing the amount of work between two dates based on this calendar. |
Duration |
getWork(Date date,
TimeUnit format)
Retrieves the amount of work on a given day, and returns it in the specified format. |
List<ProjectCalendarWeek> |
getWorkWeeks()
Retrieve the work weeks associated with this calendar. |
boolean |
isWorkingDate(Date date)
This method allows the caller to determine if a given date is a working day. |
boolean |
isWorkingDay(Day day)
Method indicating whether a day is a working or non-working day. |
void |
remove()
Removes this calendar from the project. |
protected void |
removeDerivedCalendar(ProjectCalendar calendar)
Remove a reference to a derived calendar. |
void |
removeHoursFromDay(ProjectCalendarHours hours)
Removes a set of calendar hours from the day to which they are currently attached. |
void |
setParent(ProjectCalendar calendar)
Sets the ProjectCalendar instance from which this calendar is derived. |
void |
setResource(Resource resource)
Sets the resource to which this calendar is linked. |
void |
setUniqueID(Integer uniqueID)
Modifier method to set the unique ID of this calendar. |
String |
toString()
|
| Methods inherited from class net.sf.mpxj.ProjectCalendarWeek |
|---|
addCalendarHours, addDefaultCalendarHours, addDefaultCalendarHours, getCalendarHours, getDateRange, getDays, getHours, getHours, getName, getWorkingDay, isDerived, setDateRange, setName, setWorkingDay, setWorkingDay |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_BASE_CALENDAR_NAME
| Constructor Detail |
|---|
public ProjectCalendar(ProjectFile file)
file - the parent file to which this record belongs.
public ProjectCalendar(ProjectFile file,
ProjectCalendar taskCalendar,
ProjectCalendar resourceCalendar)
file - the parent file to which this record belongs.taskCalendar - task calendar to mergeresourceCalendar - resource calendar to merge| Method Detail |
|---|
public ProjectCalendarWeek addWorkWeek()
public List<ProjectCalendarWeek> getWorkWeeks()
public ProjectCalendarException addCalendarException(Date fromDate,
Date toDate)
fromDate - exception start datetoDate - exception end date
public List<ProjectCalendarException> getCalendarExceptions()
public ProjectCalendarHours addCalendarHours(Day day)
addCalendarHours in class ProjectCalendarWeekday - day number
public void attachHoursToDay(ProjectCalendarHours hours)
attachHoursToDay in class ProjectCalendarWeekhours - calendar hours instancepublic void removeHoursFromDay(ProjectCalendarHours hours)
removeHoursFromDay in class ProjectCalendarWeekhours - calendar hours instancepublic void setParent(ProjectCalendar calendar)
calendar - base calendar instancepublic ProjectCalendar getParent()
ProjectCalendarWeek
getParent in class ProjectCalendarWeekpublic boolean isWorkingDay(Day day)
day - required day
public Duration getDuration(Date startDate,
Date endDate)
startDate - start of the periodendDate - end of the period
public Date getStartTime(Date date)
date - Date instance
public Date getFinishTime(Date date)
date - Date instance
public Date getDate(Date startDate,
Duration duration,
boolean returnNextWorkStart)
startDate - start dateduration - durationreturnNextWorkStart - if set to true will return start of next working period
public Date getStartDate(Date finishDate,
Duration duration)
finishDate - finish dateduration - duration
public Date getNextWorkStart(Date date)
date - date and time start point
public Date getPreviousWorkFinish(Date date)
date - date and time start point
public boolean isWorkingDate(Date date)
date - Date to be tested
public void setUniqueID(Integer uniqueID)
uniqueID - unique identifierpublic Integer getUniqueID()
public Resource getResource()
public void setResource(Resource resource)
resource - resource instancepublic void remove()
public ProjectCalendarException getException(Date date)
date - target date
public Duration getWork(Date date,
TimeUnit format)
date - target dateformat - required format
public Duration getWork(Date startDate,
Date endDate,
TimeUnit format)
startDate - start dateendDate - end dateformat - required duration format
protected void addDerivedCalendar(ProjectCalendar calendar)
calendar - derived calendar instanceprotected void removeDerivedCalendar(ProjectCalendar calendar)
calendar - derived calendar instancepublic List<ProjectCalendar> getDerivedCalendars()
public String toString()
toString in class Objectpublic void copy(ProjectCalendar cal)
cal - calendar data sourcepublic final ProjectFile getParentFile()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||