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.
| Modifier and Type | Method and Description |
|---|---|
void |
aliasRecipe(Id recipeId,
Id aliasId)
Adds an
Id to a Recipe for the purpose
of creating compatibility. |
boolean |
canCreateRecipes()
Tests if this user can create
Recipes. |
boolean |
canCreateRecipeWithRecordTypes(Type[] recipeRecordTypes)
Tests if this user can create a single
Recipe using the
desired record types. |
boolean |
canDeleteRecipes()
Tests if this user can delete
Recipes. |
boolean |
canManageRecipeAliases()
Tests if this user can manage
Id aliases for
Recipes. |
boolean |
canUpdateRecipes()
Tests if this user can update
Recipes. |
Recipe |
createRecipe(RecipeForm recipeForm)
Creates a new
Recipe. |
void |
deleteRecipe(Id recipeId)
Deletes a
Recipe. |
Cookbook |
getCookbook()
Gets the
Cookbook associated with this session. |
Id |
getCookbookId()
Gets the
Cookbook Id associated with
this session. |
RecipeForm |
getRecipeFormForCreate(Type[] recipeRecordTypes)
Gets the recipe form for creating new recipes.
|
RecipeForm |
getRecipeFormForUpdate(Id recipeId)
Gets the recipe form for updating an existing recipe.
|
void |
updateRecipe(RecipeForm recipeForm)
Updates an existing recipe.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getCookbookId()
Cookbook Id associated with
this session. Cookbook Id associated with this sessionmandatory - This method must be implemented. Cookbook getCookbook() throws OperationFailedException, PermissionDeniedException
Cookbook associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateRecipes()
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. false if Recipe creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateRecipeWithRecordTypes(Type[] recipeRecordTypes)
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.recipeRecordTypes - array of recipe record types true if Recipe creation using
the specified record Types is supported,
false otherwiseNullArgumentException - recipeRecordTypes
is null mandatory - This method must be implemented. RecipeForm getRecipeFormForCreate(Type[] recipeRecordTypes) throws OperationFailedException, PermissionDeniedException
recipeRecordTypes - array of recipe record typesNullArgumentException - recipeRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Recipe createRecipe(RecipeForm recipeForm) throws OperationFailedException, PermissionDeniedException
Recipe. recipeForm - the form for this Recipe Recipe IllegalStateException - recipeForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - recipeForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - recipeForm did
not originate from getRecipeFormForCreate() mandatory - This method must be implemented. boolean canUpdateRecipes()
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. false if Recipe modification is
not authorized, true otherwisemandatory - This method must be implemented. RecipeForm getRecipeFormForUpdate(Id recipeId) throws NotFoundException, OperationFailedException
recipeId - the Id of the Recipe NotFoundException - recipeId is not
foundNullArgumentException - recipeId is
null OperationFailedException - unable to complete requestmandatory - This method must be implemented. void updateRecipe(RecipeForm recipeForm) throws OperationFailedException, PermissionDeniedException
recipeForm - the form containing the elements to be updatedIllegalStateException - recipeForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - recipeId or
recipeForm is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - recipeForm did
not originate from getRecipeFormForUpdate() mandatory - This method must be implemented. boolean canDeleteRecipes()
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. false if Recipe deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteRecipe(Id recipeId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Recipe. recipeId - the Id of the Recipe to
removeNotFoundException - recipeId not foundNullArgumentException - recipeId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageRecipeAliases()
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. false if Recipe aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasRecipe(Id recipeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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. recipeId - the Id of a Recipe aliasId - the alias Id AlreadyExistsException - aliasId is
already assignedNotFoundException - recipeId not foundNullArgumentException - recipeId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.