Interface CreditBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, CreditAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Credits in bulk. 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
getCreditFormsForCreate() specifying the desired reference, resource, and
record Types or none if no record Types are needed. Each
of the returned CreditForms 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 a 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.
The CreditForms returned from
getCreditFormsForCreate() may be linked to the originating request
through the peer Ids of the CreditForm . In the case where
there may be duplicates, any CreditForm of the same peer
Ids may be used for a create operation.
Once a batch of CreditForms are submitted for create, a
CreateResponse is returned for each CreditForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createCredits() , errors specific to
an individual CreditForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
CreditForm through the CreditForm Id .
For updates, CreditForms are requested to the Credit
Id that is to be updated using getCreditFormsForUpdate()
where the reference Id in the CreditForm may be used to
link the request. 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.
Once a batch of CreditForms are submitted for update, an
UpdateResponse is returned for each CreditForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateCredits() , errors specific to
an individual CreditForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
CreditForm through the CreditForm Id .
The delete operations delete Credits in bulk. 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. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasCredits(AliasRequestList aliasRequests) Adds anIdto aCreditfor the purpose of creating compatibility.createCredits(CreditBatchFormList creditForms) Creates a new set ofCredits.Deletes allCreditsin thisBilling.deleteCredits(IdList creditIds) Deletes credits for the givenIds.deleteCreditsForReference(Id referenceId) Deletes credits for the given reference.deleteCreditsForResource(Id resourceId) Deletes credits for the given resource.Deletes credits expired before the given date.getCreditFormsForCreate(CreditPeerList peers, Type[] creditRecordTypes) Gets the credit forms for creating a bunch of new credits.getCreditFormsForUpdate(IdList creditIds) Gets the credit forms for updating an existing set of credits.updateCredits(CreditBatchFormList creditForms) Updates existing credits.Methods inherited from interface CreditAdminSession
aliasCredit, canCreateCredits, canCreateCreditWithRecordTypes, canDeleteCredits, canManageCreditAliases, canUpdateCredits, createCredit, deleteCredit, getBilling, getBillingId, getCreditFormForCreate, getCreditFormForUpdate, updateCreditModifier 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
-
getCreditFormsForCreate
CreditBatchFormList getCreditFormsForCreate(CreditPeerList peers, Type[] creditRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the credit forms for creating a bunch of new credits. A form is returned for each work and resource pair.- Parameters:
peers- the relationship peerscreditRecordTypes- array of credit record types to be included in each create operation or an empty list if none- Returns:
- the credit forms
- Throws:
NotFoundException- aresourceIdis not foundNullArgumentException-peersorcreditRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createCredits
CreateResponseList createCredits(CreditBatchFormList creditForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofCredits. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
creditForms- the credit forms- Returns:
- the create responses
- Throws:
NullArgumentException-creditFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCreditFormsForUpdate
CreditBatchFormList getCreditFormsForUpdate(IdList creditIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the credit forms for updating an existing set of credits. A new credit form should be requested for each update transaction.- Parameters:
creditIds- theIdsof theCredits- Returns:
- the credit forms
- Throws:
NotFoundException- acreditIdis not foundNullArgumentException-creditIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCredits
UpdateResponseList updateCredits(CreditBatchFormList creditForms) throws OperationFailedException, PermissionDeniedException Updates existing credits. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
creditForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-creditFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllCredits
Deletes allCreditsin thisBilling.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCredits
DeleteResponseList deleteCredits(IdList creditIds) throws OperationFailedException, PermissionDeniedException Deletes credits for the givenIds.- Parameters:
creditIds- theIdsof the credits to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-creditIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCreditsForReference
DeleteResponseList deleteCreditsForReference(Id referenceId) throws OperationFailedException, PermissionDeniedException Deletes credits for the given reference.- Parameters:
referenceId- theIdof a reference- Returns:
- the delete responses
- Throws:
NullArgumentException-referenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCreditsForResource
DeleteResponseList deleteCreditsForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes credits for the given resource.- Parameters:
resourceId- theIdof a resource- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveCreditsByDate
DeleteResponseList deleteIneffectiveCreditsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes credits expired before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasCredits
AliasResponseList aliasCredits(AliasRequestList aliasRequests) throws 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 entryId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-