Interface TimePeriodAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
TimePeriodBatchAdminSession

public interface TimePeriodAdminSession extends OsidSession

This session creates, updates, and deletes Time Periods . The data for create and update is provided by the consumer via the form object. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a TimePeriod , a TimePeriodForm is requested using getTimePeriodFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned TimePeriodForm will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the TimePeriodForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each TimePeriodForm corresponds to an attempted transaction.

For updates, TimePeriodForms are requested to the TimePeriod Id that is to be updated using getTimePeriodFormForUpdate() . Similarly, the TimePeriodForm has metadata about the data that can be updated and it can perform validation before submitting the update. The TimePeriodForm can only be used once for a successful update and cannot be reused.

The delete operations delete Time Periods . To unmap a TimePeriod from the current Calendar , the TimePeriodCalendarAssignmentSession should be used. These delete operations attempt to remove the TimePeriod itself thus removing it from all known Calendar catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getCalendarId

      Id getCalendarId()
      Gets the Calendar Id associated with this session.
      Returns:
      the Calendar Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCalendar

      Gets the Calendar associated with this session.
      Returns:
      the Calendar associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateTimePeriods

      boolean canCreateTimePeriods()
      Tests if this user can create TimePeriods . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a TimePeriod will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if TimePeriod creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateTimePeriodWithRecordTypes

      boolean canCreateTimePeriodWithRecordTypes(Type[] timePeriodRecordTypes)
      Tests if this user can create a single TimePeriod using the desired record types. While CalendaringManager.getTimePeriodRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific TimePeriod . Providing an empty array tests if a TimePeriod can be created with no records.
      Parameters:
      timePeriodRecordTypes - array of time period record types
      Returns:
      true if TimePeriod creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - timePeriodRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getTimePeriodFormForCreate

      TimePeriodForm getTimePeriodFormForCreate(Type[] timePeriodRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the time period form for creating new time periods. A new form should be requested for each create transaction.
      Parameters:
      timePeriodRecordTypes - array of time period record types
      Returns:
      the time period form
      Throws:
      NullArgumentException - timePeriodRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createTimePeriod

      Creates a new TimePeriod .
      Parameters:
      timePeriodForm - the forms for this TimePeriod
      Returns:
      the new TimePeriod
      Throws:
      IllegalStateException - timePeriodForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - timePeriodForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - timePeriodForm did not originate from getTimePeriodForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateTimePeriods

      boolean canUpdateTimePeriods()
      Tests if this user can update TimePeriods . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a TimePeriod will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if time period modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getTimePeriodFormForUpdate

      TimePeriodForm getTimePeriodFormForUpdate(Id timePeriodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the time period form for updating an existing time period. A new time period form should be requested for each update transaction.
      Parameters:
      timePeriodId - the Id of the TimePeriod
      Returns:
      the time period form
      Throws:
      NotFoundException - timePeriodId is not found
      NullArgumentException - timePeriodid is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateTimePeriod

      void updateTimePeriod(TimePeriodForm timePeriodForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing tiem period.
      Parameters:
      timePeriodForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - timePeriodForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - timePeriodForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - timePeriodForm did not originate from getTimePeriodForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteTimePeriods

      boolean canDeleteTimePeriods()
      Tests if this user can delete TimePeriods . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a TimePeriod will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if TimePeriod deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteTimePeriod

      void deleteTimePeriod(Id timePeriodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes the TimePeriod identified by the given Id .
      Parameters:
      timePeriodId - the Id of the TimePeriod to delete
      Throws:
      NotFoundException - a TimePeriod was not found identified by the given Id
      NullArgumentException - timePeriodId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageTimePeriodAliases

      boolean canManageTimePeriodAliases()
      Tests if this user can manage Id aliases for TimePeriods . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if TimePeriod aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasTimePeriod

      void aliasTimePeriod(Id timePeriodId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to a TimePeriod for the purpose of creating compatibility. The primary Id of the TimePeriod is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another time period, it is reassigned to the given time period Id .
      Parameters:
      timePeriodId - the Id of a TimePeriod
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - timePeriodId not found
      NullArgumentException - timePeriodId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • addExceptionEvent

      void addExceptionEvent(Id timePeriodId, Id eventId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an exception event to a time period. Time period exception events govern exceptions to recurring events mapped to a time period.
      Parameters:
      timePeriodId - the Id of a TimePeriod
      eventId - an exception event Id
      Throws:
      AlreadyExistsException - event is already part of the time period
      NotFoundException - timePeriodId or eventId is not found
      NullArgumentException - timePeriodId or eventId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • removeExceptionEvent

      void removeExceptionEvent(Id timePeriodId, Id eventId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Removes an exception event from a time period.
      Parameters:
      timePeriodId - the Id of a TimePeriod
      eventId - an exception event Id
      Throws:
      NotFoundException - eventId not an exception in timePeriodId
      NullArgumentException - timePeriodId or eventId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.