Interface TermAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
TermBatchAdminSession
This session creates, updates, and deletes Terms . The data for
create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create a
term , a TermForm is requested using
getTermFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned TermForm 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 TermForm is submiited to a create operation,
it cannot be reused with another create operation unless the first
operation was unsuccessful. Each TermForm corresponds to an
attempted transaction.
For updates, TermForms are requested to the Term
Id that is to be updated using getTermFormForUpdate() .
Similarly, the TermForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
TermForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Terms . To unmap a Term
from the current CourseCatalog , the
TermCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the Term itself thus removing it from
all known CourseCatalog catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aTermfor the purpose of creating compatibility.booleanTests if this user can createTerms.booleancanCreateTermWithRecordTypes(Type[] termRecordTypes) Tests if this user can create a singleTermusing the desired record types.booleanTests if this user can deleteTerms.booleanTests if this user can manageIdaliases forTerms.booleanTests if this user can updateTerms.createTerm(TermForm termForm) Creates a newTerm.voiddeleteTerm(Id termId) Deletes aTerm.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getTermFormForCreate(Type[] termRecordTypes) Gets the term form for creating new terms.getTermFormForUpdate(Id termId) Gets the term form for updating an existing term.voidupdateTerm(TermForm termForm) Updates an existing term.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
-
getCourseCatalogId
Id getCourseCatalogId()Gets theCourseCatalogIdassociated with this session.- Returns:
- the
CourseCatalog Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCourseCatalog
Gets theCourseCatalogassociated with this session.- Returns:
- the course catalog
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateTerms
boolean canCreateTerms()Tests if this user can createTerms. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aTermwill 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:
falseifTermcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateTermWithRecordTypes
Tests if this user can create a singleTermusing the desired record types. WhileCourseManager.getTermRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificTerm. Providing an empty array tests if aTermcan be created with no records.- Parameters:
termRecordTypes- array of term record types- Returns:
trueifTermcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-termRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getTermFormForCreate
TermForm getTermFormForCreate(Type[] termRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the term form for creating new terms. A new form should be requested for each create transaction.- Parameters:
termRecordTypes- array of term record types- Returns:
- the term form
- Throws:
NullArgumentException-termRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createTerm
Creates a newTerm.- Parameters:
termForm- the form for thisTerm- Returns:
- the new
Term - Throws:
IllegalStateException-termFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-termFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-termFormdid not originate fromgetTermFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateTerms
boolean canUpdateTerms()Tests if this user can updateTerms. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aTermwill 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:
falseifTermmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getTermFormForUpdate
TermForm getTermFormForUpdate(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the term form for updating an existing term. A new term form should be requested for each update transaction.- Parameters:
termId- theIdof theTerm- Returns:
- the term form
- Throws:
NotFoundException-termIdis not foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateTerm
Updates an existing term.- Parameters:
termForm- the form containing the elements to be updated- Throws:
IllegalStateException-termFormalready used in anjupdate transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-termIdortermFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-termFormdid not originate fromgetTermFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteTerms
boolean canDeleteTerms()Tests if this user can deleteTerms. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aTermwill 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:
falseifTermdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteTerm
void deleteTerm(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aTerm.- Parameters:
termId- theIdof theTermto remove- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageTermAliases
boolean canManageTermAliases()Tests if this user can manageIdaliases forTerms. 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:
falseifTermaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasTerm
void aliasTerm(Id termId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aTermfor the purpose of creating compatibility. The primaryIdof theTermis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another term, it is reassigned to the given termId.- Parameters:
termId- theIdof aTermaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-termIdnot foundNullArgumentException-termIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-