Interface SubscriptionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
SubscriptionBatchAdminSession
This session creates, updates, and deletes Subscriptions . 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 a
Subscription , a SubscriptionForm is requested using
getSubscriptionFormForCreate() specifying the desired relationship peers
and record Types or none if no record Types are needed.
The returned SubscriptionForm 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 SubscriptionForm is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each SubscriptionForm
corresponds to an attempted transaction.
For updates, SubscriptionForms are requested to the
Subscription Id that is to be updated using
getSubscriptionFormForUpdate() . Similarly, the SubscriptionForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The SubscriptionForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Subscriptions . To unmap a
Subscription from the current Publisher , the
SubscriptionPublisherAssignmentSession should be used. These delete
operations attempt to remove the Subscription itself thus removing
it from all known Publisher catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasSubscription(Id subscriptionId, Id aliasId) Adds anIdto aSubscriptionfor the purpose of creating compatibility.booleanTests if this user can create hournal entries.booleancanCreateSubscriptionWithRecordTypes(Type[] subscriptionRecordTypes) Tests if this user can create a singleSubscriptionusing the desired record interface types.booleanTests if this user can delete subscriptions.booleanTests if this user can manageIdaliases forComnents.booleanTests if this user can update subscriptions.createSubscription(SubscriptionForm subscriptionForm) Creates a newSubscription.voiddeleteSubscription(Id subscriptionId) Deletes anSubscription.Gets thePublisherassociated with this session.Gets thePublisherIdassociated with this session.getSubscriptionFormForCreate(Id dispatchId, Id resourceId, Type[] subscriptionRecordTypes) Gets the subscription form for creating new entries.getSubscriptionFormForUpdate(Id subscriptionId) Gets the subscription form for updating an existing subscription.voidupdateSubscription(SubscriptionForm subscriptionForm) Updates an existing subscription.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
-
getPublisherId
Id getPublisherId()Gets thePublisherIdassociated with this session.- Returns:
- the
Publisher Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getPublisher
Gets thePublisherassociated with this session.- Returns:
- the publisher
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateSubscriptions
boolean canCreateSubscriptions()Tests if this user can create hournal entries. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aSubscriptionwill 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:
falseifSubscriptioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateSubscriptionWithRecordTypes
Tests if this user can create a singleSubscriptionusing the desired record interface types. WhileSubscriptionManager.getSubscriptionRecordTypes()can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specificSubscription. Providing an empty array tests if aSubscriptioncan be created with no records.- Parameters:
subscriptionRecordTypes- array of subscription record types- Returns:
trueifSubscriptioncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-subscriptionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getSubscriptionFormForCreate
SubscriptionForm getSubscriptionFormForCreate(Id dispatchId, Id resourceId, Type[] subscriptionRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the subscription form for creating new entries. A new form should be requested for each create transaction.- Parameters:
dispatchId- theIdfor the dispatchresourceId- theIdfor the resourcesubscriptionRecordTypes- array of subscription record types- Returns:
- the subscription form
- Throws:
NotFoundException-dispatchIdorresourceIdis not foundNullArgumentException-dispatchId, resourceId, orsubscriptionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get from for requested record types- Compliance:
mandatory- This method must be implemented.
-
createSubscription
Subscription createSubscription(SubscriptionForm subscriptionForm) throws OperationFailedException, PermissionDeniedException Creates a newSubscription.- Parameters:
subscriptionForm- the form for thisSubscription- Returns:
- the new
Subscription - Throws:
IllegalStateException-subscriptionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-subscriptionFormdid not originate fromgetSubscriptionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateSubscriptions
boolean canUpdateSubscriptions()Tests if this user can update subscriptions. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aSubscriptionwill 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:
falseifSubscriptionmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getSubscriptionFormForUpdate
SubscriptionForm getSubscriptionFormForUpdate(Id subscriptionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the subscription form for updating an existing subscription. A new subscription form should be requested for each update transaction.- Parameters:
subscriptionId- theIdof theSubscription- Returns:
- the subscription form
- Throws:
NotFoundException-subscriptionIdis not foundNullArgumentException-subscriptionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateSubscription
void updateSubscription(SubscriptionForm subscriptionForm) throws OperationFailedException, PermissionDeniedException Updates an existing subscription.- Parameters:
subscriptionForm- the form containing the elements to be updated- Throws:
IllegalStateException-subscriptionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-subscriptionIdorsubscriptionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-subscriptionFormdid not originate fromgetSubscriptionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteSubscriptions
boolean canDeleteSubscriptions()Tests if this user can delete subscriptions. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anSubscriptionwill 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:
falseifSubscriptiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteSubscription
void deleteSubscription(Id subscriptionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anSubscription.- Parameters:
subscriptionId- theIdof theSubscriptionto remove- Throws:
NotFoundException-subscriptionIdnot foundNullArgumentException-subscriptionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageSubscriptionAliases
boolean canManageSubscriptionAliases()Tests if this user can manageIdaliases forComnents. 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:
falseifSubscriptionaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasSubscription
void aliasSubscription(Id subscriptionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aSubscriptionfor the purpose of creating compatibility. The primaryIdof theSubscriptionis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another subscription, it is reassigned to the given subscriptionId.- Parameters:
subscriptionId- theIdof aSubscriptionaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-subscriptionIdnot foundNullArgumentException-subscriptionIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-