Interface CategoryBusinessAssignmentSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface CategoryBusinessAssignmentSession extends OsidSession

This session provides methods to re-assign Categories to Businesses . A Category may appear in multiple Businesses and removing the last reference to a Category is the equivalent of deleting it. Each Business may have its own authorizations governing who is allowed to operate on it.

Adding a reference of a Category to another Business is not a copy operation (eg: does not change its Id ).

  • Method Details

    • canAssignCategories

      boolean canAssignCategories()
      Tests if this user can alter category/business mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users.
      Returns:
      false if mapping is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canAssignCategoryToBusiness

      boolean canAssignCategoryToBusiness(Id businessId)
      Tests if this user can alter category/business mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.
      Parameters:
      businessId - the Id of the Business
      Returns:
      false if mapping is not authorized, true otherwise
      Throws:
      NullArgumentException - businessId is null
      Compliance:
      mandatory - This method must be implemented.
    • getAssignableBusinessIds

      IdList getAssignableBusinessIds(Id businessId) throws OperationFailedException
      Gets a list of businesses including and under the given business node in which any category can be assigned.
      Parameters:
      businessId - the Id of the Business
      Returns:
      list of assignable business Ids
      Throws:
      NullArgumentException - businessId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • getAssignableBusinessIdsForCategory

      IdList getAssignableBusinessIdsForCategory(Id businessId, Id categoryId) throws OperationFailedException
      Gets a list of businesses including and under the given business node in which a specific category can be assigned.
      Parameters:
      businessId - the Id of the Business
      categoryId - the Id of the Category
      Returns:
      list of assignable business Ids
      Throws:
      NullArgumentException - businessId or categoryId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • assignCategoryToBusiness

      void assignCategoryToBusiness(Id categoryId, Id businessId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an existing Category to a Business .
      Parameters:
      categoryId - the Id of the Category
      businessId - the Id of the Business
      Throws:
      AlreadyExistsException - categoryId is already assigned to businessId
      NotFoundException - categoryId or businessId not found
      NullArgumentException - categoryId or businessId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • unassignCategoryFromBusiness

      void unassignCategoryFromBusiness(Id categoryId, Id businessId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Removes a Category from a Business .
      Parameters:
      categoryId - the Id of the Category
      businessId - the Id of the Business
      Throws:
      NotFoundException - categoryId or businessId not found or categoryId not assigned to businessId
      NullArgumentException - categoryId or businessId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • reassignCategoryToBusiness

      void reassignCategoryToBusiness(Id categoryId, Id fromBusinessId, Id toBusinessId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Moves a Category from one Business to another. Mappings to other Businesses are unaffected.
      Parameters:
      categoryId - the Id of the Category
      fromBusinessId - the Id of the current Business
      toBusinessId - the Id of the destination Business
      Throws:
      AlreadyExistsException - categoryId already assigned to toBusinessId
      NotFoundException - categoryId, fromBusinessId , or toBusinessId not found or categoryId not mapped to fromBusinessId
      NullArgumentException - categoryId, fromBusinessId , or toBusinessId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.