public interface BillingAdminSession extends OsidSession
This session creates, updates, and deletes Billings.
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
Billing,
a BillingForm
is requested using
getBillingFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned BillingForm
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 BillingForm
is submiited
to a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each BillingForm
corresponds to an attempted transaction.
For updates, BillingForms
are requested to the
Billing
Id
that is to be updated using
getBillingFormForUpdate().
Similarly, the BillingForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The BillingForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Billings.
It is safer to
remove all mappings to the Billing
catalogs before
deletion.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasBilling(Id billingId,
Id aliasId)
Adds an
Id to a Billing for the purpose
of creating compatibility. |
boolean |
canCreateBillings()
Tests if this user can create
Billings. |
boolean |
canCreateBillingWithRecordTypes(Type[] billingRecordTypes)
Tests if this user can create a single
Billing using
the desired record types. |
boolean |
canDeleteBillings()
Tests if this user can delete
Billings A return of true
does not guarantee successful authorization. |
boolean |
canManageBillingAliases()
Tests if this user can manage
Id aliases for
Billings. |
boolean |
canUpdateBillings()
Tests if this user can update
Billings. |
Billing |
createBilling(BillingForm billingForm)
Creates a new
Billing. |
void |
deleteBilling(Id billingId)
Deletes a
Billing. |
BillingForm |
getBillingFormForCreate(Type[] billingRecordTypes)
Gets the billing form for creating new billings.
|
BillingForm |
getBillingFormForUpdate(Id billingId)
Gets the billing form for updating an existing billing.
|
void |
updateBilling(BillingForm billingForm)
Updates an existing billing.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateBillings()
Billings.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Billing
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 Billing
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateBillingWithRecordTypes(Type[] billingRecordTypes)
Billing
using
the desired record types. While
AcknowledgementManager.getBillingRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Billing.
Providing
an empty array tests if a Billing
can be created with
no records.billingRecordTypes
- array of types true
if Billing
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- billingRecordTypes
is null
mandatory
- This method must be implemented. BillingForm getBillingFormForCreate(Type[] billingRecordTypes) throws OperationFailedException, PermissionDeniedException
billingRecordTypes
- array of typesNullArgumentException
- billingRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Billing createBilling(BillingForm billingForm) throws OperationFailedException, PermissionDeniedException
Billing.
billingForm
- the form for this Billing
Billing
IllegalStateException
- billingForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- billingForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- billingForm
did
not originate from getBillingFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateBillings()
Billings.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Billing
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 Billing
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. BillingForm getBillingFormForUpdate(Id billingId) throws NotFoundException, OperationFailedException, PermissionDeniedException
billingId
- the Id
of the Billing
NotFoundException
- billingId
is not
foundNullArgumentException
- billingId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateBilling(BillingForm billingForm) throws OperationFailedException, PermissionDeniedException
billingForm
- the form containing the elements to be updatedIllegalStateException
- billingForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- billingForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- billingForm did not
originate from getBillingFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteBillings()
Billings
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Billing
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 Billing
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteBilling(Id billingId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Billing.
billingId
- the Id
of the Billing
to removeNotFoundException
- billingId
not foundNullArgumentException
- billingId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageBillingAliases()
Id
aliases for
Billings.
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 Billing
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasBilling(Id billingId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Billing
for the purpose
of creating compatibility. The primary Id
of the
Item
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is a
pointer to another billing, it is reassigned to the given billing
Id.
billingId
- the Id
of a Billing
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- billingId
not foundNullArgumentException
- billingId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.