Interface EdgeAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
EdgeBatchAdminSession
This session creates, updates, and deletes Edges . 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 an
Edge , an EdgeForm is requested using
geEdgeFormForCreate() specifying the nodes and desired record
Types or none if no record Types are needed. The returned
EdgeForm 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 EdgeForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each EdgeForm corresponds to an attempted
transaction.
For updates, EdgeForms are requested to the Edge
Id that is to be updated using getEdgeFormForUpdate() .
Similarly, the EdgeForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
EdgeForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Edges . To unmap an Edge
from the current Graph , the EdgeGraphAssignmentSession
should be used. These delete operations attempt to remove the Edge
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto anEdgefor the purpose of creating compatibility.booleanTests if this user can createEdges.booleancanCreateEdgeWithRecordTypes(Type[] edgeRecordTypes) Tests if this user can create a singleEdgeusing the desired record types.booleanTests if this user can deleteEdges.booleanTests if this user can manageIdaliases for edges.booleanTests if this user can updateEdges.createEdge(EdgeForm edgeForm) Creates a newEdge.voiddeleteEdge(Id edgeId) Deletes anEdge.getEdgeFormForCreate(Id sourceNodeId, Id destinationNodeId, Type[] edgeRecordTypes) Gets the edge form for creating new edges.getEdgeFormForUpdate(Id edgeId) Gets the edge form for updating an existing edge.getGraph()Gets theGraphassociated with this session.Gets theGraphIdassociated with this session.voidupdateEdge(EdgeForm edgeForm) Updates an existing edge.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
-
getGraphId
Id getGraphId()Gets theGraphIdassociated with this session.- Returns:
- the
Graph Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getGraph
Gets theGraphassociated with this session.- Returns:
- the graph
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateEdges
boolean canCreateEdges()Tests if this user can createEdges. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anEdgewill 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:
falseifEdgecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateEdgeWithRecordTypes
Tests if this user can create a singleEdgeusing the desired record types. WhileTopologyManager.getEdgeRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificEdge. Providing an empty array tests if anEdgecan be created with no records.- Parameters:
edgeRecordTypes- array of edge record types- Returns:
trueifEdgecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-edgeRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getEdgeFormForCreate
EdgeForm getEdgeFormForCreate(Id sourceNodeId, Id destinationNodeId, Type[] edgeRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the edge form for creating new edges. A new form should be requested for each create transaction.- Parameters:
sourceNodeId- theIdof the starting node.destinationNodeId- theIdof the ending node.edgeRecordTypes- array of edge record types- Returns:
- the edge form
- Throws:
NotFoundException-sourceNodeIdordestinationNodeIdis not foundNullArgumentException-sourceNodeId, destinationNodeId, oredgeRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createEdge
Creates a newEdge.- Parameters:
edgeForm- the form for thisEdge- Returns:
- the new
Edge - Throws:
IllegalStateException-edgeFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-edgeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-edgeFormdid not originate fromgetEdgeFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateEdges
boolean canUpdateEdges()Tests if this user can updateEdges. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anEdgewill 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:
falseifEdgemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getEdgeFormForUpdate
EdgeForm getEdgeFormForUpdate(Id edgeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the edge form for updating an existing edge. A new edge form should be requested for each update transaction.- Parameters:
edgeId- theIdof theEdge- Returns:
- the edge form
- Throws:
NotFoundException-edgeIdis not foundNullArgumentException-edgeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateEdge
Updates an existing edge.- Parameters:
edgeForm- the form containing the elements to be updated- Throws:
IllegalStateException-edgeFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-edgeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-edgeFormdid not originate fromgetEdgeFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteEdges
boolean canDeleteEdges()Tests if this user can deleteEdges. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anEdgewill 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:
falseifEdgedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteEdge
void deleteEdge(Id edgeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anEdge.- Parameters:
edgeId- theIdof theEdgeto remove- Throws:
NotFoundException-edgeIdnot foundNullArgumentException-edgeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageEdgeAliases
boolean canManageEdgeAliases()Tests if this user can manageIdaliases for edges. 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:
falseifEdgealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasEdge
void aliasEdge(Id edgeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anEdgefor the purpose of creating compatibility. The primaryIdof theEdgeis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another edge, it is reassigned to the given edgeId.- Parameters:
edgeId- theIdof anEdgealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-edgeIdnot foundNullArgumentException-edgeIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-