Interface CreditAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CreditBatchAdminSession
This session creates, updates, and deletes Credits . 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
Credit , a CreditForm is requested using
getCreditFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned CreditForm 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 CreditForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each CreditForm corresponds to
an attempted transaction.
For updates, CreditForms are requested to the Credit
Id that is to be updated using getCreditFormForUpdate() .
Similarly, the CreditForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
CreditForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Credits . To unmap a
Credit from the current Billing , the
CreditBillingAssignmentSession should be used. These delete operations
attempt to remove the Credit itself thus removing it from all
known Billing catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasCredit(Id creditId, Id aliasId) Adds anIdto aCreditfor the purpose of creating compatibility.booleanTests if this user can create credits.booleancanCreateCreditWithRecordTypes(Type[] creditRecordTypes) Tests if this user can create a singleCreditusing the desired record types.booleanTests if this user can delete credits.booleanTests if this user can manageIdaliases forCredits.booleanTests if this user can update credits.createCredit(CreditForm creditForm) Creates a newCredit.voiddeleteCredit(Id creditId) Deletes aCredit.Gets theBillingassociated with this session.Gets theBillingIdassociated with this session.getCreditFormForCreate(Id referenceId, Id resourceId, Type[] creditRecordTypes) Gets the credit form for creating new credits.getCreditFormForUpdate(Id creditId) Gets the credit form for updating an existing credit.voidupdateCredit(CreditForm creditForm) Updates an existing credit.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
-
getBillingId
Id getBillingId()Gets theBillingIdassociated with this session.- Returns:
- the
Billing Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBilling
Gets theBillingassociated with this session.- Returns:
- the billing
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateCredits
boolean canCreateCredits()Tests if this user can create credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aCreditwill 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:
falseifCreditcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCreditWithRecordTypes
Tests if this user can create a singleCreditusing the desired record types. WhileAcknowledgementManager.getCreditRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificCredit. Providing an empty array tests if aCreditcan be created with no records.- Parameters:
creditRecordTypes- array of credit record types- Returns:
trueifCreditcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-creditRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getCreditFormForCreate
CreditForm getCreditFormForCreate(Id referenceId, Id resourceId, Type[] creditRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the credit form for creating new credits. A new form should be requested for each create transaction.- Parameters:
referenceId- the referenceIdresourceId- the resourceIdcreditRecordTypes- array of credit record types to be included in the create operation or an empty list if none- Returns:
- the credit form
- Throws:
NotFoundException-referenceIdorresourceIdis not foundNullArgumentException-referenceId, resourceIdorcreditRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createCredit
Credit createCredit(CreditForm creditForm) throws OperationFailedException, PermissionDeniedException Creates a newCredit.- Parameters:
creditForm- the form for thisCredit- Returns:
- the new
Credit - Throws:
IllegalStateException-creditFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-creditFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-creditFormdid not originate fromgetCreditFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCredits
boolean canUpdateCredits()Tests if this user can update credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aCreditwill 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:
falseifCreditmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCreditFormForUpdate
CreditForm getCreditFormForUpdate(Id creditId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the credit form for updating an existing credit. A new credit form should be requested for each update transaction.- Parameters:
creditId- theIdof theCredit- Returns:
- the credit form
- Throws:
NotFoundException-creditIdis not foundNullArgumentException-creditIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCredit
Updates an existing credit.- Parameters:
creditForm- the form containing the elements to be updated- Throws:
IllegalStateException-creditFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-creditFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-creditFormdid not originate fromgetCreditFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCredits
boolean canDeleteCredits()Tests if this user can delete credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anCreditwill 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:
falseifCreditdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteCredit
void deleteCredit(Id creditId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aCredit.- Parameters:
creditId- theIdof theCreditto remove- Throws:
NotFoundException-creditIdnot foundNullArgumentException-creditIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCreditAliases
boolean canManageCreditAliases()Tests if this user can manageIdaliases forCredits. 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:
falseifCreditaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasCredit
void aliasCredit(Id creditId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aCreditfor the purpose of creating compatibility. The primaryIdof theCreditis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another credit, it is reassigned to the given creditId.- Parameters:
creditId- theIdof aCreditaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-creditIdnot foundNullArgumentException-creditIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-