public interface OfferingAdminSession extends OsidSession
This session creates, updates, and deletes Offerings.
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 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.
Modifier and Type | Method and Description |
---|---|
void |
aliasOffering(Id offeringId,
Id aliasId)
Adds an
Id to an Offering for the
purpose of creating compatibility. |
boolean |
canCreateOfferings()
Tests if this user can create offerings.
|
boolean |
canCreateOfferingWithRecordTypes(Type[] offeringRecordTypes)
Tests if this user can create a single
Offering using
the desired record types. |
boolean |
canDeleteOfferings()
Tests if this user can delete offerings.
|
boolean |
canManageOfferingAliases()
Tests if this user can manage
Id aliases for
Offerings. |
boolean |
canUpdateOfferings()
Tests if this user can update offerings.
|
Offering |
createOffering(OfferingForm offeringForm)
Creates a new
Offering. |
void |
deleteOffering(Id offeringId)
Deletes an
Offering. |
Catalogue |
getCatalogue()
Gets the
Catalogue associated with this session. |
Id |
getCatalogueId()
Gets the
Catalogue Id associated with
this session. |
OfferingForm |
getOfferingFormForCreate(Id canonicalUnitId,
Id timePeriodId,
Type[] offeringRecordTypes)
Gets the offering form for creating new offerings.
|
OfferingForm |
getOfferingFormForUpdate(Id offeringId)
Gets the offering form for updating an existing offering.
|
void |
updateOffering(OfferingForm offeringForm)
Updates an existing offering.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCatalogueId()
Catalogue
Id
associated with
this session. Catalogue Id
associated with this sessionmandatory
- This method must be implemented. Catalogue getCatalogue() throws OperationFailedException, PermissionDeniedException
Catalogue
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateOfferings()
Offering
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer create operations to
unauthorized users. false
if Offering
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateOfferingWithRecordTypes(Type[] offeringRecordTypes)
Offering
using
the desired record types. While
OfferingManager.getOfferingRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Offering.
Providing an empty array tests if an Offering
can be
created with no records.offeringRecordTypes
- array of offering record types true
if Offering
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- offeringRecordTypes
is null
mandatory
- This method must be implemented. OfferingForm getOfferingFormForCreate(Id canonicalUnitId, Id timePeriodId, Type[] offeringRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
canonicalUnitId
- the canonical unit Id
timePeriodId
- the time period Id
offeringRecordTypes
- array of offering record types to be
included in the create operation or an empty list if noneNotFoundException
- canonicalUnitId
or
timePeriodId
is not foundNullArgumentException
- canonicalUnitId,
timePeriodId
, or offeringRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Offering createOffering(OfferingForm offeringForm) throws OperationFailedException, PermissionDeniedException
Offering.
offeringForm
- the form for this Offering
Offering
IllegalStateException
- offeringForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- offeringForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- offeringForm
did
not originate from getOfferingFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateOfferings()
Offering
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer update operations to
unauthorized users. false
if Offering
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. OfferingForm getOfferingFormForUpdate(Id offeringId) throws NotFoundException, OperationFailedException, PermissionDeniedException
offeringId
- the Id
of the Offering
NotFoundException
- offeringId
is not
foundNullArgumentException
- offeringId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateOffering(OfferingForm offeringForm) throws OperationFailedException, PermissionDeniedException
offeringForm
- the form containing the elements to be updatedIllegalStateException
- offeringForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- offeringForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- offeringForm
did
not originate from getOfferingFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteOfferings()
Offering
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer delete operations to
unauthorized users. false
if Offering
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteOffering(Id offeringId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Offering.
offeringId
- the Id
of the Offering
to removeNotFoundException
- offeringId
not foundNullArgumentException
- offeringId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageOfferingAliases()
Id
aliases for
Offerings.
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 Offering
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasOffering(Id offeringId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Offering
for the
purpose of creating compatibility. The primary Id
of
the Offering
is determined by the provider. The new
Id
is an alias to the primary Id.
If the
alias is a pointer to another offering, it is reassigned to the given
offering Id.
offeringId
- the Id
of an Offering
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- offeringId
not foundNullArgumentException
- offeringId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.