Interface RecipeAdminSession

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

public interface RecipeAdminSession extends OsidSession

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

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

The delete operations delete Recipes . To unmap a Recipe from the current Cookbook , the RecipeCookbookAssignmentSession should be used. These delete operations attempt to remove the Recipe itself thus removing it from all known Cookbook catalogs.

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

  • Method Details

    • getCookbookId

      Id getCookbookId()
      Gets the Cookbook Id associated with this session.
      Returns:
      the Cookbook Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCookbook

      Gets the Cookbook associated with this session.
      Returns:
      the cookbook
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateRecipes

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

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

      RecipeForm getRecipeFormForCreate(Type[] recipeRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the recipe form for creating new recipes. A new form should be requested for each create transaction.
      Parameters:
      recipeRecordTypes - array of recipe record types
      Returns:
      the recipe form
      Throws:
      NullArgumentException - recipeRecordTypes 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.
    • createRecipe

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

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

      RecipeForm getRecipeFormForUpdate(Id recipeId) throws NotFoundException, OperationFailedException
      Gets the recipe form for updating an existing recipe. A new recipe form should be requested for each update transaction.
      Parameters:
      recipeId - the Id of the Recipe
      Returns:
      the recipe form
      Throws:
      NotFoundException - recipeId is not found
      NullArgumentException - recipeId is null
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • updateRecipe

      void updateRecipe(RecipeForm recipeForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing recipe.
      Parameters:
      recipeForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - recipeForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - recipeId or recipeForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - recipeForm did not originate from getRecipeFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteRecipes

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

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

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

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