Interface CookbookAdminSession

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

public interface CookbookAdminSession extends OsidSession

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

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

The delete operations delete Cookbooks .

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

  • Method Details

    • canCreateCookbooks

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

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

      CookbookForm getCookbookFormForCreate(Type[] cookbookRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the cookbook form for creating new cookbooks. A new form should be requested for each create transaction.
      Parameters:
      cookbookRecordTypes - array of cookbook types
      Returns:
      the cookbook form
      Throws:
      NullArgumentException - cookbookRecordTypes 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.
    • createCookbook

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

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

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

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

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

      void deleteCookbook(Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes an Cookbook .
      Parameters:
      cookbookId - the Id of the Cookbook to remove
      Throws:
      NotFoundException - cookbookId not found
      NullArgumentException - cookbookId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageCookbookAliases

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

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