Interface OntologyAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
OntologyBatchAdminSession
This session creates, updates, and deletes Ontologies . 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
Ontology , an OntologyForm is requested using
getOntologyFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
OntologyForm 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 OntologyForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each OntologyForm corresponds to an attempted
transaction.
For updates, OntologyForms are requested to the
Ontology Id that is to be updated using
getOntologyFormForUpdate() . Similarly, the OntologyForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The OntologyForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Ontologies .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasOntology(Id ontologyId, Id aliasId) Adds anIdto anOntologyfor the purpose of creating compatibility.booleanTests if this user can createOntologies.booleancanCreateOntologyWithRecordTypes(Type[] ontologyRecordTypes) Tests if this user can create a singleOntologyusing the desired record types.booleanTests if this user can delete ontologies.booleanTests if this user can manageIdaliases for ontologies.booleanTests if this user can updateOntologies.createOntology(OntologyForm ontologyForm) Creates a newOntology.voiddeleteOntology(Id ontologyId) Deletes anOntology.getOntologyFormForCreate(Type[] ontologyRecordTypes) Gets the ontology form for creating new ontologies.getOntologyFormForUpdate(Id ontologyId) Gets the ontology form for updating an existing ontology.voidupdateOntology(OntologyForm ontologyForm) Updates an existing ontology.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
-
canCreateOntologies
boolean canCreateOntologies()Tests if this user can createOntologies. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anOntologywill 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:
falseifOntologycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateOntologyWithRecordTypes
Tests if this user can create a singleOntologyusing the desired record types. WhileOntologyManager.getOntologyRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificOntology. Providing an empty array tests if anOntologycan be created with no records.- Parameters:
ontologyRecordTypes- array of ontology record types- Returns:
trueifOntologycreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-ontologyRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getOntologyFormForCreate
OntologyForm getOntologyFormForCreate(Type[] ontologyRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the ontology form for creating new ontologies. A new form should be requested for each create transaction.- Parameters:
ontologyRecordTypes- array of ontology record types- Returns:
- the ontology form
- Throws:
NullArgumentException-ontologyRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createOntology
Ontology createOntology(OntologyForm ontologyForm) throws OperationFailedException, PermissionDeniedException Creates a newOntology.- Parameters:
ontologyForm- the form for thisOntology- Returns:
- the new
Ontology - Throws:
IllegalStateException-ontologyFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-ontologyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ontologyFormdid not originate fromgetOntologyFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateOntologies
boolean canUpdateOntologies()Tests if this user can updateOntologies. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anOntologywill 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:
falseifOntologymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOntologyFormForUpdate
OntologyForm getOntologyFormForUpdate(Id ontologyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the ontology form for updating an existing ontology. A new ontology form should be requested for each update transaction.- Parameters:
ontologyId- theIdof theOntology- Returns:
- the ontology form
- Throws:
NotFoundException-ontologyIdis not foundNullArgumentException-ontologyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateOntology
void updateOntology(OntologyForm ontologyForm) throws OperationFailedException, PermissionDeniedException Updates an existing ontology.- Parameters:
ontologyForm- the form containing the elements to be updated- Throws:
IllegalStateException-ontologyFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-ontologyFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-ontologyFormdid not originate fromgetOntologyFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteOntologies
boolean canDeleteOntologies()Tests if this user can delete ontologies. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anOntologywill 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:
falseifOntologydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteOntology
void deleteOntology(Id ontologyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anOntology.- Parameters:
ontologyId- theIdof theOntologyto remove- Throws:
NotFoundException-ontologyIdnot foundNullArgumentException-ontologyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageOntologyAliases
boolean canManageOntologyAliases()Tests if this user can manageIdaliases for ontologies. 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:
falseifOntologyaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasOntology
void aliasOntology(Id ontologyId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anOntologyfor the purpose of creating compatibility. The primaryIdof theOntologyis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another ontology, it is reassigned to the given ontologyId.- Parameters:
ontologyId- theIdof anOntologyaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-ontologyIdnot foundNullArgumentException-ontologyIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-