public interface CourseAdminSession extends OsidSession
This session creates, updates, and deletes Courses.
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
Course,
a CourseForm
is requested using
getCourseFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned CourseForm
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 CourseForm
is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each CourseForm
corresponds to an attempted transaction.
For updates, CourseForms
are requested to the
Course
Id
that is to be updated using
getCourseFormForUpdate().
Similarly, the CourseForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The CourseForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Courses.
To unmap a
Course
from the current CourseCatalog,
the
CourseCourseCatalogAssignmentSession
should be used. These delete
operations attempt to remove the Course
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 |
aliasCourse(Id courseId,
Id aliasId)
Adds an
Id to a Course for the purpose
of creating compatibility. |
boolean |
canCreateCourses()
Tests if this user can create
Courses. |
boolean |
canCreateCourseWithRecordTypes(Type[] courseRecordTypes)
Tests if this user can create a single
Course using the
desired record types. |
boolean |
canDeleteCourses()
Tests if this user can delete
Courses. |
boolean |
canManageCourseAliases()
Tests if this user can manage
Id aliases for
Courses. |
boolean |
canUpdateCourses()
Tests if this user can update
Courses. |
Course |
createCourse(CourseForm courseForm)
Creates a new
Course. |
void |
deleteCourse(Id courseId)
Deletes a
Course. |
CourseCatalog |
getCourseCatalog()
Gets the
CourseCatalog associated with this session. |
Id |
getCourseCatalogId()
Gets the
CourseCatalog Id associated
with this session. |
CourseForm |
getCourseFormForCreate(Type[] courseRecordTypes)
Gets the course form for creating new courses.
|
CourseForm |
getCourseFormForUpdate(Id courseId)
Gets the course form for updating an existing course.
|
void |
updateCourse(CourseForm courseForm)
Updates an existing course.
|
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 canCreateCourses()
Courses.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Course
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 Course
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateCourseWithRecordTypes(Type[] courseRecordTypes)
Course
using the
desired record types. While
CourseManager.getCourseRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Course.
Providing an
empty array tests if a Course
can be created with no
records.courseRecordTypes
- array of course record types true
if Course
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- courseRecordTypes
is null
mandatory
- This method must be implemented. CourseForm getCourseFormForCreate(Type[] courseRecordTypes) throws OperationFailedException, PermissionDeniedException
courseRecordTypes
- array of course record typesNullArgumentException
- courseRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Course createCourse(CourseForm courseForm) throws OperationFailedException, PermissionDeniedException
Course.
courseForm
- the form for this Course
Course
IllegalStateException
- courseForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- courseForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- courseForm did not
originate from getCourseFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateCourses()
Courses.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Course
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 Course
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. CourseForm getCourseFormForUpdate(Id courseId) throws NotFoundException, OperationFailedException, PermissionDeniedException
courseId
- the Id
of the Course
NotFoundException
- courseId
is not
foundNullArgumentException
- courseId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateCourse(CourseForm courseForm) throws OperationFailedException, PermissionDeniedException
courseForm
- the form containing the elements to be updatedIllegalStateException
- courseForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- courseForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- courseForm did not
originate from getCourseFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteCourses()
Courses.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Course
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 Course
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteCourse(Id courseId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Course.
courseId
- the Id
of the Course
to
removeNotFoundException
- courseId
not foundNullArgumentException
- courseId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageCourseAliases()
Id
aliases for
Courses.
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 Course
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasCourse(Id courseId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Course
for the purpose
of creating compatibility. The primary Id
of the
Course
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another course, it is reassigned to the given
course Id.
courseId
- the Id
of a Course
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- courseId
not foundNullArgumentException
- courseId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.