Interface RecipeCookbookAssignmentSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface RecipeCookbookAssignmentSession extends OsidSession

This session provides methods to re-assign Recipes to Cookbook mappings. A Recipe may appear in multiple Cookbook objects and removing the last reference to a Recipe is the equivalent of deleting it. Each Cookbook may have its own authorizations governing who is allowed to operate on it.

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

  • Method Details

    • canAssignRecipes

      boolean canAssignRecipes()
      Tests if this user can alter recipe/cookbook 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.
      Returns:
      false if ingredient is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canAssignRecipesToCookbook

      boolean canAssignRecipesToCookbook(Id cookbookId)
      Tests if this user can alter recipe/cookbook 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:
      cookbookId - the Id of the Cookbook
      Returns:
      false if mapping is not authorized, true otherwise
      Throws:
      NullArgumentException - cookbookId is null
      Compliance:
      mandatory - This method must be implemented.
    • getAssignableCookbookIds

      IdList getAssignableCookbookIds(Id cookbookId) throws OperationFailedException
      Gets a list of cookbooks including and under the given cookbook node in which any recipe can be assigned.
      Parameters:
      cookbookId - the Id of the Cookbook
      Returns:
      list of assignable cookbook Ids
      Throws:
      NullArgumentException - cookbookId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • getAssignableCookbookIdsForRecipe

      IdList getAssignableCookbookIdsForRecipe(Id cookbookId, Id recipeId) throws OperationFailedException
      Gets a list of cookbooks including and under the given cookbook node in which a specific recipe can be assigned.
      Parameters:
      cookbookId - the Id of the Cookbook
      recipeId - the Id of the Recipe
      Returns:
      list of assignable cookbook Ids
      Throws:
      NullArgumentException - cookbookId or recipeId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • assignRecipeToCookbook

      void assignRecipeToCookbook(Id recipeId, Id cookbookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an existing Recipe to a Cookbook .
      Parameters:
      recipeId - the Id of the Recipe
      cookbookId - the Id of the Cookbook
      Throws:
      AlreadyExistsException - recipeId is not assigned to cookbookId
      NotFoundException - recipeId or cookbookId not found
      NullArgumentException - recipeId or cookbookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • unassignRecipeFromCookbook

      void unassignRecipeFromCookbook(Id recipeId, Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Removes a Recipe from a Cookbook .
      Parameters:
      recipeId - the Id of the Recipe
      cookbookId - the Id of the Cookbook
      Throws:
      NotFoundException - recipeId or cookbookId not found or recipeId not assigned to cookbookId
      NullArgumentException - recipeId or cookbookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • reassignRecipeToCookbook

      void reassignRecipeToCookbook(Id recipeId, Id fromCookbookId, Id toCookbookId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Moves a Recipe from one Cookbook to another. Mappings to other Cookbooks are unaffected.
      Parameters:
      recipeId - the Id of the Recipe
      fromCookbookId - the Id of the current Cookbook
      toCookbookId - the Id of the destination Cookbook
      Throws:
      AlreadyExistsException - recipeId already assigned to toCookbookId
      NotFoundException - recipeId, fromCookbookId , or toCookbookId not found or recipeId not mapped to fromCookbookId
      NullArgumentException - recipeId, fromCookbookId , or toCookbookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.