public interface NodeAdminSession extends OsidSession
This session creates, updates, and deletes Nodes.
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
Node,
a NodeForm
is requested using
getNodeFormForCreate()
specifying desired record Types
or none if no record Types
are needed. The returned
NodeForm
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 NodeForm
is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each NodeForm
corresponds
to an attempted transaction.
For updates, NodeForms
are requested to the Node
Id
that is to be updated using
getNodeFormForUpdate().
Similarly, the NodeForm
has
metadata about the data that can be updated and it can perform validation
before submitting the update. The NodeForm
can only be used
once for a successful update and cannot be reused.
The delete operations delete Nodes.
To unmap a
Node
from the current Graph,
the
NodeGraphAssignmentSession
should be used. These delete operations
attempt to remove the Node
itself thus removing it from all
known Graph
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 |
aliasNode(Id nodeId,
Id aliasId)
Adds an
Id to a Node for the purpose of
creating compatibility. |
boolean |
canCreateNodes()
Tests if this user can create
Nodes. |
boolean |
canCreateNodeWithRecordTypes(Type[] nodeRecordTypes)
Tests if this user can create a single
Node using the
desired record types. |
boolean |
canDeleteNodes()
Tests if this user can delete
Nodes. |
boolean |
canManageNodeAliases()
Tests if this user can manage
Id aliases for node
entries. |
boolean |
canUpdateNodes()
Tests if this user can update
Nodes. |
Node |
createNode(NodeForm nodeForm)
Creates a new
Node. |
void |
deleteNode(Id nodeId)
Deletes a
Node. |
Graph |
getGraph()
Gets the
Graph associated with this session. |
Id |
getGraphId()
Gets the
Graph Id associated with this
session. |
NodeForm |
getNodeFormForCreate(Type[] nodeRecordTypes)
Gets the node form for creating new nodes.
|
NodeForm |
getNodeFormForUpdate(Id nodeId)
Gets the node form for updating an existing node.
|
void |
updateNode(NodeForm nodeForm)
Updates an existing node.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getGraphId()
Graph
Id
associated with this
session. Graph Id
associated with this sessionmandatory
- This method must be implemented. Graph getGraph() throws OperationFailedException, PermissionDeniedException
Graph
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateNodes()
Nodes.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Node
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 Node
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateNodeWithRecordTypes(Type[] nodeRecordTypes)
Node
using the
desired record types. While
TopologyManager.getNodeRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Node.
Providing an
empty array tests if a Node
can be created with no
records.nodeRecordTypes
- array of node record types true
if Node
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- nodeRecordTypes
is null
mandatory
- This method must be implemented. NodeForm getNodeFormForCreate(Type[] nodeRecordTypes) throws OperationFailedException, PermissionDeniedException
nodeRecordTypes
- array of node record typesNullArgumentException
- nodeRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Node createNode(NodeForm nodeForm) throws OperationFailedException, PermissionDeniedException
Node.
nodeForm
- the form for this Node
Node
IllegalStateException
- nodeForm already used in a
create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- nodeForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- nodeForm
did not
originate from getNodeFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateNodes()
Nodes.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Node
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 Node
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. NodeForm getNodeFormForUpdate(Id nodeId) throws NotFoundException, OperationFailedException, PermissionDeniedException
nodeId
- the Id
of the Node
NotFoundException
- nodeId
is not foundNullArgumentException
- nodeId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateNode(NodeForm nodeForm) throws OperationFailedException, PermissionDeniedException
nodeForm
- the form containing the elements to be updatedIllegalStateException
- nodeForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- nodeForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- nodeForm
did not
originate from getNodeFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteNodes()
Nodes.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Node
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 Node
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteNode(Id nodeId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Node.
nodeId
- the Id
of the Node
to
removeNotFoundException
- nodeId
not foundNullArgumentException
- nodeId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageNodeAliases()
Id
aliases for node
entries. 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 Node
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasNode(Id nodeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Node
for the purpose of
creating compatibility. The primary Id
of the
Node
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another node, it is reassigned to the given node
Id.
nodeId
- the Id
of a Node
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- nodeId
not foundNullArgumentException
- nodeId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.