Interface CookbookAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CookbookBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaliasCookbook(Id cookbookId, Id aliasId) Adds anIdto anCookbookfor the purpose of creating compatibility.booleanTests if this user can createCookbooks.booleancanCreateCookbookWithRecordTypes(Type[] cookbookRecordTypes) Tests if this user can create a singleCookbookusing the desired record types.booleanTests if this user can deleteCookbooksA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forCookbooks.booleanTests if this user can updateCookbooks.createCookbook(CookbookForm cookbookForm) Creates a newCookbook.voiddeleteCookbook(Id cookbookId) Deletes anCookbook.getCookbookFormForCreate(Type[] cookbookRecordTypes) Gets the cookbook form for creating new cookbooks.getCookbookFormForUpdate(Id cookbookId) Gets the cookbook form for updating an existing cookbook.voidupdateCookbook(CookbookForm cookbookForm) Updates an existing cookbook.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
-
canCreateCookbooks
boolean canCreateCookbooks()Tests if this user can createCookbooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anCookbookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifCookbookcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCookbookWithRecordTypes
Tests if this user can create a singleCookbookusing the desired record types. WhileRecipeManager.getCookbookRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificCookbook. Providing an empty array tests if anCookbookcan be created with no records.- Parameters:
cookbookRecordTypes- array of cookbook types- Returns:
trueifCookbookcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-cookbookRecordTypesisnull- 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-cookbookRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createCookbook
Cookbook createCookbook(CookbookForm cookbookForm) throws OperationFailedException, PermissionDeniedException Creates a newCookbook.- Parameters:
cookbookForm- the form for thisCookbook- Returns:
- the new
Cookbook - Throws:
IllegalStateException-cookbookFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-cookbookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-cookbookFormdid not originate fromgetCookbookFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCookbooks
boolean canUpdateCookbooks()Tests if this user can updateCookbooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anCookbookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifCookbookmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCookbookFormForUpdate
CookbookForm getCookbookFormForUpdate(Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the cookbook form for updating an existing cookbook. A new cookbook form should be requested for each update transaction.- Parameters:
cookbookId- theIdof theCookbook- Returns:
- the cookbook form
- Throws:
NotFoundException-cookbookIdis not foundNullArgumentException-cookbookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- 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-cookbookFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-cookbookFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-cookbookFormdid not originate fromgetCookbookFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCookbooks
boolean canDeleteCookbooks()Tests if this user can deleteCookbooksA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anCookbookwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifCookbookdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteCookbook
void deleteCookbook(Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anCookbook.- Parameters:
cookbookId- theIdof theCookbookto remove- Throws:
NotFoundException-cookbookIdnot foundNullArgumentException-cookbookIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCookbookAliases
boolean canManageCookbookAliases()Tests if this user can manageIdaliases forCookbooks. 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:
falseifCookbookaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasCookbook
void aliasCookbook(Id cookbookId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anCookbookfor the purpose of creating compatibility. The primaryIdof theCookbookis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another cookbook, it is reassigned to the given cookbookId.- Parameters:
cookbookId- theIdof anCookbookaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-cookbookIdnot foundNullArgumentException-cookbookIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-