public interface CreditAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasCredit(Id creditId,
Id aliasId)
Adds an
Id to a Credit for the purpose
of creating compatibility. |
boolean |
canCreateCredits()
Tests if this user can create credits.
|
boolean |
canCreateCreditWithRecordTypes(Type[] creditRecordTypes)
Tests if this user can create a single
Credit using the
desired record types. |
boolean |
canDeleteCredits()
Tests if this user can delete credits.
|
boolean |
canManageCreditAliases()
Tests if this user can manage
Id aliases for
Credits. |
boolean |
canUpdateCredits()
Tests if this user can update credits.
|
Credit |
createCredit(CreditForm creditForm)
Creates a new
Credit. |
void |
deleteCredit(Id creditId)
Deletes a
Credit. |
Billing |
getBilling()
Gets the
Billing associated with this session. |
Id |
getBillingId()
Gets the
Billing Id associated with this
session. |
CreditForm |
getCreditFormForCreate(Id referenceId,
Id resourceId,
Type[] creditRecordTypes)
Gets the credit form for creating new credits.
|
CreditForm |
getCreditFormForUpdate(Id creditId)
Gets the credit form for updating an existing credit.
|
void |
updateCredit(CreditForm creditForm)
Updates an existing credit.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBillingId()
Billing
Id
associated with this
session. Billing Id
associated with this sessionmandatory
- This method must be implemented. Billing getBilling() throws OperationFailedException, PermissionDeniedException
Billing
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateCredits()
Credit
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 Credit
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateCreditWithRecordTypes(Type[] creditRecordTypes)
Credit
using the
desired record types. While
AcknowledgementManager.getCreditRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Credit.
Providing
an empty array tests if a Credit
can be created with no
records.creditRecordTypes
- array of credit record types true
if Credit
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- creditRecordTypes
is null
mandatory
- This method must be implemented. CreditForm getCreditFormForCreate(Id referenceId, Id resourceId, Type[] creditRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
referenceId
- the reference Id
resourceId
- the resource Id
creditRecordTypes
- array of credit record types to be included
in the create operation or an empty list if noneNotFoundException
- referenceId
or
resourceId
is not foundNullArgumentException
- referenceId, resourceId
or creditRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Credit createCredit(CreditForm creditForm) throws OperationFailedException, PermissionDeniedException
Credit.
creditForm
- the form for this Credit
Credit
IllegalStateException
- creditForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- creditForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- creditForm
did
not originate from getCreditFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateCredits()
Credit
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 Credit
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. CreditForm getCreditFormForUpdate(Id creditId) throws NotFoundException, OperationFailedException, PermissionDeniedException
creditId
- the Id
of the Credit
NotFoundException
- creditId
is not
foundNullArgumentException
- creditId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateCredit(CreditForm creditForm) throws OperationFailedException, PermissionDeniedException
creditForm
- the form containing the elements to be updatedIllegalStateException
- creditForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- creditForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- creditForm
did
not originate from getCreditFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteCredits()
Credit
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 Credit
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteCredit(Id creditId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Credit.
creditId
- the Id
of the Credit
to
removeNotFoundException
- creditId
not foundNullArgumentException
- creditId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageCreditAliases()
Id
aliases for
Credits.
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 Credit
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasCredit(Id creditId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Credit
for the purpose
of creating compatibility. The primary Id
of the
Credit
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is
a pointer to another credit, it is reassigned to the given credit
Id.
creditId
- the Id
of a Credit
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- creditId
not foundNullArgumentException
- creditId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.