Interface OfferingAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
OfferingBatchAdminSession
This session creates, updates, and deletes Offerings . The data
for create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create an
Offering , an OfferingForm is requested using
getOfferingFormForCreate() specifying the desired canonical unit, time
period, and record Types or none if no record Types are
needed. The returned OfferingForm 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 OfferingForm is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
OfferingForm corresponds to an attempted transaction.
For updates, OfferingForms are requested to the
Offering Id that is to be updated using
getOfferingFormForUpdate() . Similarly, the OfferingForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The OfferingForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Offerings . To unmap an
Offering from the current Catalogue , the
OfferingCatalogueAssignmentSession should be used. These delete
operations attempt to remove the Offering itself thus removing it
from all known Catalogue catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasOffering(Id offeringId, Id aliasId) Adds anIdto anOfferingfor the purpose of creating compatibility.booleanTests if this user can create offerings.booleancanCreateOfferingWithRecordTypes(Type[] offeringRecordTypes) Tests if this user can create a singleOfferingusing the desired record types.booleanTests if this user can delete offerings.booleanTests if this user can manageIdaliases forOfferings.booleanTests if this user can update offerings.createOffering(OfferingForm offeringForm) Creates a newOffering.voiddeleteOffering(Id offeringId) Deletes anOffering.Gets theCatalogueassociated with this session.Gets theCatalogueIdassociated with this session.getOfferingFormForCreate(Id canonicalUnitId, Id timePeriodId, Type[] offeringRecordTypes) Gets the offering form for creating new offerings.getOfferingFormForUpdate(Id offeringId) Gets the offering form for updating an existing offering.voidupdateOffering(OfferingForm offeringForm) Updates an existing offering.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
-
getCatalogueId
Id getCatalogueId()Gets theCatalogueIdassociated with this session.- Returns:
- the
Catalogue Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCatalogue
Gets theCatalogueassociated with this session.- Returns:
- the catalogue
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateOfferings
boolean canCreateOfferings()Tests if this user can create offerings. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anOfferingwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifOfferingcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateOfferingWithRecordTypes
Tests if this user can create a singleOfferingusing the desired record types. WhileOfferingManager.getOfferingRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificOffering. Providing an empty array tests if anOfferingcan be created with no records.- Parameters:
offeringRecordTypes- array of offering record types- Returns:
trueifOfferingcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-offeringRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getOfferingFormForCreate
OfferingForm getOfferingFormForCreate(Id canonicalUnitId, Id timePeriodId, Type[] offeringRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the offering form for creating new offerings. A new form should be requested for each create transaction.- Parameters:
canonicalUnitId- the canonical unitIdtimePeriodId- the time periodIdofferingRecordTypes- array of offering record types to be included in the create operation or an empty list if none- Returns:
- the offering form
- Throws:
NotFoundException-canonicalUnitIdortimePeriodIdis not foundNullArgumentException-canonicalUnitId, timePeriodId, orofferingRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createOffering
Offering createOffering(OfferingForm offeringForm) throws OperationFailedException, PermissionDeniedException Creates a newOffering.- Parameters:
offeringForm- the form for thisOffering- Returns:
- the new
Offering - Throws:
IllegalStateException-offeringFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-offeringFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-offeringFormdid not originate fromgetOfferingFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateOfferings
boolean canUpdateOfferings()Tests if this user can update offerings. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anOfferingwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifOfferingmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOfferingFormForUpdate
OfferingForm getOfferingFormForUpdate(Id offeringId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the offering form for updating an existing offering. A new offering form should be requested for each update transaction.- Parameters:
offeringId- theIdof theOffering- Returns:
- the offering form
- Throws:
NotFoundException-offeringIdis not foundNullArgumentException-offeringIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateOffering
void updateOffering(OfferingForm offeringForm) throws OperationFailedException, PermissionDeniedException Updates an existing offering.- Parameters:
offeringForm- the form containing the elements to be updated- Throws:
IllegalStateException-offeringFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-offeringFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-offeringFormdid not originate fromgetOfferingFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteOfferings
boolean canDeleteOfferings()Tests if this user can delete offerings. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anOfferingwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifOfferingdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteOffering
void deleteOffering(Id offeringId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anOffering.- Parameters:
offeringId- theIdof theOfferingto remove- Throws:
NotFoundException-offeringIdnot foundNullArgumentException-offeringIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageOfferingAliases
boolean canManageOfferingAliases()Tests if this user can manageIdaliases forOfferings. 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:
falseifOfferingaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasOffering
void aliasOffering(Id offeringId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anOfferingfor the purpose of creating compatibility. The primaryIdof theOfferingis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another offering, it is reassigned to the given offeringId.- Parameters:
offeringId- theIdof anOfferingaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-offeringIdnot foundNullArgumentException-offeringIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-