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