Interface PeriodAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
PeriodBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasPeriod(Id periodId, Id aliasId) Adds anIdto aPeriodfor the purpose of creating compatibility.booleanTests if this user can createPeriods.booleancanCreatePeriodWithRecordTypes(Type[] periodRecordTypes) Tests if this user can create a singlePeriodusing the desired record types.booleanTests if this user can deletePeriods.booleanTests if this user can manageIdaliases forPeriods.booleanTests if this user can updatePeriods.createPeriod(PeriodForm periodForm) Creates a newPeriod.voiddeletePeriod(Id periodId) Deletes aPeriod.Gets theBusinessassociated with this session.Gets theBusinessIdassociated with this session.getPeriodFormForCreate(Type[] periodRecordTypes) Gets the period form for creating new periods.getPeriodFormForUpdate(Id periodId) Gets the period form for updating an existing period.voidupdatePeriod(PeriodForm periodForm) Updates an existing 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
-
getBusinessId
Id getBusinessId()Gets theBusinessIdassociated with this session.- Returns:
- the
Business Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBusiness
Gets theBusinessassociated with this session.- Returns:
- the business
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreatePeriods
boolean canCreatePeriods()Tests if this user can createPeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPeriodwill 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:
falseifPeriodcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePeriodWithRecordTypes
Tests if this user can create a singlePeriodusing the desired record types. WhileBillingManager.getPeriodRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPeriod. Providing an empty array tests if aPeriodcan be created with no records.- Parameters:
periodRecordTypes- array of period record types- Returns:
trueifPeriodcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-periodRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPeriodFormForCreate
PeriodForm getPeriodFormForCreate(Type[] periodRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the period form for creating new periods. A new form should be requested for each create transaction.- Parameters:
periodRecordTypes- array of period record types- Returns:
- the period form
- Throws:
NullArgumentException-periodRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createPeriod
Period createPeriod(PeriodForm periodForm) throws OperationFailedException, PermissionDeniedException Creates a newPeriod.- Parameters:
periodForm- the form for thisPeriod- Returns:
- the new
Period - Throws:
IllegalStateException-periodFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-periodFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-periodFormdid not originate fromgetPeriodFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePeriods
boolean canUpdatePeriods()Tests if this user can updatePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPeriodwill 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:
falseifPeriodmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getPeriodFormForUpdate
PeriodForm getPeriodFormForUpdate(Id periodId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the period form for updating an existing period. A new period form should be requested for each update transaction.- Parameters:
periodId- theIdof thePeriod- Returns:
- the period form
- Throws:
NotFoundException-periodIdis not foundNullArgumentException-periodIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePeriod
Updates an existing period.- Parameters:
periodForm- the form containing the elements to be updated- Throws:
IllegalStateException-periodFormalready used in anjupdate transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-periodIdorperiodFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-periodFormdid not originate fromgetPeriodFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePeriods
boolean canDeletePeriods()Tests if this user can deletePeriods. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aPeriodwill 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:
falseifPerioddeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deletePeriod
void deletePeriod(Id periodId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aPeriod.- Parameters:
periodId- theIdof thePeriodto remove- Throws:
NotFoundException-periodIdnot foundNullArgumentException-periodIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePeriodAliases
boolean canManagePeriodAliases()Tests if this user can manageIdaliases forPeriods. 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:
falseifPeriodaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPeriod
void aliasPeriod(Id periodId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPeriodfor the purpose of creating compatibility. The primaryIdof thePeriodis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another period, it is reassigned to the given periodId.- Parameters:
periodId- theIdof aPeriodaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-periodIdnot foundNullArgumentException-periodIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-