public interface CustomerAdminSession extends OsidSession
This session creates, updates, and deletes Customers.
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
Customer, a CustomerForm is requested using
getCustomerFormForCreate() specifying the desired resource and
record Types or none if no record Types are
needed. The returned CustomerForm 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 CustomerForm is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each
CustomerForm corresponds to an attempted transaction.
For updates, CustomerForms are requested to the
Customer Id that is to be updated using
getCustomerFormForUpdate(). Similarly, the CustomerForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The CustomerForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Customers. To unmap a
Customer from the current Business, the
CustomerBusinessAssignmentSession should be used. These
delete operations attempt to remove the Customer itself
thus removing it from all known Business 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 |
aliasCustomer(Id customerId,
Id aliasId)
Adds an
Id to a Customer for the purpose
of creating compatibility. |
boolean |
canCreateCustomers()
Tests if this user can create
Customers. |
boolean |
canCreateCustomerWithRecordTypes(Type[] customerRecordTypes)
Tests if this user can create a single
Customer using
the desired record types. |
boolean |
canDeleteCustomers()
Tests if this user can delete
Customers. |
boolean |
canManageCustomerAliases()
Tests if this user can manage
Id aliases for
Customers. |
boolean |
canUpdateCustomers()
Tests if this user can update
Customers. |
Customer |
createCustomer(CustomerForm customerForm)
Creates a new
Customer. |
void |
deleteCustomer(Id customerId)
Deletes a
Customer. |
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
CustomerForm |
getCustomerFormForCreate(Id resourceId,
Type[] customerRecordTypes)
Gets the customer form for creating new customers.
|
CustomerForm |
getCustomerFormForUpdate(Id customerId)
Gets the customer form for updating an existing customer.
|
void |
updateCustomer(CustomerForm customerForm)
Updates an existing customer.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getBusinessId()
Business Id associated with
this session. Business Id associated with this sessionmandatory - This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateCustomers()
Customers. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Customer will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false if Customer creation is
not authorized, true otherwisemandatory - This method must be implemented. boolean canCreateCustomerWithRecordTypes(Type[] customerRecordTypes)
Customer using
the desired record types. While
BillingManager.getCustomerRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Customer. Providing an
empty array tests if a Customer can be created with no
records.customerRecordTypes - array of customer record types true if Customer creation using
the specified record Types is supported,
false otherwiseNullArgumentException - customerRecordTypes
is null mandatory - This method must be implemented. CustomerForm getCustomerFormForCreate(Id resourceId, Type[] customerRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
resourceId - a resource Id customerRecordTypes - array of customer record typesNotFoundException - resourceId is not
foundNullArgumentException - customerRecordTypes
or resourceId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Customer createCustomer(CustomerForm customerForm) throws OperationFailedException, PermissionDeniedException
Customer. customerForm - the form for this Customer Customer IllegalStateException - customerForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - customerForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - customerForm did not
originate from getCustomerFormForCreate() mandatory - This method must be implemented. boolean canUpdateCustomers()
Customers. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Customer will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false if Customer modification
is not authorized, true otherwisemandatory - This method must be implemented. CustomerForm getCustomerFormForUpdate(Id customerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
customerId - the Id of the Customer
NotFoundException - customerId is not
foundNullArgumentException - customerId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateCustomer(CustomerForm customerForm) throws OperationFailedException, PermissionDeniedException
customerForm - the form containing the elements to be updatedIllegalStateException - customerForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - customerForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - customerForm did not
originate from getCustomerFormForUpdate() mandatory - This method must be implemented. boolean canDeleteCustomers()
Customers. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Customer will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false if Customer deletion is
not authorized, true otherwisemandatory - This method must be implemented. void deleteCustomer(Id customerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Customer. customerId - the Id of the Customer
to removeNotFoundException - customerId not foundNullArgumentException - customerId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageCustomerAliases()
Id aliases for
Customers. 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 Customer aliasing is
not authorized, true otherwisemandatory - This method must be implemented. void aliasCustomer(Id customerId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Customer for the purpose
of creating compatibility. The primary Id of the
Customer is determined by the provider. The new Id
performs as an alias to the primary Id. If the
alias is a pointer to another customer, it is reassigned to the given
customer Id. customerId - the Id of a Customer aliasId - the alias Id AlreadyExistsException - aliasId is in
use as a primary Id NotFoundException - customerId not foundNullArgumentException - customerId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.