Interface BusinessAdminSession

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

public interface BusinessAdminSession extends OsidSession

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

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

The delete operations delete Businesses .

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • canCreateBusinesses

      boolean canCreateBusinesses()
      Tests if this user can create Businesses . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Business . will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if Business creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateBusinessWithRecordTypes

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

      BusinessForm getBusinessFormForCreate(Type[] businessRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the business form for creating new businesses. A new form should be requested for each create transaction.
      Parameters:
      businessRecordTypes - array of business record types
      Returns:
      the business form
      Throws:
      NullArgumentException - businessRecordTypes 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.
    • createBusiness

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

      boolean canUpdateBusinesses()
      Tests if this user can update Businesses . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Business will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if Business modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getBusinessFormForUpdate

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

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

      boolean canDeleteBusinesses()
      Tests if this user can delete Businesses . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Business will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if Business deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteBusiness

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

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

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