Class Calendar
Calendars defined the available work hours in each calendar day. Three types exist: global, resource, and project. Either resource or global calendars can be assigned to resources, and either global or project calendars can be assigned to activities.
You can specify national holidays, your organization's holidays, project-specific work/nonworkdays, and resource vacation days. Calendar assignments are used for activity scheduling, tracking, and resource leveling. Whether an activity uses its assigned calendar or the calendar of an assigned resource depends on the activity type you specify.
You can link resource and project calendars to global calendars. Then, if you make changes to a global calendar, your changes apply to all resource and project calendars that are linked to the modified global calendar.
You can get the total work hours or detailed work hours for a given date or day of the week using the methods getTotalWorkHours(), getDetailedWorkHours(), getStandardTotalWorkHours(), and getStandardDetailedWorkHours(). Detailed work hours provide information on specific worktime during the day, in half hour increments. To set work time for a particular date or day of the week, use the setDetailedWorkHours() and setStandardDetailedWorkHours() methods. To get a complete list of all dates for which holidays or exceptions are defined, use the method getHolidayExceptionDates().
See Also: Quick reference of Calendar fields
-
Constructor Summary
ConstructorsConstructorDescriptionClass constructor specifying the Session.Class constructor specifying the Session and ObjectId of the object.Class constructor called internally after objects are retrieved from the server. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates this Calendar object in the database.static ObjectId[]Creates multiple Calendar objects in the database.voiddelete()Deletes this Calendar object from the database.voidDeletes this Calendar object from the database.static voidDeletes multiple Calendar objects from the database.static voidDeletes multiple calendar objects in a hierarchy from the database and set the new parent of all child objects.static String[]Gets all fields for this business object.Gets the unique ID of the global calendar to which this calendar is linked.Gets the date this calendar was created.Gets the name of the user that created this calendar.static String[]Deprecated.getDetailedWorkHours(Date date) Gets the detailed work hours for the given date.static String[]Gets all fields that can be filtered.Gets a List (ordered by date) of all dates with holidays or exceptions in this calendar.doubleGets the number of work hours per day.doubleGets the number of work hours per month.doubleGets the number of work hours per week.doubleGets the number of work hours per year.static String[]An internal method that should not be called directly by client code.An internal method that should not be called directly by client code.static String[]An internal method that should not be called directly by client code.booleanGets the boolean value indicating if this business object is related to a Project or Baseline.booleanGets the flag that identifies the default global calendar (applies to global calendars only).booleanGets the flag indicating if this calendar is a personal calendar (applies to resource calendars only).booleanGets the boolean value indicating if this business object is related to a template Project.Gets the date this calendar was last updated.Gets the name of the user that last updated this calendar.static String[]Gets all fields that are always exported at a minimum by the new flat XML exportergetName()Gets the name of the calendar.Gets the unique ID generated by the system.Gets the short name of the associated project.Gets the unique ID of the associated project.static String[]Gets all fields that must be set before calling create() on this business object.getStandardDetailedWorkHours(int iDayOfWeek) Gets the standard detailed work hours for the given day of week.doublegetStandardTotalWorkHours(int iDayOfWeek) Get the standard total work hours for the given day of week.doublegetTotalWorkHours(Date date) Gets the total work hours and date for this given date.getType()Gets the calendar type - either 'Global', 'Resource', or 'Project'.static String[]Gets all writable fields for this business object.static CalendarLoads a single Calendar object from the database.static BOIterator<Calendar>Loads multiple Calendar objects from the database.loadActivities(String[] fields, String sWhereClause, String sOrderBy) Loads multiple associated Activity objects from the database.loadBaseCalendar(String[] fields) Loads an associated Calendar object from the database.loadProjectOwner(String[] fields) Loads an associated Project object from the database.loadProjects(String[] fields, String sWhereClause, String sOrderBy) Loads multiple associated Project objects from the database.loadResources(String[] fields, String sWhereClause, String sOrderBy) Loads multiple associated Resource objects from the database.voidSets the unique ID of the global calendar to which this calendar is linked.voidsetDetailedWorkHours(Date date, DetailedWorkHours hhdm) Set the detailed time hours for the given date.voidsetHoursPerDay(double d) Sets the number of work hours per day.voidsetHoursPerMonth(double d) Sets the number of work hours per month.voidsetHoursPerWeek(double d) Sets the number of work hours per week.voidsetHoursPerYear(double d) Sets the number of work hours per year.voidsetIsDefault(boolean b) Sets the flag that identifies the default global calendar (applies to global calendars only).voidsetIsPersonal(boolean b) Sets the flag indicating if this calendar is a personal calendar (applies to resource calendars only).voidSets the name of the calendar.voidSets the unique ID generated by the system.voidSets the unique ID of the associated project.voidsetStandardDetailedWorkHours(int iDayOfWeek, DetailedWorkHours hhdm) Sets the standard detailed work hours for the given date.voidsetType(CalendarType enm) Sets the calendar type - either 'Global', 'Resource', or 'Project'.toString()Returns a string representation of the object.voidupdate()Updates this Calendar object in the database.voidupdate(boolean replaceHolidayOrExceptions) Updates this Calendar object in the database with the option to replace all holidays and exceptions.static voidUpdates multiple Calendar objects in the database.static voidUpdates multiple Calendar objects in the database with the option to replace all holidays and exceptions.Methods inherited from class com.primavera.integration.client.bo.base.CalendarBase
createCopyMethods inherited from class com.primavera.integration.client.bo.BusinessObject
equals, getMaxFieldLength, getValue, getValue, hashCode, isNull, setEarlyDate, setNullMethods inherited from class com.primavera.integration.client.BOBase
combineFields
-
Constructor Details
-
Calendar
Class constructor specifying the Session. This constructor is most commonly used when create() is intended to be called on this object.- Parameters:
session- the Session
-
Calendar
Class constructor specifying the Session and ObjectId of the object. This constructor is most commonly used when update() will be called on this object.- Parameters:
session- the SessionobjId- the ObjectId- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
Calendar
public Calendar(Session session, com.primavera.infr.db.PrmRowSet rowSet, int iIndex) throws BusinessObjectException Class constructor called internally after objects are retrieved from the server. Client code should use one of the other constructors for this class.- Parameters:
session- the SessionrowSet- the PrmRowSet retrieved from the serveriIndex- the row index in the PrmRowSet associated with this business object- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
-
Method Details
-
loadBaseCalendar
public Calendar loadBaseCalendar(String[] fields) throws ServerException, NetworkException, BusinessObjectException Loads an associated Calendar object from the database.- Parameters:
fields- fields to load- Returns:
- Calendar the Calendar object
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
loadProjectOwner
public Project loadProjectOwner(String[] fields) throws ServerException, NetworkException, BusinessObjectException Loads an associated Project object from the database.- Parameters:
fields- fields to load- Returns:
- Project the Project object
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
loadProjects
public BOIterator<Project> loadProjects(String[] fields, String sWhereClause, String sOrderBy) throws ServerException, NetworkException, BusinessObjectException Loads multiple associated Project objects from the database.- Parameters:
fields- fields to loadsWhereClause- where clausesOrderBy- order-by clause- Returns:
- BOIterator a business object iterator used to get the results of the load request
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
loadResources
public BOIterator<Resource> loadResources(String[] fields, String sWhereClause, String sOrderBy) throws ServerException, NetworkException, BusinessObjectException Loads multiple associated Resource objects from the database.- Parameters:
fields- fields to loadsWhereClause- where clausesOrderBy- order-by clause- Returns:
- BOIterator a business object iterator used to get the results of the load request
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
loadActivities
public BOIterator<Activity> loadActivities(String[] fields, String sWhereClause, String sOrderBy) throws ServerException, NetworkException, BusinessObjectException Loads multiple associated Activity objects from the database.- Parameters:
fields- fields to loadsWhereClause- where clausesOrderBy- order-by clause- Returns:
- BOIterator a business object iterator used to get the results of the load request
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
update
public void update(boolean replaceHolidayOrExceptions) throws ServerException, NetworkException, BusinessObjectException Updates this Calendar object in the database with the option to replace all holidays and exceptions.- Parameters:
replaceHolidayOrExceptions- whether to replace all holidays and exceptions- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
update
public static void update(Session session, Calendar[] calendars, boolean replaceHolidayOrExceptions) throws ServerException, NetworkException, BusinessObjectException Updates multiple Calendar objects in the database with the option to replace all holidays and exceptions.- Parameters:
session- the Session objectcalendars- array of Calendar objects to updatereplaceHolidayOrExceptions- whether to replace all holidays and exceptions- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
getTotalWorkHours
Gets the total work hours and date for this given date.- Parameters:
date- the date for which to get the total work hours- Returns:
- Get the total work hours with the given date
- Throws:
BusinessObjectException- if something was wrong in this Business object
-
getDetailedWorkHours
Gets the detailed work hours for the given date.- Parameters:
date- the date for which to get work hours- Returns:
- the detailed work hours
- Throws:
BusinessObjectException- if something was wrong in this Business object
-
getStandardTotalWorkHours
Get the standard total work hours for the given day of week.- Parameters:
iDayOfWeek- the day of week- Returns:
- the standard total work hours
- Throws:
BusinessObjectException- if something was wrong in this Business object
-
getStandardDetailedWorkHours
public DetailedWorkHours getStandardDetailedWorkHours(int iDayOfWeek) throws BusinessObjectException Gets the standard detailed work hours for the given day of week.- Parameters:
iDayOfWeek- the day of week- Returns:
- the standard detailed time hours
- Throws:
BusinessObjectException- if something was wrong in this Business object
-
setDetailedWorkHours
Set the detailed time hours for the given date.- Parameters:
date- the datehhdm- the detailed time hours- Throws:
BusinessObjectException- if something was wrong in this Business object
-
setStandardDetailedWorkHours
public void setStandardDetailedWorkHours(int iDayOfWeek, DetailedWorkHours hhdm) throws BusinessObjectException Sets the standard detailed work hours for the given date.- Parameters:
iDayOfWeek- the day of week (from 1 to 7)hhdm- the standard detailed time hours for the day of week- Throws:
BusinessObjectException- if something was wrong in this Business object
-
getHolidayExceptionDates
Gets a List (ordered by date) of all dates with holidays or exceptions in this calendar.- Returns:
- a List (ordered by date) of all dates with holidays or exceptions
- Throws:
BusinessObjectException- if something was wrong in this Business object
-
getObjectId
Gets the unique ID generated by the system. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Overrides:
getObjectIdin classBusinessObject- Returns:
- the value in the field ObjectId
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setObjectId
Sets the unique ID generated by the system. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Overrides:
setObjectIdin classBusinessObject- Parameters:
o- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getProjectObjectId
Gets the unique ID of the associated project. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Returns:
- the value in the field ProjectObjectId
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setProjectObjectId
Sets the unique ID of the associated project. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Parameters:
o- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getProjectId
Gets the short name of the associated project.- Returns:
- the value in the field ProjectId
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getType
Gets the calendar type - either 'Global', 'Resource', or 'Project'. 'Global' calendars can be assigned to projects and resources. 'Resource' calendars can be assigned only to resources. 'Project' calendars are specific to projects. This field must contain a valid value in order to create this type of business object in the database.- Returns:
- the value in the field Type
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setType
Sets the calendar type - either 'Global', 'Resource', or 'Project'. 'Global' calendars can be assigned to projects and resources. 'Resource' calendars can be assigned only to resources. 'Project' calendars are specific to projects. This field must contain a valid value in order to create this type of business object in the database.- Parameters:
enm- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getIsDefault
Gets the flag that identifies the default global calendar (applies to global calendars only).- Returns:
- the value in the field IsDefault
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setIsDefault
Sets the flag that identifies the default global calendar (applies to global calendars only).- Parameters:
b- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getBaseCalendarObjectId
Gets the unique ID of the global calendar to which this calendar is linked. Any changes to the global calendar are automatically propagated to this calendar. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Returns:
- the value in the field BaseCalendarObjectId
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setBaseCalendarObjectId
Sets the unique ID of the global calendar to which this calendar is linked. Any changes to the global calendar are automatically propagated to this calendar. This field is automatically loaded by default whenever this type of business object is loaded from the database.- Parameters:
o- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getName
Gets the name of the calendar. This field must contain a valid value in order to create this type of business object in the database.- Returns:
- the value in the field Name
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setName
Sets the name of the calendar. This field must contain a valid value in order to create this type of business object in the database.- Parameters:
s- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getHoursPerDay
Gets the number of work hours per day. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Returns:
- the value in the field HoursPerDay
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setHoursPerDay
Sets the number of work hours per day. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Parameters:
d- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getHoursPerWeek
Gets the number of work hours per week. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Returns:
- the value in the field HoursPerWeek
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setHoursPerWeek
Sets the number of work hours per week. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Parameters:
d- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getHoursPerMonth
Gets the number of work hours per month. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Returns:
- the value in the field HoursPerMonth
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setHoursPerMonth
Sets the number of work hours per month. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Parameters:
d- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getHoursPerYear
Gets the number of work hours per year. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Returns:
- the value in the field HoursPerYear
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setHoursPerYear
Sets the number of work hours per year. This conversion factor is used for displaying time units and durations in the user's selected display formats.- Parameters:
d- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getIsPersonal
Gets the flag indicating if this calendar is a personal calendar (applies to resource calendars only).- Returns:
- the value in the field IsPersonal
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
setIsPersonal
Sets the flag indicating if this calendar is a personal calendar (applies to resource calendars only).- Parameters:
b- the value to set this field to- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getCreateDate
Gets the date this calendar was created.- Returns:
- the value in the field CreateDate
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getLastUpdateDate
Gets the date this calendar was last updated.- Returns:
- the value in the field LastUpdateDate
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getCreateUser
Gets the name of the user that created this calendar.- Returns:
- the value in the field CreateUser
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getLastUpdateUser
Gets the name of the user that last updated this calendar.- Returns:
- the value in the field LastUpdateUser
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getIsBaseline
Gets the boolean value indicating if this business object is related to a Project or Baseline.- Returns:
- the value in the field IsBaseline
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getIsTemplate
Gets the boolean value indicating if this business object is related to a template Project.- Returns:
- the value in the field IsTemplate
- Throws:
BusinessObjectException- if a problem occurred in the client-side business objects
-
getRequiredCreateFields
Gets all fields that must be set before calling create() on this business object. Generally the array will contain one field in each position, but if this business object requires either one field or another field to be set, both of those fields will appear in an element of the returned array separated by '|'. For example, if this business object requires field A to always be set, and field B or field C to be set, one element in the returned array will contain A, and one element will contain B|C.- Returns:
- String[] an array of required create fields
-
getFilterableFields
Gets all fields that can be filtered.- Returns:
- String[] an array of filterable fields
-
getInternalDefaultLoadFields
An internal method that should not be called directly by client code.- Returns:
- String[] an internal array
-
getAllFields
Gets all fields for this business object.- Returns:
- String[] an array of all fields
-
getInternalAllFields
An internal method that should not be called directly by client code.- Returns:
- String[] an internal array
-
getInternalAllFieldsSet
An internal method that should not be called directly by client code.- Returns:
- String[] an internal array
-
getWritableFields
Gets all writable fields for this business object.- Returns:
- String[] an array of writable fields
-
getDefaultXMLExportFields
Deprecated.Gets the fields that are exported by the hierarchical XML exporter when no fields are specified. This method is no longer relevant since the hierarchical XML exporter has been replaced by the flat XML exporter.- Returns:
- String[] an array of field names
-
getMinimumXMLExportFields
Gets all fields that are always exported at a minimum by the new flat XML exporter- Returns:
- String[] an array of exported fields
-
toString
Returns a string representation of the object. The output is in XML. -
create
Creates this Calendar object in the database.- Returns:
- ObjectId the unique ID of the newly created Calendar object
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
create
public static ObjectId[] create(Session session, Calendar[] calendars) throws ServerException, NetworkException, BusinessObjectException Creates multiple Calendar objects in the database.- Parameters:
session- the Session objectcalendars- array of Calendar objects to create- Returns:
- ObjectId[] the array of unique IDs of newly created Calendar objects
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
load
public static Calendar load(Session session, String[] fields, ObjectId objId) throws ServerException, NetworkException, BusinessObjectException Loads a single Calendar object from the database.- Parameters:
session- the Session objectfields- fields to loadobjId- unique ID of the Calendar object- Returns:
- Calendar the Calendar object
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
load
public static BOIterator<Calendar> load(Session session, String[] fields, ObjectId[] objIds) throws ServerException, NetworkException, BusinessObjectException Loads multiple Calendar objects from the database.- Parameters:
session- the Session objectfields- fields to loadobjIds- object ids of the Calendar objects- Returns:
- BOIterator a business object iterator used to get the results of the load request
- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
update
Updates this Calendar object in the database.- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
update
public static void update(Session session, Calendar[] calendars) throws ServerException, NetworkException, BusinessObjectException Updates multiple Calendar objects in the database.- Parameters:
session- the Session objectcalendars- array of Calendar objects to update- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
delete
Deletes this Calendar object from the database.- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
delete
public void delete(ObjectId replacementId) throws ServerException, NetworkException, BusinessObjectException Deletes this Calendar object from the database.- Parameters:
replacementId- unique ID of the new parent for all current child objects- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
delete
public static void delete(Session session, Calendar[] calendars) throws ServerException, NetworkException, BusinessObjectException Deletes multiple Calendar objects from the database.- Parameters:
session- the Session objectcalendars- array of Calendar objects to delete- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-
delete
public static void delete(Session session, Calendar[] calendars, ObjectId replacementParent) throws ServerException, NetworkException, BusinessObjectException Deletes multiple calendar objects in a hierarchy from the database and set the new parent of all child objects.- Parameters:
session- the Session objectcalendars- array of Calendar objects to deletereplacementParent- replacement parent object- Throws:
ServerException- if a problem occurred on the server-sideNetworkException- if a problem occurred in the network layerBusinessObjectException- if a problem occurred in the client-side business objects
-