Interface CustomerAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CustomerBatchAdminSession
This session creates, updates, and deletes Customers . The data
for create and update is provided by the consumer via the form.
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasCustomer(Id customerId, Id aliasId) Adds anIdto aCustomerfor the purpose of creating compatibility.booleanTests if this user can createCustomers.booleancanCreateCustomerWithRecordTypes(Type[] customerRecordTypes) Tests if this user can create a singleCustomerusing the desired record types.booleanTests if this user can deleteCustomers.booleanTests if this user can manageIdaliases forCustomers.booleanTests if this user can updateCustomers.createCustomer(CustomerForm customerForm) Creates a newCustomer.voiddeleteCustomer(Id customerId) Deletes aCustomer.Gets theBusinessassociated with this session.Gets theBusinessIdassociated with this session.getCustomerFormForCreate(Id resourceId, Type[] customerRecordTypes) Gets the customer form for creating new customers.getCustomerFormForUpdate(Id customerId) Gets the customer form for updating an existing customer.voidupdateCustomer(CustomerForm customerForm) Updates an existing customer.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
-
getBusinessId
Id getBusinessId()Gets theBusinessIdassociated with this session.- Returns:
- the
Business Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBusiness
Gets theBusinessassociated with this session.- Returns:
- the business
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateCustomers
boolean canCreateCustomers()Tests if this user can createCustomers. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aCustomerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifCustomercreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCustomerWithRecordTypes
Tests if this user can create a singleCustomerusing the desired record types. WhileBillingManager.getCustomerRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificCustomer. Providing an empty array tests if aCustomercan be created with no records.- Parameters:
customerRecordTypes- array of customer record types- Returns:
trueifCustomercreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-customerRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getCustomerFormForCreate
CustomerForm getCustomerFormForCreate(Id resourceId, Type[] customerRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the customer form for creating new customers. A new form should be requested for each create transaction.- Parameters:
resourceId- a resourceIdcustomerRecordTypes- array of customer record types- Returns:
- the customer form
- Throws:
NotFoundException-resourceIdis not foundNullArgumentException-customerRecordTypesorresourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createCustomer
Customer createCustomer(CustomerForm customerForm) throws OperationFailedException, PermissionDeniedException Creates a newCustomer.- Parameters:
customerForm- the form for thisCustomer- Returns:
- the new
Customer - Throws:
IllegalStateException-customerFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-customerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-customerForm did not originate from getCustomerFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCustomers
boolean canUpdateCustomers()Tests if this user can updateCustomers. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aCustomerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifCustomermodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCustomerFormForUpdate
CustomerForm getCustomerFormForUpdate(Id customerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the customer form for updating an existing customer. A new customer form should be requested for each update transaction.- Parameters:
customerId- theIdof theCustomer- Returns:
- the customer form
- Throws:
NotFoundException-customerIdis not foundNullArgumentException-customerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCustomer
void updateCustomer(CustomerForm customerForm) throws OperationFailedException, PermissionDeniedException Updates an existing customer.- Parameters:
customerForm- the form containing the elements to be updated- Throws:
IllegalStateException-customerFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-customerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-customerForm did not originate from getCustomerFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCustomers
boolean canDeleteCustomers()Tests if this user can deleteCustomers. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aCustomerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifCustomerdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteCustomer
void deleteCustomer(Id customerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aCustomer.- Parameters:
customerId- theIdof theCustomerto remove- Throws:
NotFoundException-customerIdnot foundNullArgumentException-customerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCustomerAliases
boolean canManageCustomerAliases()Tests if this user can manageIdaliases forCustomers. 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:
falseifCustomeraliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasCustomer
void aliasCustomer(Id customerId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aCustomerfor the purpose of creating compatibility. The primaryIdof theCustomeris determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another customer, it is reassigned to the given customerId.- Parameters:
customerId- theIdof aCustomeraliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-customerIdnot foundNullArgumentException-customerIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-