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.
Modifier and Type | Method and Description |
---|---|
void |
aliasCookbook(Id cookbookId,
Id aliasId)
Adds an
Id to an Cookbook for the
purpose of creating compatibility. |
boolean |
canCreateCookbooks()
Tests if this user can create
Cookbooks. |
boolean |
canCreateCookbookWithRecordTypes(Type[] cookbookRecordTypes)
Tests if this user can create a single
Cookbook using
the desired record types. |
boolean |
canDeleteCookbooks()
Tests if this user can delete
Cookbooks A return of
true does not guarantee successful authorization. |
boolean |
canManageCookbookAliases()
Tests if this user can manage
Id aliases for
Cookbooks. |
boolean |
canUpdateCookbooks()
Tests if this user can update
Cookbooks. |
Cookbook |
createCookbook(CookbookForm cookbookForm)
Creates a new
Cookbook. |
void |
deleteCookbook(Id cookbookId)
Deletes an
Cookbook. |
CookbookForm |
getCookbookFormForCreate(Type[] cookbookRecordTypes)
Gets the cook book form for creating new cook books.
|
CookbookForm |
getCookbookFormForUpdate(Id cookbookId)
Gets the cook book form for updating an existing cookbook.
|
void |
updateCookbook(CookbookForm cookbookForm)
Updates an existing cookbook.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateCookbooks()
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. false
if Cookbook
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateCookbookWithRecordTypes(Type[] cookbookRecordTypes)
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.cookbookRecordTypes
- array of cook book types true
if Cookbook
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- cookbookRecordTypes
is null
mandatory
- This method must be implemented. CookbookForm getCookbookFormForCreate(Type[] cookbookRecordTypes) throws OperationFailedException, PermissionDeniedException
cookbookRecordTypes
- array of cook book typesNullArgumentException
- cookbookRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Cookbook createCookbook(CookbookForm cookbookForm) throws OperationFailedException, PermissionDeniedException
Cookbook.
cookbookForm
- the form for this Cookbook
Cookbook
IllegalStateException
- cookbookForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- cookbookForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cookbookForm
did
not originate from getCookbookFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateCookbooks()
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. false
if Cookbook
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. CookbookForm getCookbookFormForUpdate(Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException
cookbookId
- the Id
of the Cookbook
NotFoundException
- cookbookId
is not
foundNullArgumentException
- cookbookId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateCookbook(CookbookForm cookbookForm) throws OperationFailedException, PermissionDeniedException
cookbookForm
- the form containing the elements to be updatedIllegalStateException
- cookbookForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- cookbookForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cookbookForm
did
not originate from getCookbookFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteCookbooks()
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. false
if Cookbook
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteCookbook(Id cookbookId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Cookbook.
cookbookId
- the Id
of the Cookbook
to removeNotFoundException
- cookbookId
not foundNullArgumentException
- cookbookId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageCookbookAliases()
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. false
if Cookbook
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasCookbook(Id cookbookId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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 cook book, it is
reassigned to the given cook book Id.
cookbookId
- the Id
of an Cookbook
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- cookbookId
not foundNullArgumentException
- cookbookId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.