Interface AccountAdminSession

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

public interface AccountAdminSession extends OsidSession

This session creates, updates, and deletes Accounts . 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 an Account , an AccountForm is requested using getAccountFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned AccountForm 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 AccountForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each AccountForm corresponds to an attempted transaction.

For updates, AccountForms are requested to the Account Id that is to be updated using getAccountFormForUpdate() . Similarly, the AccountForm has metadata about the data that can be updated and it can perform validation before submitting the update. The AccountForm can only be used once for a successful update and cannot be reused.

The delete operations delete Accounts . To unmap an Account from the current Business , the AccountBusinessAssignmentSession should be used. These delete operations attempt to remove the Account 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.
    • canCreateAccounts

      boolean canCreateAccounts()
      Tests if this user can create Accounts . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Account 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 Account creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateAccountWithRecordTypes

      boolean canCreateAccountWithRecordTypes(Type[] accountRecordTypes)
      Tests if this user can create a single Account using the desired record types. While FinancialsManager.getAccountRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Account . Providing an empty array tests if an Account can be created with no records.
      Parameters:
      accountRecordTypes - array of account record types
      Returns:
      true if Account creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - accountRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getAccountFormForCreate

      AccountForm getAccountFormForCreate(Type[] accountRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the account form for creating new accounts. A new form should be requested for each create transaction.
      Parameters:
      accountRecordTypes - array of account record types
      Returns:
      the account form
      Throws:
      NullArgumentException - accountRecordTypes 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.
    • createAccount

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

      boolean canUpdateAccounts()
      Tests if this user can update Accounts . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Account 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 Account modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getAccountFormForUpdate

      Gets the account form for updating an existing account. A new account form should be requested for each update transaction.
      Parameters:
      accountId - the Id of the Account
      Returns:
      the account form
      Throws:
      NotFoundException - accountId is not found
      NullArgumentException - accountId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateAccount

      void updateAccount(AccountForm accountForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing account.
      Parameters:
      accountForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - accountForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - accountForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - accountForm did not originate from getAccountFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteAccounts

      boolean canDeleteAccounts()
      Tests if this user can delete Accounts . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Account 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 Account deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteAccount

      Deletes an Account .
      Parameters:
      accountId - the Id of the Account to remove
      Throws:
      NotFoundException - accountId not found
      NullArgumentException - accountId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageAccountAliases

      boolean canManageAccountAliases()
      Tests if this user can manage Id aliases for Accounts . 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 Account aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasAccount

      Adds an Id to an Account for the purpose of creating compatibility. The primary Id of the Account is deactivityined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another account, it is reassigned to the given account Id .
      Parameters:
      accountId - the Id of an Account
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - accountId not found
      NullArgumentException - accountId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.