Interface TimePeriodAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
TimePeriodBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaddExceptionEvent(Id timePeriodId, Id eventId) Adds an exception event to a time period.voidaliasTimePeriod(Id timePeriodId, Id aliasId) Adds anIdto aTimePeriodfor the purpose of creating compatibility.booleanTests if this user can createTimePeriods.booleancanCreateTimePeriodWithRecordTypes(Type[] timePeriodRecordTypes) Tests if this user can create a singleTimePeriodusing the desired record types.booleanTests if this user can deleteTimePeriods.booleanTests if this user can manageIdaliases forTimePeriods.booleanTests if this user can updateTimePeriods.createTimePeriod(TimePeriodForm timePeriodForm) Creates a newTimePeriod.voiddeleteTimePeriod(Id timePeriodId) Deletes theTimePeriodidentified by the givenId.Gets theCalendarassociated with this session.Gets theCalendarIdassociated with this session.getTimePeriodFormForCreate(Type[] timePeriodRecordTypes) Gets the time period form for creating new time periods.getTimePeriodFormForUpdate(Id timePeriodId) Gets the time period form for updating an existing time period.voidremoveExceptionEvent(Id timePeriodId, Id eventId) Removes an exception event from a time period.voidupdateTimePeriod(TimePeriodForm timePeriodForm) Updates an existing tiem period.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getCalendarId
Id getCalendarId()Gets theCalendarIdassociated with this session.- Returns:
- the
Calendar Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCalendar
Gets theCalendarassociated with this session.- Returns:
- the
Calendarassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateTimePeriods
boolean canCreateTimePeriods()Tests if this user can createTimePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a TimePeriod will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifTimePeriodcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateTimePeriodWithRecordTypes
Tests if this user can create a singleTimePeriodusing the desired record types. WhileCalendaringManager.getTimePeriodRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificTimePeriod. Providing an empty array tests if aTimePeriodcan be created with no records.- Parameters:
timePeriodRecordTypes- array of time period record types- Returns:
trueifTimePeriodcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-timePeriodRecordTypesisnull- 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-timePeriodRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createTimePeriod
TimePeriod createTimePeriod(TimePeriodForm timePeriodForm) throws OperationFailedException, PermissionDeniedException Creates a newTimePeriod.- Parameters:
timePeriodForm- the forms for thisTimePeriod- Returns:
- the new
TimePeriod - Throws:
IllegalStateException-timePeriodFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-timePeriodFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-timePeriodFormdid not originate fromgetTimePeriodForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateTimePeriods
boolean canUpdateTimePeriods()Tests if this user can updateTimePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aTimePeriodwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif time period modification is not authorized,trueotherwise- 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- theIdof theTimePeriod- Returns:
- the time period form
- Throws:
NotFoundException-timePeriodIdis not foundNullArgumentException-timePeriodidisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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-timePeriodFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-timePeriodFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-timePeriodFormdid not originate fromgetTimePeriodForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteTimePeriods
boolean canDeleteTimePeriods()Tests if this user can deleteTimePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aTimePeriodwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifTimePerioddeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteTimePeriod
void deleteTimePeriod(Id timePeriodId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theTimePeriodidentified by the givenId.- Parameters:
timePeriodId- theIdof theTimePeriodto delete- Throws:
NotFoundException- aTimePeriodwas not found identified by the givenIdNullArgumentException-timePeriodIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageTimePeriodAliases
boolean canManageTimePeriodAliases()Tests if this user can manageIdaliases forTimePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifTimePeriodaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasTimePeriod
void aliasTimePeriod(Id timePeriodId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aTimePeriodfor the purpose of creating compatibility. The primaryIdof theTimePeriodis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another time period, it is reassigned to the given time periodId.- Parameters:
timePeriodId- theIdof aTimePeriodaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-timePeriodIdnot foundNullArgumentException-timePeriodIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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- theIdof aTimePeriodeventId- an exception eventId- Throws:
AlreadyExistsException- event is already part of the time periodNotFoundException-timePeriodIdoreventIdis not foundNullArgumentException-timePeriodIdoreventIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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- theIdof aTimePeriodeventId- an exception eventId- Throws:
NotFoundException-eventIdnot an exception intimePeriodIdNullArgumentException-timePeriodIdoreventIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-