public interface FunctionAdminSession extends OsidSession
This session creates, updates, and deletes Functions.
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
Function,
a FunctionForm
is requested using
getFunctionFormForCreate()
specifying the desired relationship
peers and record Types
or none if no record Types
are needed. The returned FunctionForm
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 FunctionForm
is submiited to a create operation, it cannot be reused with
another create operation unless the first operation was unsuccessful. Each
FunctionForm
corresponds to an attempted transaction.
For updates, FunctionForms
are requested to the
Function
Id
that is to be updated using
getFunctionFormForUpdate().
Similarly, the FunctionForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The FunctionForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Functions.
To unmap a
Function
from the current Vault,
the
FunctionVaultAssignmentSession
should be used. These delete
operations attempt to remove the Function
itself thus
removing it from all known Vault
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 |
aliasFunction(Id functionId,
Id aliasId)
Adds an
Id to a Function for the purpose
of creating compatibility. |
boolean |
canCreateFunctions()
Tests if this user can create
Functions. |
boolean |
canCreateFunctionWithRecordTypes(Type[] functionRecordTypes)
Tests if this user can create a single
Function using
the desired record types. |
boolean |
canDeleteFunctions()
Tests if this user can delete
Functions. |
boolean |
canManageFunctionAliases()
Tests if this user can manage
Id aliases for
Functions. |
boolean |
canUpdateFunctions()
Tests if this user can update
Functions. |
Function |
createFunction(FunctionForm functionForm)
Creates a new
Function. |
void |
deleteFunction(Id functionId)
Deletes the
Function identified by the given Id. |
FunctionForm |
getFunctionFormForCreate(Type[] functionRecordTypes)
Gets the function form for creating new functions.
|
FunctionForm |
getFunctionFormForUpdate(Id functionId)
Gets the function form for updating an existing function.
|
Vault |
getVault()
Gets the
Vault associated with this session. |
Id |
getVaultId()
Gets the
Vault Id associated with this
session. |
void |
updateFunction(FunctionForm functionForm)
Updates an existing function.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getVaultId()
Vault
Id
associated with this
session. Vault Id
associated with this sessionmandatory
- This method must be implemented. Vault getVault() throws OperationFailedException, PermissionDeniedException
Vault
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateFunctions()
Functions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Function
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 Function
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateFunctionWithRecordTypes(Type[] functionRecordTypes)
Function
using
the desired record types. While
AuthorizationManager.getFunctionRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Function.
Providing an empty array tests if a Function
can be
created with no records.functionRecordTypes
- array of function record types true
if Function
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- functionRecordTypes
is null
mandatory
- This method must be implemented. FunctionForm getFunctionFormForCreate(Type[] functionRecordTypes) throws OperationFailedException, PermissionDeniedException
functionRecordTypes
- array of function record typesNullArgumentException
- functionRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form qith
requested record typesmandatory
- This method must be implemented. Function createFunction(FunctionForm functionForm) throws OperationFailedException, PermissionDeniedException
Function.
functionForm
- the form for this Function
Function
IllegalStateException
- functionForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- functionForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- functionForm
did
not originate from getFunctionFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateFunctions()
Functions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Function
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 function modification is not
authorized, true
otherwisemandatory
- This method must be implemented. FunctionForm getFunctionFormForUpdate(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
functionId
- the Id
of the Function
NotFoundException
- functionId
is not
foundNullArgumentException
- functionId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateFunction(FunctionForm functionForm) throws OperationFailedException, PermissionDeniedException
functionForm
- the form containing the elements to be updatedIllegalStateException
- functionForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- functionForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- functionForm
did
not originate from getFunctionFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteFunctions()
Functions.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Function
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 Function
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteFunction(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Function
identified by the given Id.
functionId
- the Id
of the Function
to deleteNotFoundException
- a Function
was not
found identified by the given Id
NullArgumentException
- functionId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageFunctionAliases()
Id
aliases for
Functions.
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 Function
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasFunction(Id functionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Function
for the purpose
of creating compatibility. The primary Id
of the
Function
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another function, it is reassigned to the given
function Id.
functionId
- the Id
of a Function
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- functionId
not foundNullArgumentException
- functionId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.