Interface GraphAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
GraphBatchAdminSession
This session creates, updates, and deletes Graphs . 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
Graph , a GraphForm is requested using
getGraphFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned GraphForm
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
GraphForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each GraphForm corresponds to an attempted transaction.
For updates, GraphForms are requested to the Graph
Id that is to be updated using getGraphFormForUpdate() .
Similarly, the GraphForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
GraphForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Graphs .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasGraph(Id graphId, Id aliasId) Adds anIdto aGraphfor the purpose of creating compatibility.booleanTests if this user can createGraphs.booleancanCreateGraphWithRecordTypes(Type[] graphRecordTypes) Tests if this user can create a singleGraphusing the desired record types.booleanTests if this user can deleteGraphs.booleanTests if this user can manageIdaliases for graphs.booleanTests if this user can updateGraphs.createGraph(GraphForm graphForm) Creates a newGraph.voiddeleteGraph(Id graphId) Deletes aGraph.getGraphFormForCreate(Type[] graphRecordTypes) Gets the graph form for creating new graphs.getGraphFormForUpdate(Id graphId) Gets the graph form for updating an existing graph.voidupdateGraph(GraphForm graphForm) Updates an existing graphMethods 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
-
canCreateGraphs
boolean canCreateGraphs()Tests if this user can createGraphs. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aGraph. will 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:
falseifGraphcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateGraphWithRecordTypes
Tests if this user can create a singleGraphusing the desired record types. WhileTopologyManager.getGraphRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificGraph. Providing an empty array tests if aGraphcan be created with no records.- Parameters:
graphRecordTypes- array of graph record types- Returns:
trueifGraphcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-graphRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getGraphFormForCreate
GraphForm getGraphFormForCreate(Type[] graphRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the graph form for creating new graphs. A new form should be requested for each create transaction.- Parameters:
graphRecordTypes- array of graph record types- Returns:
- the graph form
- Throws:
NullArgumentException-graphRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createGraph
Creates a newGraph.- Parameters:
graphForm- the form for thisGraph- Returns:
- the new
Graph - Throws:
IllegalStateException-graphFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-graphFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-graphFormdid not originate fromgetGraphFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateGraphs
boolean canUpdateGraphs()Tests if this user can updateGraphs. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aGraphwill 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:
falseifGraphmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getGraphFormForUpdate
GraphForm getGraphFormForUpdate(Id graphId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the graph form for updating an existing graph. A new graph form should be requested for each update transaction.- Parameters:
graphId- theIdof theGraph- Returns:
- the graph form
- Throws:
NotFoundException-graphIdis not foundNullArgumentException-graphIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateGraph
Updates an existing graph- Parameters:
graphForm- the form containing the elements to be updated- Throws:
IllegalStateException-graphFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-graphFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-graphFormdid not originate fromgetGraphFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteGraphs
boolean canDeleteGraphs()Tests if this user can deleteGraphs. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aGraphwill 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:
falseifGraphdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteGraph
void deleteGraph(Id graphId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aGraph.- Parameters:
graphId- theIdof theGraphto remove- Throws:
NotFoundException-graphIdnot foundNullArgumentException-graphIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageGraphAliases
boolean canManageGraphAliases()Tests if this user can manageIdaliases for graphs. 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:
falseifGraphaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasGraph
void aliasGraph(Id graphId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aGraphfor the purpose of creating compatibility. The primaryIdof theGraphis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another graph, it is reassigned to the given graphId.- Parameters:
graphId- theIdof aGraphaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-graphIdnot foundNullArgumentException-graphIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-