public interface PeriodAdminSession extends OsidSession
This session creates, updates, and deletes 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
period, a PeriodForm is requested using
getPeriodFormForCreate() specifying the desired relationship peers
and record Types or none if no record Types
are needed. The returned PeriodForm 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 PeriodForm is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
PeriodForm corresponds to an attempted transaction.
For updates, PeriodForms are requested to the
Period Id that is to be updated using
getPeriodFormForUpdate(). Similarly, the PeriodForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The PeriodForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Periods. To unmap a
Period from the current Business, the
PeriodBusinessAssignmentSession should be used. These delete
operations attempt to remove the Period itself thus
removing it from all known Business 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 |
aliasPeriod(Id periodId,
Id aliasId)
Adds an
Id to a Period for the purpose
of creating compatibility. |
boolean |
canCreatePeriods()
Tests if this user can create
Periods. |
boolean |
canCreatePeriodWithRecordTypes(Type[] periodRecordTypes)
Tests if this user can create a single
Period using the
desired record types. |
boolean |
canDeletePeriods()
Tests if this user can delete
Periods. |
boolean |
canManagePeriodAliases()
Tests if this user can manage
Id aliases for
Periods. |
boolean |
canUpdatePeriods()
Tests if this user can update
Periods. |
Period |
createPeriod(PeriodForm periodForm)
Creates a new
Period. |
void |
deletePeriod(Id periodId)
Deletes a
Period. |
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
PeriodForm |
getPeriodFormForCreate(Type[] periodRecordTypes)
Gets the period form for creating new periods.
|
PeriodForm |
getPeriodFormForUpdate(Id periodId)
Gets the period form for updating an existing period.
|
void |
updatePeriod(PeriodForm periodForm)
Updates an existing period.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getBusinessId()
Business Id associated with
this session. Business Id associated with this sessionmandatory - This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreatePeriods()
Periods. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Period 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 Period creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreatePeriodWithRecordTypes(Type[] periodRecordTypes)
Period using the
desired record types. While
BillingManager.getPeriodRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Period. Providing an
empty array tests if a Period can be created with no
records.periodRecordTypes - array of period record types true if Period creation using
the specified record Types is supported,
false otherwiseNullArgumentException - periodRecordTypes
is null mandatory - This method must be implemented. PeriodForm getPeriodFormForCreate(Type[] periodRecordTypes) throws OperationFailedException, PermissionDeniedException
periodRecordTypes - array of period record typesNullArgumentException - periodRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Period createPeriod(PeriodForm periodForm) throws OperationFailedException, PermissionDeniedException
Period. periodForm - the form for this Period Period IllegalStateException - periodForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - periodForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - periodForm did
not originate from getPeriodFormForCreate() mandatory - This method must be implemented. boolean canUpdatePeriods()
Periods. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Period 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 Period modification is
not authorized, true otherwisemandatory - This method must be implemented. PeriodForm getPeriodFormForUpdate(Id periodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
periodId - the Id of the Period NotFoundException - periodId is not
foundNullArgumentException - periodId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updatePeriod(PeriodForm periodForm) throws OperationFailedException, PermissionDeniedException
periodForm - the form containing the elements to be updatedIllegalStateException - periodForm
already used in anjupdate transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - periodId or
periodForm is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - periodForm did
not originate from getPeriodFormForUpdate() mandatory - This method must be implemented. boolean canDeletePeriods()
Periods. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Period 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 Period deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deletePeriod(Id periodId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Period. periodId - the Id of the Period to
removeNotFoundException - periodId not foundNullArgumentException - periodId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManagePeriodAliases()
Id aliases for
Periods. 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 Period aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasPeriod(Id periodId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Period for the purpose
of creating compatibility. The primary Id of the
Period is determined by the provider. The new Id
performs as an alias to the primary Id . If the
alias is a pointer to another period, it is reassigned to the given
period Id. periodId - the Id of a Period aliasId - the alias Id AlreadyExistsException - aliasId is in
use as a primary Id NotFoundException - periodId not foundNullArgumentException - periodId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.