Interface CustomerAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
CustomerBatchAdminSession

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. 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 Details

    • getBusinessId

      Id getBusinessId()
      Gets the Business Id associated with this session.
      Returns:
      the Business Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getBusiness

      Gets the Business associated with this session.
      Returns:
      the business
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateCustomers

      boolean canCreateCustomers()
      Tests if this user can create 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.
      Returns:
      false if Customer creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateCustomerWithRecordTypes

      boolean canCreateCustomerWithRecordTypes(Type[] customerRecordTypes)
      Tests if this user can create a single 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.
      Parameters:
      customerRecordTypes - array of customer record types
      Returns:
      true if Customer creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - customerRecordTypes is null
      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 resource Id
      customerRecordTypes - array of customer record types
      Returns:
      the customer form
      Throws:
      NotFoundException - resourceId is not found
      NullArgumentException - customerRecordTypes or resourceId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createCustomer

      Creates a new Customer .
      Parameters:
      customerForm - the form for this Customer
      Returns:
      the new Customer
      Throws:
      IllegalStateException - customerForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - customerForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - customerForm did not originate from getCustomerFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateCustomers

      boolean canUpdateCustomers()
      Tests if this user can update 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.
      Returns:
      false if Customer modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getCustomerFormForUpdate

      Gets the customer form for updating an existing customer. A new customer form should be requested for each update transaction.
      Parameters:
      customerId - the Id of the Customer
      Returns:
      the customer form
      Throws:
      NotFoundException - customerId is not found
      NullArgumentException - customerId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - customerForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - customerForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - customerForm did not originate from getCustomerFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteCustomers

      boolean canDeleteCustomers()
      Tests if this user can delete 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.
      Returns:
      false if Customer deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteCustomer

      void deleteCustomer(Id customerId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes a Customer .
      Parameters:
      customerId - the Id of the Customer to remove
      Throws:
      NotFoundException - customerId not found
      NullArgumentException - customerId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageCustomerAliases

      boolean canManageCustomerAliases()
      Tests if this user can manage 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.
      Returns:
      false if Customer aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasCustomer

      Adds an 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 .
      Parameters:
      customerId - the Id of a Customer
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - customerId not found
      NullArgumentException - customerId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.