Interface DirectionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
DirectionBatchAdminSession
This session creates, updates, and deletes Directions . 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
Direction , a DirectionForm is requested using
getDirectionFormForCreate() specifying the desired recipe and record
Types or none if no record Types are needed. The returned
DirectionForm 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 DirectionForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each DirectionForm corresponds
to an attempted transaction.
For updates, DirectionForms are requested to the
Direction Id that is to be updated using
getDirectionFormForUpdate() . Similarly, the DirectionForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The DirectionForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Directions . To unmap a
Direction from the current Cookbook , the
DirectionCookbookAssignmentSession should be used. These delete
operations attempt to remove the Direction 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 TypeMethodDescriptionvoidaliasDirection(Id directionId, Id aliasId) Adds anIdto aDirectionfor the purpose of creating compatibility.booleanTests if this user can createDirections.booleancanCreateDirectionWithRecordTypes(Type[] directionRecordTypes) Tests if this user can create a singleDirectionusing the desired record types.booleancanCreateIngredientWithRecordTypes(Type[] ingredientRecordTypes) Tests if this user can create a singleIngredientusing the desired record types.booleanTests if this user can deleteDirections.booleanTests if this user can manageIdaliases forDirections.booleanTests if this user can manageIngedredients.booleanTests if this user can orderDirections.booleanTests if this user can updateDirections.createDirection(DirectionForm directionForm) Creates a newDirection.createIngredient(IngredientForm ingredientForm) Creates a newIngredient.voiddeleteDirection(Id directionId) Deletes aDirection.voiddeleteIngredient(Id ingredientId) Deletes anIngredient.Gets theCookbookassociated with this session.Gets theCookbookIdassociated with this session.getDirectionFormForCreate(Id recipeId, Type[] directionRecordTypes) Gets the direction form for creating new directions.getDirectionFormForUpdate(Id directionId) Gets the direction form for updating an existing direction.getIngredientFormForCreate(Id directionId, Type[] ingredientRecordTypes) Gets the ingredient form for creating new ingredients.getIngredientFormForUpdate(Id ingredientId) Gets the ingredient form for updating an existing ingredient.voidmoveDirectionAhead(Id directionId, Id recipeId, Id referenceId) Reorders directions in a recipe by moving the specified direction in front of a reference direction.voidmoveDirectionBehind(Id directionId, Id recipeId, Id referenceId) Reorders directions in a recipe by moving the specified direction behind a reference direction.voidorderDirections(Id[] directionIds, Id recipeId) Reorders a set of directions in a recipe.voidupdateDirection(DirectionForm directionForm) Updates an existing direction.voidupdateIngredient(IngredientForm ingredientForm) Updates an existing ingredient.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.
-
canCreateDirections
boolean canCreateDirections()Tests if this user can createDirections. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aDirectionwill 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:
falseifDirectioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateDirectionWithRecordTypes
Tests if this user can create a singleDirectionusing the desired record types. WhileRecipeManager.getDirectionRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificDirection. Providing an empty array tests if aDirectioncan be created with no records.- Parameters:
directionRecordTypes- array of direction record types- Returns:
trueifDirectioncreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-directionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getDirectionFormForCreate
DirectionForm getDirectionFormForCreate(Id recipeId, Type[] directionRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the direction form for creating new directions. A new form should be requested for each create transaction.- Parameters:
recipeId- a recipeIddirectionRecordTypes- array of direction record types- Returns:
- the direction form
- Throws:
NotFoundException-recipeIdIs not foundNullArgumentException-recipeIdordirectionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createDirection
Direction createDirection(DirectionForm directionForm) throws OperationFailedException, PermissionDeniedException Creates a newDirection.- Parameters:
directionForm- the form for thisDirection- Returns:
- the new
Direction - Throws:
IllegalStateException-directionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-directionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-directionFormdid not originate fromgetDirectionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateDirections
boolean canUpdateDirections()Tests if this user can updateDirections. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aDirectionwill 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:
falseifDirectionmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getDirectionFormForUpdate
DirectionForm getDirectionFormForUpdate(Id directionId) throws NotFoundException, OperationFailedException Gets the direction form for updating an existing direction. A new direction form should be requested for each update transaction.- Parameters:
directionId- theIdof theDirection- Returns:
- the direction form
- Throws:
NotFoundException-directionIdis not foundNullArgumentException-directionIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateDirection
void updateDirection(DirectionForm directionForm) throws OperationFailedException, PermissionDeniedException Updates an existing direction.- Parameters:
directionForm- the form containing the elements to be updated- Throws:
IllegalStateException-directionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-directionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-directionFormdid not originate fromgetDirectionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteDirections
boolean canDeleteDirections()Tests if this user can deleteDirections. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aDirectionwill 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:
falseifDirectiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteDirection
void deleteDirection(Id directionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aDirection.- Parameters:
directionId- theIdof theDirectionto remove- Throws:
NotFoundException-directionIdnot foundNullArgumentException-directionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageDirectionAliases
boolean canManageDirectionAliases()Tests if this user can manageIdaliases forDirections. 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:
falseifDirectionaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasDirection
void aliasDirection(Id directionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aDirectionfor the purpose of creating compatibility. The primaryIdof theDirectionis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another direction, it is reassigned to the given directionId.- Parameters:
directionId- theIdof aDirectionaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-directionIdnot foundNullArgumentException-directionIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageIngredients
boolean canManageIngredients()Tests if this user can manageIngedredients. 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 sequencing operations to an unauthorized user.- Returns:
falseifIngredientmanagement is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateIngredientWithRecordTypes
Tests if this user can create a singleIngredientusing the desired record types. WhileRecipeManager.getIngreientRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificIngredient. Providing an empty array tests if anIngredientcan be created with no records.- Parameters:
ingredientRecordTypes- array of ingredient record types- Returns:
trueifIngredientcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-ingredientRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getIngredientFormForCreate
IngredientForm getIngredientFormForCreate(Id directionId, Type[] ingredientRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the ingredient form for creating new ingredients. A new form should be requested for each create transaction.- Parameters:
directionId- an ingredientIdingredientRecordTypes- array of ingredient record types- Returns:
- the ingredient form
- Throws:
NotFoundException-directionIdIs not foundNullArgumentException-directionIdoringredientRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createIngredient
Ingredient createIngredient(IngredientForm ingredientForm) throws OperationFailedException, PermissionDeniedException Creates a newIngredient.- Parameters:
ingredientForm- the form for thisIngredient- Returns:
- the new
Ingredient - Throws:
IllegalStateException-ingredientFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-ingredientFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ingredientFormdid not originate fromgeIngredientFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
getIngredientFormForUpdate
IngredientForm getIngredientFormForUpdate(Id ingredientId) throws NotFoundException, OperationFailedException Gets the ingredient form for updating an existing ingredient. A new ingredient form should be requested for each update transaction.- Parameters:
ingredientId- theIdof theIngredient- Returns:
- the ingredient form
- Throws:
NotFoundException-ingredientIdis not foundNullArgumentException-ingredientIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateIngredient
void updateIngredient(IngredientForm ingredientForm) throws OperationFailedException, PermissionDeniedException Updates an existing ingredient.- Parameters:
ingredientForm- the form containing the elements to be updated- Throws:
IllegalStateException-ingredientFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-ingredientFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ingredientFormdid not originate fromgetIngredientFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
deleteIngredient
void deleteIngredient(Id ingredientId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anIngredient.- Parameters:
ingredientId- theIdof theIngredientto remove- Throws:
NotFoundException-ingredientIdnot foundNullArgumentException-ingredientIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canSequenceDirections
boolean canSequenceDirections()Tests if this user can orderDirections. 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 sequencing operations to an unauthorized user.- Returns:
falseifDirectionordering is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
moveDirectionAhead
void moveDirectionAhead(Id directionId, Id recipeId, Id referenceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Reorders directions in a recipe by moving the specified direction in front of a reference direction.- Parameters:
directionId- theIdof aDirectionrecipeId- theIdof aRecipereferenceId- the reference directionId- Throws:
NotFoundException-directionId, recipeId, orreferenceIdnot found or,directionIdorreferenceIdnot related torecipeIdNullArgumentException-directionId, recipeIdorreferenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
moveDirectionBehind
void moveDirectionBehind(Id directionId, Id recipeId, Id referenceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Reorders directions in a recipe by moving the specified direction behind a reference direction.- Parameters:
directionId- theIdof aDirectionrecipeId- theIdof aRecipereferenceId- the reference directionId- Throws:
NotFoundException-directionId, recipeId, orreferenceIdnot found or,directionIdorreferenceIdnot related torecipeIdNullArgumentException-directionId, recipeIdorreferenceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
orderDirections
void orderDirections(Id[] directionIds, Id recipeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Reorders a set of directions in a recipe.- Parameters:
directionIds- theIdsfor a set ofDirectionsrecipeId- theIdof aRecipe- Throws:
NotFoundException-recipeIdnot found or, adirectionIdnot related torecipeIdNullArgumentException-directionIdsorrecipeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-