public interface LessonAdminSession extends OsidSession
This session creates, updates, and deletes Lessons.
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
Lesson,
a LessonForm
is requested using
getLessonFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned LessonForm
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 LessonForm
is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each LessonForm
corresponds to an attempted transaction.
For updates, LessonForms
are requested to the
Lesson
Id
that is to be updated using
getLessonForUpdate().
Similarly, the LessonForm
has
metadata about the data that can be updated and it can perform validation
before submitting the update. The LessonForm
can only be
used once for a successful update and cannot be reused.
The delete operations delete Lessons.
To unmap a
Lesson
from the current CourseCatalog,
the
LessonCourseCatalogAssignmentSession
should be used. These delete
operations attempt to remove the Lesson
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 |
aliasLesson(Id lessonId,
Id aliasId)
Adds an
Id to a Lesson for the purpose
of creating compatibility. |
boolean |
canCreateLessons()
Tests if this user can create
Lessons. |
boolean |
canCreateLessonWithRecordTypes(Type[] lessonRecordTypes)
Tests if this user can create a single
Lesson using the
desired record types. |
boolean |
canDeleteLessons()
Tests if this user can delete
Lessons A return of true
does not guarantee successful authorization. |
boolean |
canManageLessonAliases()
Tests if this user can manage
Id aliases for
Lessons. |
boolean |
canUpdateLessons()
Tests if this user can update
Lessons. |
Lesson |
createLesson(LessonForm lessonForm)
Creates a new
Lesson. |
void |
deleteLesson(Id lessonId)
Deletes a
Lesson. |
CourseCatalog |
getCourseCatalog()
Gets the
CourseCatalog associated with this session. |
Id |
getCourseCatalogId()
Gets the
CourseCatalog Id associated
with this session. |
LessonForm |
getLessonFormForCreate(Id planId,
Id docetId,
Type[] lessonRecordTypes)
Gets the lesson form for creating new lessons.
|
LessonForm |
getLessonFormForUpdate(Id lessonId)
Gets the lesson form for updating an existing lesson.
|
void |
updateLesson(LessonForm lessonForm)
Updates an existing lesson.
|
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 canCreateLessons()
Lessons.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Lesson
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer create operations to
unauthorized users. false
if Lesson
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateLessonWithRecordTypes(Type[] lessonRecordTypes)
Lesson
using the
desired record types. While
CoursePlanManager.getLessonRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Lesson.
Providing
an empty array tests if a Lesson
can be created with no
records.lessonRecordTypes
- array of lesson record types true
if Lesson
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- lessonRecordTypes
is null
mandatory
- This method must be implemented. LessonForm getLessonFormForCreate(Id planId, Id docetId, Type[] lessonRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
planId
- a plan Id
docetId
- a docet Id
lessonRecordTypes
- array of lesson record typesNotFoundException
- planId
or
docetId
is not foundNullArgumentException
- planId, docetId
or lessonRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Lesson createLesson(LessonForm lessonForm) throws OperationFailedException, PermissionDeniedException
Lesson.
lessonForm
- the form for this Lesson
Lesson
IllegalStateException
- lessonForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- lessonForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- lessonForm
did
not originate from getLessonFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateLessons()
Lessons.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Lesson
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer update operations to
unauthorized users. false
if Lesson
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. LessonForm getLessonFormForUpdate(Id lessonId) throws NotFoundException, OperationFailedException, PermissionDeniedException
lessonId
- the Id
of the Lesson
NotFoundException
- lessonId
is not
foundNullArgumentException
- lessonId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateLesson(LessonForm lessonForm) throws OperationFailedException, PermissionDeniedException
lessonForm
- the form containing the elements to be updatedIllegalStateException
- lessonForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- lessonForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- lessonForm
did
not originate from getLessonFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteLessons()
Lessons
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Lesson
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may not wish to offer delete operations to
unauthorized users. false
if Lesson
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteLesson(Id lessonId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Lesson.
lessonId
- the Id
of the Lesson
to
removeNotFoundException
- lessonId
not foundNullArgumentException
- lessonId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageLessonAliases()
Id
aliases for
Lessons.
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 Lesson
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasLesson(Id lessonId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Lesson
for the purpose
of creating compatibility. The primary Id
of the
Lesson
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another lesson, it is reassigned to the given
lesson Id.
lessonId
- the Id
of a Lesson
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- lessonId
not foundNullArgumentException
- lessonId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.