# com.bea.wli.calendar.api
BusinessCalendar Interface

public interface BusinessCalendar
extends `EJBObject`

All Superinterfaces
  `EJBObject`, `Remote`

## Method Summary

`public `Date`` | `addBusinessTime`(`String` interval, `String` userOrGroupId, `Date` startTime) Determines if userOrGroupId is a user id or group id.
`public `Date`` | `addBusinessTime`(`String` interval, `String` userOrGroupId) Use startTime as current time.
`public `Date`` | `addBusinessTime`(`String` interval, `CalendarDocument` cDoc)
`public `Date`` | `addBusinessTime`(`String` interval, `CalendarDocument` cDoc, `Date` startTime)
`public `Date`` | `addBusinessTimeCalendarName`(`String` interval, `String` calendarName)
`public `Date`` | `addBusinessTimeCalendarName`(`String` interval, `String` calendarName, `Date` startTime)
`public `Date`` | `addBusinessTimeSystemCalendar`(`String` interval, `Date` startTime)
`public `Date`` | `addExactTimeCalendarName`(`String` interval, `String` calendarName, `Date` startTime)
`public boolean` | `calendarNameExists`(`String` name) Checks if a calendar with the given name exists.
`public void` | `createCalendar`(`CalendarDocument` cDoc) Creates a new calendar from the information passed in the CalendarDocument.
`public void` | `deleteCalendar`(`String` calendarName)
`public void` | `deleteCalendars`(`String`[] names)
`public `String`[]` | `getAllCalendarNames`()
`public `CalendarDocument`[]` | `getAllCalendars`() Gets all calendars, including rules info and mapped groups and users.
`public `CalendarDocument`` | `getCalendar`(`String` calendarName)
`public `CalendarDocument`` | `getGroupCalendar`(`String` groupId)
`public `CalendarDocument`` | `getGroupCalendarWalkHierarchy`(`String` groupId) If a calendar is mapped to the group then that calendar is returned, otherwise returns the system calendar.
`public `Date`` | `getNextFreeMinute`(`CalendarDocument` cDoc, `Date` time) Returns the next free minute given the rules in the calendar passed from the time passed.
`public `CalendarDocument`` | `getSystemCalendar`()
`public `CalendarDocument`` | `getUserCalendar`(`String` userId)
`public `CalendarDocument`` | `getUserCalendarWalkHierarchy`(`String` userId) If a calendar is mapped to the user then that calendar is returned, otherwise returns the system calendar.
`public void` | `insertUserCalendarMapping`(`String` userid, `String` calendarId) Same as updateUserCalendar.
`public boolean` | `isTimeFree`(`CalendarDocument` cDoc, `Date` time)
`public boolean` | `isUserTimeFree`(`String` userId, `Date` time) Looks up the user's calendar using getUserCalendarWalkHierarchy and checks if the time passed is free based on the rules in the calendar.
`public void` | `setGroupCalendar`(`String` groupId, `String` calendarName)
`public void` | `setUserCalendar`(`String` userId, `String` calendarName) Set the user's calendar.
`public `Date`` | `subtractBusinessTime`(`String` interval, `String` userOrGroupId, `Date` startTime) Go back in time by the given interval.
`public `Date`` | `subtractBusinessTime`(`String` interval, `String` userOrGroupId)
`public `Date`` | `subtractBusinessTime`(`String` interval, `CalendarDocument` cDoc)
`public `Date`` | `subtractBusinessTime`(`String` interval, `CalendarDocument` cDoc, `Date` startTime)
`public `Date`` | `subtractBusinessTimeCalendarName`(`String` interval, `String` calendarName)
`public `Date`` | `subtractBusinessTimeCalendarName`(`String` interval, `String` calendarName, `Date` startTime)
`public `Date`` | `subtractBusinessTimeSystemCalendar`(`String` interval, `Date` startTime)
`public boolean` | `systemCalendarExists`()
`public void` | `unsetGroupCalendar`(`String` groupId)
`public void` | `unsetUserCalendar`(`String` userId) Unset the user's calendar.
`public void` | `updateCalendar`(`String` oldCalendarName, `CalendarDocument` cDoc) Update the calendar - oldCalendarName, using the passed CalendarDocument.
`public void` | `updateSystemCalendar`(`CalendarDocument` cDoc) Update the system calendar using the passed CalendarDocument.

