|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectnet.sf.mpxj.ProjectEntity
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 int |
DEFAULT
Constant used to represent that a day in a derived calendar used the value specified in the base calendar to indicate if it is working or not. |
static java.lang.String |
DEFAULT_BASE_CALENDAR_NAME
Default base calendar name to use when none is supplied. |
static java.util.Date |
DEFAULT_END1
|
static java.util.Date |
DEFAULT_END2
|
static java.util.Date |
DEFAULT_START1
|
static java.util.Date |
DEFAULT_START2
|
static int |
NON_WORKING
Constant used to represent a non-working day. |
static int |
WORKING
Constant used to represent a working day. |
| 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()
Used to add exceptions to the calendar. |
ProjectCalendarHours |
addCalendarHours()
Adds a set of hours to this calendar without assigning them to a particular day. |
ProjectCalendarHours |
addCalendarHours(Day day)
Used to add working hours to the calendar. |
void |
addDefaultCalendarHours()
This is a convenience method used to add a default set of calendar hours to a calendar. |
void |
addDefaultCalendarHours(Day day)
This is a convenience method used to add a default set of calendar hours to a calendar. |
protected void |
addDerivedCalendar(ProjectCalendar calendar)
Add a reference to a calendar derived from this one. |
void |
attachHoursToDay(ProjectCalendarHours hours)
Attaches a pre-existing set of hours to the correct day within the calendar. |
ProjectCalendar |
getBaseCalendar()
Retrieve the ProjectCalendar instance from which this calendar is derived. |
java.util.List<ProjectCalendarException> |
getCalendarExceptions()
This method retrieves a list of exceptions to the current calendar. |
ProjectCalendarHours |
getCalendarHours(Day day)
This method retrieves the calendar hours for the specified day. |
java.util.Date |
getDate(java.util.Date startDate,
Duration duration,
boolean returnNextWorkStart)
Given a start date and a duration, this method calculates the end date. |
int[] |
getDays()
Retrieve an array representing the days of the week for this calendar. |
java.util.List<ProjectCalendar> |
getDerivedCalendars()
Retrieve a list of derived calendars. |
Duration |
getDuration(java.util.Date startDate,
java.util.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(java.util.Date date)
Retrieve a calendar calendar exception which applies to this date. |
java.util.Date |
getFinishTime(java.util.Date date)
Retrieves the time at which work finishes on the given date, or returns null if this is a non-working day. |
ProjectCalendarHours[] |
getHours()
Retrieve an array representing all of the calendar hours defined by this calendar. |
ProjectCalendarHours |
getHours(Day day)
This method retrieves the calendar hours for the specified day. |
java.lang.String |
getName()
Calendar name. |
java.util.Date |
getNextWorkStart(java.util.Date date)
Utility method to retrieve the next working date time, given a date and time as a starting point. |
Resource |
getResource()
Retrieve the resource to which this calendar is linked. |
java.util.Date |
getStartDate(java.util.Date finishDate,
Duration duration)
Given a finish date and a duration, this method calculates backwards to the start date. |
java.util.Date |
getStartTime(java.util.Date date)
Retrieves the time at which work starts on the given date, or returns null if this is a non-working day. |
java.lang.Integer |
getUniqueID()
Accessor method to retrieve the unique ID of this calendar. |
Duration |
getWork(java.util.Date startDate,
java.util.Date endDate,
TimeUnit format)
This method retrieves a Duration instance representing the amount of work between two dates based on this calendar. |
Duration |
getWork(java.util.Date date,
TimeUnit format)
Retrieves the amount of work on a given day, and returns it in the specified format. |
int |
getWorkingDay(Day day)
This method allows the retrieval of the actual working day flag, which can take the values DEFAULT, WORKING, or NONWORKING. |
boolean |
isBaseCalendar()
This method returns a flag indicating if this ProjectCalendar instance represents a base calendar. |
boolean |
isWorkingDate(java.util.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 |
setBaseCalendar(ProjectCalendar calendar)
Sets the ProjectCalendar instance from which this calendar is derived. |
void |
setName(java.lang.String name)
Calendar name. |
void |
setResource(Resource resource)
Sets the resource to which this calendar is linked. |
void |
setUniqueID(java.lang.Integer uniqueID)
Modifier method to set the unique ID of this calendar. |
void |
setWorkingDay(Day day,
boolean working)
convenience method for setting working or non-working days. |
void |
setWorkingDay(Day day,
int working)
This is a convenience method provided to allow a day to be set as working or non-working, by using the day number to identify the required day. |
void |
setWorkingDay(Day day,
java.lang.Integer working)
This is a convenience method provided to allow a day to be set as working or non-working, by using the day number to identify the required day. |
java.lang.String |
toString()
|
| Methods inherited from class net.sf.mpxj.ProjectEntity |
|---|
getParentFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_BASE_CALENDAR_NAME
public static final int NON_WORKING
public static final int WORKING
public static final int DEFAULT
public static final java.util.Date DEFAULT_START1
public static final java.util.Date DEFAULT_END1
public static final java.util.Date DEFAULT_START2
public static final java.util.Date DEFAULT_END2
| Constructor Detail |
|---|
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 ProjectCalendarException addCalendarException()
public java.util.List<ProjectCalendarException> getCalendarExceptions()
public ProjectCalendarHours addCalendarHours(Day day)
day - day number
public ProjectCalendarHours addCalendarHours()
public void attachHoursToDay(ProjectCalendarHours hours)
hours - calendar hours instancepublic void removeHoursFromDay(ProjectCalendarHours hours)
hours - calendar hours instancepublic ProjectCalendarHours getCalendarHours(Day day)
day - Day instance
public ProjectCalendarHours getHours(Day day)
day - Day instance
public ProjectCalendarHours[] getHours()
public void setName(java.lang.String name)
name - calendar namepublic java.lang.String getName()
public void setBaseCalendar(ProjectCalendar calendar)
calendar - base calendar instancepublic ProjectCalendar getBaseCalendar()
public boolean isWorkingDay(Day day)
day - required day
public int[] getDays()
public int getWorkingDay(Day day)
day - required day
public void setWorkingDay(Day day,
int working)
day - required dayworking - flag indicating if the day is working/non-working/default
public void setWorkingDay(Day day,
boolean working)
day - required dayworking - flag indicating if the day is a working day
public void setWorkingDay(Day day,
java.lang.Integer working)
day - required dayworking - flag indicating if the day is a working daypublic void addDefaultCalendarHours()
public void addDefaultCalendarHours(Day day)
day - Day for which to add default hours for
public Duration getDuration(java.util.Date startDate,
java.util.Date endDate)
startDate - start of the periodendDate - end of the period
public java.util.Date getStartTime(java.util.Date date)
date - Date instance
public java.util.Date getFinishTime(java.util.Date date)
date - Date instance
public java.util.Date getDate(java.util.Date startDate,
Duration duration,
boolean returnNextWorkStart)
startDate - start dateduration - durationreturnNextWorkStart - if set to true will return start of next working period
public java.util.Date getStartDate(java.util.Date finishDate,
Duration duration)
finishDate - finish dateduration - duration
public java.util.Date getNextWorkStart(java.util.Date date)
date - date and time start point
public boolean isWorkingDate(java.util.Date date)
date - Date to be tested
public boolean isBaseCalendar()
public void setUniqueID(java.lang.Integer uniqueID)
uniqueID - unique identifierpublic java.lang.Integer getUniqueID()
public Resource getResource()
public void setResource(Resource resource)
resource - resource instancepublic void remove()
public ProjectCalendarException getException(java.util.Date date)
date - target date
public Duration getWork(java.util.Date date,
TimeUnit format)
date - target dateformat - required format
public Duration getWork(java.util.Date startDate,
java.util.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 java.util.List<ProjectCalendar> getDerivedCalendars()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||