public interface TermAdminSession extends OsidSession
This session creates, updates, and deletes Terms.
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
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasTerm(Id termId,
Id aliasId)
Adds an
Id to a Term for the purpose of
creating compatibility. |
boolean |
canCreateTerms()
Tests if this user can create
Terms. |
boolean |
canCreateTermWithRecordTypes(Type[] termRecordTypes)
Tests if this user can create a single
Term using the
desired record types. |
boolean |
canDeleteTerms()
Tests if this user can delete
Terms. |
boolean |
canManageTermAliases()
Tests if this user can manage
Id aliases for
Terms. |
boolean |
canUpdateTerms()
Tests if this user can update
Terms. |
Term |
createTerm(TermForm termForm)
Creates a new
Term. |
void |
deleteTerm(Id termId)
Deletes a
Term. |
CourseCatalog |
getCourseCatalog()
Gets the
CourseCatalog associated with this session. |
Id |
getCourseCatalogId()
Gets the
CourseCatalog Id associated
with this session. |
TermForm |
getTermFormForCreate(Type[] termRecordTypes)
Gets the term form for creating new terms.
|
TermForm |
getTermFormForUpdate(Id termId)
Gets the term form for updating an existing term.
|
void |
updateTerm(TermForm termForm)
Updates an existing term.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCourseCatalogId()
CourseCatalog
Id
associated
with this session. CourseCatalog Id
associated with this
sessionmandatory
- This method must be implemented. CourseCatalog getCourseCatalog() throws OperationFailedException, PermissionDeniedException
CourseCatalog
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateTerms()
Terms.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Term
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 Term
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateTermWithRecordTypes(Type[] termRecordTypes)
Term
using the
desired record types. While CourseManager.getTermRecordTypes()
can be used to examine which records are supported, this
method tests which record(s) are required for creating a specific
Term.
Providing an empty array tests if a Term
can be created with no records.termRecordTypes
- array of term record types true
if Term
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- termRecordTypes
is null
mandatory
- This method must be implemented. TermForm getTermFormForCreate(Type[] termRecordTypes) throws OperationFailedException, PermissionDeniedException
termRecordTypes
- array of term record typesNullArgumentException
- termRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Term createTerm(TermForm termForm) throws OperationFailedException, PermissionDeniedException
Term.
termForm
- the form for this Term
Term
IllegalStateException
- termForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- termForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- termForm
did not
originate from getTermFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateTerms()
Terms.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Term
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 Term
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. TermForm getTermFormForUpdate(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- the Id
of the Term
NotFoundException
- termId
is not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateTerm(TermForm termForm) throws OperationFailedException, PermissionDeniedException
termForm
- the form containing the elements to be updatedIllegalStateException
- termForm
already
used in anjupdate transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- termId
or
termForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- termForm
did not
originate from getTermFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteTerms()
Terms.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Term
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 Term
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteTerm(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Term.
termId
- the Id
of the Term
to
removeNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageTermAliases()
Id
aliases for
Terms.
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 Term
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasTerm(Id termId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Term
for the purpose of
creating compatibility. The primary Id
of the
Term
is determined by the provider. The new Id
performs as an alias to the primary Id
. If the alias
is a pointer to another term, it is reassigned to the given term
Id.
termId
- the Id
of a Term
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- termId
not foundNullArgumentException
- termId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.