Methods from interface `javax.ejb.`EJBObject``
`getEJBHome, getHandle, getPrimaryKey, isIdentical, remove`

## Method Detail

### addBusinessTime(String, String, Date) Method

    public Date addBusinessTime(String interval,
                                String userOrGroupId,
                                Date startTime)
         throws BusinessCalendarException, RemoteException

Determines if userOrGroupId is a user id or group id. Looks up the calendar using the appropriate "walk hierarchy" method. Adds the business time interval specified by the interval parameter to the given startTime based on the rules of the calendar looked up. Note that the interval time periods are "Business times". Business time for a unit of time (days, hours, minutes) is defined as a period of the equivalent "real" time minutes which contains at least one free minute. E.g. 1 business day is a period of 24*60 minutes which has at least one minute free.

#### Parameters

interval
  - a string in the format "d days, h hours, m minutes". e.g. "5 days", "5 days 2 minutes" Note that only days, hours, and minutes are supported.

userOrGroupId

startTime

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTime(String, String) Method

    public Date addBusinessTime(String interval,
                                String userOrGroupId)
         throws BusinessCalendarException, RemoteException

Use startTime as current time.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTime(String, CalendarDocument) Method

    public Date addBusinessTime(String interval,
                                CalendarDocument cDoc)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTime(String, CalendarDocument, Date) Method

    public Date addBusinessTime(String interval,
                                CalendarDocument cDoc,
                                Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTimeCalendarName(String, String) Method

    public Date addBusinessTimeCalendarName(String interval,
                                            String calendarName)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTimeCalendarName(String, String, Date) Method

    public Date addBusinessTimeCalendarName(String interval,
                                            String calendarName,
                                            Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addBusinessTimeSystemCalendar(String, Date) Method

    public Date addBusinessTimeSystemCalendar(String interval,
                                              Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### addExactTimeCalendarName(String, String, Date) Method

    public Date addExactTimeCalendarName(String interval,
                                         String calendarName,
                                         Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### calendarNameExists(String) Method

    public boolean calendarNameExists(String name)
         throws BusinessCalendarException, RemoteException

Checks if a calendar with the given name exists.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### createCalendar(CalendarDocument) Method

    public void createCalendar(CalendarDocument cDoc)
         throws BusinessCalendarException, RemoteException

Creates a new calendar from the information passed in the CalendarDocument.

#### Exceptions

``BusinessCalendarException``
  if a calendar with the given name exists or of the document is not valid.
``RemoteException``

### deleteCalendar(String) Method

    public void deleteCalendar(String calendarName)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### deleteCalendars(String[]) Method

    public void deleteCalendars(String[] names)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getAllCalendarNames() Method

    public String[] getAllCalendarNames()
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getAllCalendars() Method

    public CalendarDocument[] getAllCalendars()
         throws BusinessCalendarException, RemoteException

Gets all calendars, including rules info and mapped groups and users.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getCalendar(String) Method

    public CalendarDocument getCalendar(String calendarName)
         throws BusinessCalendarException, RemoteException

#### Returns

The CalendarDocument or null if a calendar with the given name does not exist.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getGroupCalendar(String) Method

    public CalendarDocument getGroupCalendar(String groupId)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getGroupCalendarWalkHierarchy(String) Method

    public CalendarDocument getGroupCalendarWalkHierarchy(String groupId)
         throws BusinessCalendarException, RemoteException

If a calendar is mapped to the group then that calendar is returned, otherwise returns the system calendar.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getNextFreeMinute(CalendarDocument, Date) Method

    public Date getNextFreeMinute(CalendarDocument cDoc,
                                  Date time)
         throws BusinessCalendarException, RemoteException

Returns the next free minute given the rules in the calendar passed from the time passed.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getSystemCalendar() Method

    public CalendarDocument getSystemCalendar()
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getUserCalendar(String) Method

    public CalendarDocument getUserCalendar(String userId)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### getUserCalendarWalkHierarchy(String) Method

    public CalendarDocument getUserCalendarWalkHierarchy(String userId)
         throws BusinessCalendarException, RemoteException

If a calendar is mapped to the user then that calendar is returned, otherwise returns the system calendar. Note that the existance of a system calendar is ensured by the sytem so this method always returns a calendar.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### insertUserCalendarMapping(String, String) Method

    public void insertUserCalendarMapping(String userid,
                                          String calendarId)
         throws BusinessCalendarException, RemoteException

Same as updateUserCalendar.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### isTimeFree(CalendarDocument, Date) Method

    public boolean isTimeFree(CalendarDocument cDoc,
                              Date time)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### isUserTimeFree(String, Date) Method

    public boolean isUserTimeFree(String userId,
                                  Date time)
         throws BusinessCalendarException, RemoteException

Looks up the user's calendar using getUserCalendarWalkHierarchy and checks if the time passed is free based on the rules in the calendar.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### setGroupCalendar(String, String) Method

    public void setGroupCalendar(String groupId,
                                 String calendarName)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### setUserCalendar(String, String) Method

    public void setUserCalendar(String userId,
                                String calendarName)
         throws BusinessCalendarException, RemoteException

Set the user's calendar. Does not do anything is either the given user or the calendar does not exist. A user can have only one calendar, so if a calendar is already mapped to the user then it is unmapped.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTime(String, String, Date) Method

    public Date subtractBusinessTime(String interval,
                                     String userOrGroupId,
                                     Date startTime)
         throws BusinessCalendarException, RemoteException

Go back in time by the given interval.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTime(String, String) Method

    public Date subtractBusinessTime(String interval,
                                     String userOrGroupId)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTime(String, CalendarDocument) Method

    public Date subtractBusinessTime(String interval,
                                     CalendarDocument cDoc)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTime(String, CalendarDocument, Date) Method

    public Date subtractBusinessTime(String interval,
                                     CalendarDocument cDoc,
                                     Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTimeCalendarName(String, String) Method

    public Date subtractBusinessTimeCalendarName(String interval,
                                                 String calendarName)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTimeCalendarName(String, String, Date) Method

    public Date subtractBusinessTimeCalendarName(String interval,
                                                 String calendarName,
                                                 Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### subtractBusinessTimeSystemCalendar(String, Date) Method

    public Date subtractBusinessTimeSystemCalendar(String interval,
                                                   Date startTime)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### systemCalendarExists() Method

    public boolean systemCalendarExists()
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### unsetGroupCalendar(String) Method

    public void unsetGroupCalendar(String groupId)
         throws BusinessCalendarException, RemoteException

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### unsetUserCalendar(String) Method

    public void unsetUserCalendar(String userId)
         throws BusinessCalendarException, RemoteException

Unset the user's calendar.

#### Exceptions

``BusinessCalendarException``
``RemoteException``

### updateCalendar(String, CalendarDocument) Method

    public void updateCalendar(String oldCalendarName,
                               CalendarDocument cDoc)
         throws BusinessCalendarException, RemoteException

Update the calendar - oldCalendarName, using the passed CalendarDocument. The name of the calendar is also updated based on the name passed in. Use updateSystemCalendar to update the system calendar.

#### Exceptions

``BusinessCalendarException``
  if the CalendarDocument indicates that this is a system calendar or if the system calendar has the same name as this calendar or if the name is being updated and a calendar already exists with that name.
``RemoteException``

### updateSystemCalendar(CalendarDocument) Method

    public void updateSystemCalendar(CalendarDocument cDoc)
         throws BusinessCalendarException, RemoteException

Update the system calendar using the passed CalendarDocument. If the name of the calendar is differnt than the name of the existing system calendar, then the existing system calendar is changed to non-system calendar. If a calendar with this name does not exist then it is created.

#### Exceptions

``BusinessCalendarException``
``RemoteException``