Interface MySubscriptionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates and removes subscriptions foe the authenticated
Agent . The data for create and update is provided by the consumer
via the form object.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can create hournal entries.booleancanSubscribeWithRecordTypes(Type[] subscriptionRecordTypes) Tests if this user can create a singleSubscriptionusing the desired record types.booleanTests if this user can delete their own subscriptions.booleanTests if this user can update subscriptions.Gets thePublisherassociated with this session.Gets thePublisherIdassociated with this session.getSubscriptionFormForCreate(Id dispatchId, Type[] subscriptionRecordTypes) Gets the subscription form for creating new entries.getSubscriptionFormForUpdate(Id subscriptionId) Gets the subscription form for updating an existing subscription.subscribe(SubscriptionForm subscriptionForm) Creates a newSubscription.voidunsubscribe(Id subscriptionId) Deletes anSubscription.voidupdateMySubscription(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.
-
canSubscribe
boolean canSubscribe()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.
-
canSubscribeWithRecordTypes
Tests if this user can create a singleSubscriptionusing the desired record types. WhileSubscriptionManager.getSubscriptionRecordTypes()can be used to examine which records 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, 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 dispatchsubscriptionRecordTypes- array of subscription record types- Returns:
- the subscription form
- Throws:
NotFoundException-dispatchIdis not foundNullArgumentException-dispatchIdorsubscriptionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested recod types- Compliance:
mandatory- This method must be implemented.
-
subscribe
Subscription subscribe(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-subscriptionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-subscriptionFormdid not originate fromgetSubscriptionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateMySubscriptions
boolean canUpdateMySubscriptions()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 found for this userNullArgumentException-subscriptionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateMySubscription
void updateMySubscription(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.
-
canUnsubscribe
boolean canUnsubscribe()Tests if this user can delete their own 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.
-
unsubscribe
void unsubscribe(Id subscriptionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anSubscription.- Parameters:
subscriptionId- theIdof theSubscriptionto remove- Throws:
NotFoundException-subscribernot subscribedto subscriptionIdNullArgumentException-subscriptionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-