Interface RecipeAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
RecipeBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaliasRecipe(Id recipeId, Id aliasId) Adds anIdto aRecipefor the purpose of creating compatibility.booleanTests if this user can createRecipes.booleancanCreateRecipeWithRecordTypes(Type[] recipeRecordTypes) Tests if this user can create a singleRecipeusing the desired record types.booleanTests if this user can deleteRecipes.booleanTests if this user can manageIdaliases forRecipes.booleanTests if this user can updateRecipes.createRecipe(RecipeForm recipeForm) Creates a newRecipe.voiddeleteRecipe(Id recipeId) Deletes aRecipe.Gets theCookbookassociated with this session.Gets theCookbookIdassociated with this session.getRecipeFormForCreate(Type[] recipeRecordTypes) Gets the recipe form for creating new recipes.getRecipeFormForUpdate(Id recipeId) Gets the recipe form for updating an existing recipe.voidupdateRecipe(RecipeForm recipeForm) Updates an existing recipe.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getCookbookId
Id getCookbookId()Gets theCookbookIdassociated with this session.- Returns:
- the
Cookbook Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCookbook
Gets theCookbookassociated with this session.- Returns:
- the cookbook
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateRecipes
boolean canCreateRecipes()Tests if this user can createRecipes. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aRecipewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifRecipecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateRecipeWithRecordTypes
Tests if this user can create a singleRecipeusing the desired record types. WhileRecipeManager.getRecipeRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificRecipe. Providing an empty array tests if aRecipecan be created with no records.- Parameters:
recipeRecordTypes- array of recipe record types- Returns:
trueifRecipecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-recipeRecordTypesisnull- 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-recipeRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createRecipe
Recipe createRecipe(RecipeForm recipeForm) throws OperationFailedException, PermissionDeniedException Creates a newRecipe.- Parameters:
recipeForm- the form for thisRecipe- Returns:
- the new
Recipe - Throws:
IllegalStateException-recipeFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-recipeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-recipeFormdid not originate fromgetRecipeFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateRecipes
boolean canUpdateRecipes()Tests if this user can updateRecipes. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aRecipewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifRecipemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRecipeFormForUpdate
Gets the recipe form for updating an existing recipe. A new recipe form should be requested for each update transaction.- Parameters:
recipeId- theIdof theRecipe- Returns:
- the recipe form
- Throws:
NotFoundException-recipeIdis not foundNullArgumentException-recipeIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateRecipe
Updates an existing recipe.- Parameters:
recipeForm- the form containing the elements to be updated- Throws:
IllegalStateException-recipeFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-recipeIdorrecipeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-recipeFormdid not originate fromgetRecipeFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteRecipes
boolean canDeleteRecipes()Tests if this user can deleteRecipes. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aRecipewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifRecipedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteRecipe
void deleteRecipe(Id recipeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aRecipe.- Parameters:
recipeId- theIdof theRecipeto remove- Throws:
NotFoundException-recipeIdnot foundNullArgumentException-recipeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageRecipeAliases
boolean canManageRecipeAliases()Tests if this user can manageIdaliases forRecipes. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifRecipealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasRecipe
void aliasRecipe(Id recipeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aRecipefor the purpose of creating compatibility. The primaryIdof theRecipeis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another recipe, it is reassigned to the given recipeId.- Parameters:
recipeId- theIdof aRecipealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-recipeIdnot foundNullArgumentException-recipeIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-