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.
Modifier and Type | Method and Description |
---|---|
void |
addExceptionEvent(Id timePeriodId,
Id eventId)
Adds an exception event to a time period.
|
void |
aliasTimePeriod(Id timePeriodId,
Id aliasId)
Adds an
Id to a TimePeriod for the
purpose of creating compatibility. |
boolean |
canCreateTimePeriods()
Tests if this user can create
TimePeriods. |
boolean |
canCreateTimePeriodWithRecordTypes(Type[] timePeriodRecordTypes)
Tests if this user can create a single
TimePeriod using
the desired record types. |
boolean |
canDeleteTimePeriods()
Tests if this user can delete
TimePeriods. |
boolean |
canManageTimePeriodAliases()
Tests if this user can manage
Id aliases for
TimePeriods. |
boolean |
canUpdateTimePeriods()
Tests if this user can update
TimePeriods. |
TimePeriod |
createTimePeriod(TimePeriodForm timePeriodForm)
Creates a new
TimePeriod. |
void |
deleteTimePeriod(Id timePeriodId)
Deletes the
TimePeriod identified by the given
Id. |
Calendar |
getCalendar()
Gets the
Calendar associated with this session. |
Id |
getCalendarId()
Gets the
Calendar Id associated with
this session. |
TimePeriodForm |
getTimePeriodFormForCreate(Type[] timePeriodRecordTypes)
Gets the time period form for creating new time periods.
|
TimePeriodForm |
getTimePeriodFormForUpdate(Id timePeriodId)
Gets the time period form for updating an existing time period.
|
void |
removeExceptionEvent(Id timePeriodId,
Id eventId)
Removes an exception event from a time period.
|
void |
updateTimePeriod(TimePeriodForm timePeriodForm)
Updates an existing tiem period.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCalendarId()
Calendar
Id
associated with
this session. Calendar Id
associated with this sessionmandatory
- This method must be implemented. Calendar getCalendar() throws OperationFailedException, PermissionDeniedException
Calendar
associated with this session. Calendar
associated with this sessionOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateTimePeriods()
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. false
if TimePeriod
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateTimePeriodWithRecordTypes(Type[] timePeriodRecordTypes)
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.timePeriodRecordTypes
- array of time period record types true
if TimePeriod
creation
using the specified record Types
is supported,
false
otherwiseNullArgumentException
- timePeriodRecordTypes
is null
mandatory
- This method must be implemented. TimePeriodForm getTimePeriodFormForCreate(Type[] timePeriodRecordTypes) throws OperationFailedException, PermissionDeniedException
timePeriodRecordTypes
- array of time period record typesNullArgumentException
- timePeriodRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. TimePeriod createTimePeriod(TimePeriodForm timePeriodForm) throws OperationFailedException, PermissionDeniedException
TimePeriod.
timePeriodForm
- the forms for this TimePeriod
TimePeriod
IllegalStateException
- timePeriodForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- timePeriodForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- timePeriodForm
did not originate from getTimePeriodForCreate()
mandatory
- This method must be implemented. boolean canUpdateTimePeriods()
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. false
if time period modification is not
authorized, true
otherwisemandatory
- This method must be implemented. TimePeriodForm getTimePeriodFormForUpdate(Id timePeriodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
timePeriodId
- the Id
of the TimePeriod
NotFoundException
- timePeriodId
is not
foundNullArgumentException
- timePeriodid
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateTimePeriod(TimePeriodForm timePeriodForm) throws OperationFailedException, PermissionDeniedException
timePeriodForm
- the form containing the elements to be updatedIllegalStateException
- timePeriodForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- timePeriodForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- timePeriodForm
did not originate from getTimePeriodForUpdate()
mandatory
- This method must be implemented. boolean canDeleteTimePeriods()
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. false
if TimePeriod
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteTimePeriod(Id timePeriodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
TimePeriod
identified by the given
Id.
timePeriodId
- the Id
of the TimePeriod
to deleteNotFoundException
- a TimePeriod
was not
found identified by the given Id
NullArgumentException
- timePeriodId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageTimePeriodAliases()
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. false
if TimePeriod
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasTimePeriod(Id timePeriodId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
timePeriodId
- the Id
of a TimePeriod
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- timePeriodId
not
foundNullArgumentException
- timePeriodId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void addExceptionEvent(Id timePeriodId, Id eventId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
timePeriodId
- the Id
of a TimePeriod
eventId
- an exception event Id
AlreadyExistsException
- event is already part of the
time periodNotFoundException
- timePeriodId
or
eventId
is not foundNullArgumentException
- timePeriodId
or
eventId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void removeExceptionEvent(Id timePeriodId, Id eventId) throws NotFoundException, OperationFailedException, PermissionDeniedException
timePeriodId
- the Id
of a TimePeriod
eventId
- an exception event Id
NotFoundException
- eventId
not an
exception in timePeriodId
NullArgumentException
- timePeriodId
or
eventId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.