Interface CustomerBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, CustomerAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Customers 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
Customer , a CustomerForm is requested using
getCustomerFormsForCreate() specifying the resource and desired record
Types or none if no record Types are needed. Each of the
returned CustomerForms 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 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.
The CustomerForms returned from
getCustomerFormsForCreate() may be linked to the originating request
through the peer Ids of the CustomerForm . In the case
where there may be duplicates, any CustomerForm of the same peer
Ids may be used for a create operation.
Once a batch of CustomerForms are submitted for create, a
CreateResponse is returned for each CustomerForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createCustomers() ,
errors specific to an individual CustomerForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating CustomerForm through the
CustomerForm Id .
For updates, CustomerForms are requested to the
Customer Id that is to be updated using
getCustomerFormsForUpdate() where the reference Id in the
CustomerForm may be used to link the request. 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.
Once a batch of CustomerForms are submitted for update, an
UpdateResponse is returned for each CustomerForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateCustomers() ,
errors specific to an individual CustomerForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating CustomerForm through the
CustomerForm Id .
The delete operations delete Customers in bulk. 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. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasCustomers(AliasRequestList aliasRequests) Adds anIdto aCustomerfor the purpose of creating compatibility.createCustomers(CustomerBatchFormList customerForms) Creates a new set ofCustomers.Deletes allCustomersin thisBusiness.deleteCustomers(IdList customerIds) Deletes customers for the givenIds.deleteCustomersForResource(Id resourceId) Deletes customers for the given resource.Deletes customers expired before the given date.getCustomerFormsForCreate(IdList resourceIds, Type[] customerRecordTypes) Gets the customer forms for creating a bunch of new customers.getCustomerFormsForUpdate(IdList customerIds) Gets the customer forms for updating an existing set of customers.updateCustomers(CustomerBatchFormList customerForms) Updates existing customers.Methods inherited from interface CustomerAdminSession
aliasCustomer, canCreateCustomers, canCreateCustomerWithRecordTypes, canDeleteCustomers, canManageCustomerAliases, canUpdateCustomers, createCustomer, deleteCustomer, getBusiness, getBusinessId, getCustomerFormForCreate, getCustomerFormForUpdate, updateCustomerModifier 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
-
getCustomerFormsForCreate
CustomerBatchFormList getCustomerFormsForCreate(IdList resourceIds, Type[] customerRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the customer forms for creating a bunch of new customers. A new form is returned for each supplied resource.- Parameters:
resourceIds- a list of resourceIdscustomerRecordTypes- array of customer record types to be included in each create operation or an empty list if none- Returns:
- the customer forms
- Throws:
NotFoundException- a resource is not foundNullArgumentException-resourceIdsorcustomerRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createCustomers
CreateResponseList createCustomers(CustomerBatchFormList customerForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofCustomers. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
customerForms- the customer forms- Returns:
- the create responses
- Throws:
NullArgumentException-customerFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCustomerFormsForUpdate
CustomerBatchFormList getCustomerFormsForUpdate(IdList customerIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the customer forms for updating an existing set of customers. A new customer form should be requested for each update transaction.- Parameters:
customerIds- theIdsof theCustomer- Returns:
- the customer form
- Throws:
NotFoundException- acustomerIdis not foundNullArgumentException-customerIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCustomers
UpdateResponseList updateCustomers(CustomerBatchFormList customerForms) throws OperationFailedException, PermissionDeniedException Updates existing customers. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
customerForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-customerFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllCustomers
Deletes allCustomersin thisBusiness.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCustomers
DeleteResponseList deleteCustomers(IdList customerIds) throws OperationFailedException, PermissionDeniedException Deletes customers for the givenIds.- Parameters:
customerIds- theIdsof the customers to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-customerIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCustomersForResource
DeleteResponseList deleteCustomersForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes customers for the given resource.- Parameters:
resourceId- theIdof a resource- Returns:
- the delete responses
- Throws:
NullArgumentException-customerIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveCustomersByDate
DeleteResponseList deleteIneffectiveCustomersByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes customers 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.
-
aliasCustomers
AliasResponseList aliasCustomers(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aCustomerfor the purpose of creating compatibility. The primaryIdof theCustomeris determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another customer, it is reassigned to the given customerId.- 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.
-