java.lang.Object
com.primavera.integration.client.BOBase
com.primavera.integration.client.bo.BusinessObject
com.primavera.integration.client.bo.base.CalendarBase
com.primavera.integration.client.bo.object.Calendar

public class Calendar extends com.primavera.integration.client.bo.base.CalendarBase

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 Details

    • Calendar

      public Calendar(Session session)
      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

      public Calendar(Session session, ObjectId objId) throws BusinessObjectException
      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 Session
      objId - 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 Session
      rowSet - the PrmRowSet retrieved from the server
      iIndex - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 load
      sWhereClause - where clause
      sOrderBy - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 load
      sWhereClause - where clause
      sOrderBy - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 load
      sWhereClause - where clause
      sOrderBy - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      calendars - array of Calendar objects to update
      replaceHolidayOrExceptions - whether to replace all holidays and exceptions
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getTotalWorkHours

      public double getTotalWorkHours(Date date) throws BusinessObjectException
      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

      public DetailedWorkHours getDetailedWorkHours(Date date) throws BusinessObjectException
      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

      public double getStandardTotalWorkHours(int iDayOfWeek) throws BusinessObjectException
      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

      public void setDetailedWorkHours(Date date, DetailedWorkHours hhdm) throws BusinessObjectException
      Set the detailed time hours for the given date.
      Parameters:
      date - the date
      hhdm - 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

      public List<Date> getHolidayExceptionDates() throws BusinessObjectException
      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

      public ObjectId getObjectId() throws BusinessObjectException
      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:
      getObjectId in class BusinessObject
      Returns:
      the value in the field ObjectId
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • setObjectId

      public void setObjectId(ObjectId o) throws BusinessObjectException
      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:
      setObjectId in class BusinessObject
      Parameters:
      o - the value to set this field to
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getProjectObjectId

      public ObjectId getProjectObjectId() throws BusinessObjectException
      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

      public void setProjectObjectId(ObjectId o) throws BusinessObjectException
      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

      public String getProjectId() throws BusinessObjectException
      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

      public CalendarType getType() throws BusinessObjectException
      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

      public void setType(CalendarType enm) throws BusinessObjectException
      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

      public boolean getIsDefault() throws BusinessObjectException
      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

      public void setIsDefault(boolean b) throws BusinessObjectException
      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

      public ObjectId getBaseCalendarObjectId() throws BusinessObjectException
      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

      public void setBaseCalendarObjectId(ObjectId o) throws BusinessObjectException
      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

      public String getName() throws BusinessObjectException
      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

      public void setName(String s) throws BusinessObjectException
      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

      public double getHoursPerDay() throws BusinessObjectException
      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

      public void setHoursPerDay(double d) throws BusinessObjectException
      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

      public double getHoursPerWeek() throws BusinessObjectException
      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

      public void setHoursPerWeek(double d) throws BusinessObjectException
      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

      public double getHoursPerMonth() throws BusinessObjectException
      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

      public void setHoursPerMonth(double d) throws BusinessObjectException
      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

      public double getHoursPerYear() throws BusinessObjectException
      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

      public void setHoursPerYear(double d) throws BusinessObjectException
      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

      public boolean getIsPersonal() throws BusinessObjectException
      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

      public void setIsPersonal(boolean b) throws BusinessObjectException
      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

      public Date getCreateDate() throws BusinessObjectException
      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

      public Date getLastUpdateDate() throws BusinessObjectException
      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

      public String getCreateUser() throws BusinessObjectException
      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

      public String getLastUpdateUser() throws BusinessObjectException
      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

      public boolean getIsBaseline() throws BusinessObjectException
      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

      public boolean getIsTemplate() throws BusinessObjectException
      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

      public static String[] 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

      public static String[] getFilterableFields()
      Gets all fields that can be filtered.
      Returns:
      String[] an array of filterable fields
    • getInternalDefaultLoadFields

      public static String[] getInternalDefaultLoadFields()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getAllFields

      public static String[] getAllFields()
      Gets all fields for this business object.
      Returns:
      String[] an array of all fields
    • getInternalAllFields

      public static String[] getInternalAllFields()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getInternalAllFieldsSet

      public static Set<String> getInternalAllFieldsSet()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getWritableFields

      public static String[] getWritableFields()
      Gets all writable fields for this business object.
      Returns:
      String[] an array of writable fields
    • getDefaultXMLExportFields

      @Deprecated public static String[] 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

      public static String[] 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

      public String toString()
      Returns a string representation of the object. The output is in XML.
      Overrides:
      toString in class Object
      Returns:
      String a string representation of the object.
    • 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      calendars - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      fields - fields to load
      objId - unique ID of the Calendar object
      Returns:
      Calendar the Calendar object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      fields - fields to load
      objIds - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      calendars - array of Calendar objects to update
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      calendars - array of Calendar objects to delete
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - 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 object
      calendars - array of Calendar objects to delete
      replacementParent - replacement parent object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects