Interface CategoryAdminSession

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

public interface CategoryAdminSession extends OsidSession

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

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

The delete operations delete Categories . To unmap a Category from the current Business , the CategoryBusinessAssignmentSession should be used. These delete operations attempt to remove the Category 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.
    • canCreateCategories

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

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

      CategoryForm getCategoryFormForCreate(Type[] categoryRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the category form for creating new categories. A new form should be requested for each create transaction.
      Parameters:
      categoryRecordTypes - array of category record types
      Returns:
      the category form
      Throws:
      NullArgumentException - categoryRecordTypes 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.
    • createCategory

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

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

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

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

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

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

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

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