Interface ProgramAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ProgramBatchAdminSession, ProgramOfferingBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasProgram(Id programId, Id aliasId) Adds anIdto aProgramfor the purpose of creating compatibility.booleanTests if this user can createPrograms.booleancanCreateProgramWithRecordTypes(Type[] programRecordTypes) Tests if this user can create a singlePorgramusing the desired record types.booleanTests if this user can deletePrograms.booleanTests if this user can manageIdaliases forPrograms.booleanTests if this user can updatePrograms.createProgram(ProgramForm programForm) Creates a newProgram.voiddeleteProgram(Id programId) Deletes aProgram.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getProgramFormForCreate(Type[] programRecordTypes) Gets the program form for creating new programs.getProgramFormForUpdate(Id programId) Gets the program form for updating an existing course.voidupdateProgram(ProgramForm programForm) Updates an existing program.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.
-
canCreatePrograms
boolean canCreatePrograms()Tests if this user can createPrograms. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aprogramwill 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:
falseifProgramcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateProgramWithRecordTypes
Tests if this user can create a singlePorgramusing the desired record types. WhileCourseProgramManager.getProgramRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificProgram. Providing an empty array tests if aprogramcan be created with no records.- Parameters:
programRecordTypes- array of program record types- Returns:
trueifProgramcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-programRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getProgramFormForCreate
ProgramForm getProgramFormForCreate(Type[] programRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the program form for creating new programs. A new form should be requested for each create transaction.- Parameters:
programRecordTypes- array of program record types- Returns:
- the program form
- Throws:
NullArgumentException-programRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createProgram
Program createProgram(ProgramForm programForm) throws OperationFailedException, PermissionDeniedException Creates a newProgram.- Parameters:
programForm- the form for thisProgram- Returns:
- the new
Program - Throws:
IllegalStateException-programFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-programFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-programFormdid not originate fromgetProgramFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePrograms
boolean canUpdatePrograms()Tests if this user can updatePrograms. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aprogramwill 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:
falseifProgrammodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getProgramFormForUpdate
ProgramForm getProgramFormForUpdate(Id programId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the program form for updating an existing course. A new program form should be requested for each update transaction.- Parameters:
programId- theIdof theProgram- Returns:
- the program form
- Throws:
NotFoundException-programIdis not foundNullArgumentException-programIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateProgram
void updateProgram(ProgramForm programForm) throws OperationFailedException, PermissionDeniedException Updates an existing program.- Parameters:
programForm- the form containing the elements to be updated- Throws:
IllegalStateException-programFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-programFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-programFormdid not originate fromgetProgramFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePrograms
boolean canDeletePrograms()Tests if this user can deletePrograms. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aProgramwill 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:
falseifProgramdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteProgram
void deleteProgram(Id programId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aProgram.- Parameters:
programId- theIdof theProgramto remove- Throws:
NotFoundException-programIdnot foundNullArgumentException-programIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageProgramAliases
boolean canManageProgramAliases()Tests if this user can manageIdaliases forPrograms. 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:
falseifProgramaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasProgram
void aliasProgram(Id programId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aProgramfor the purpose of creating compatibility. The primaryIdof theProgramis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another program, it is reassigned to the given programId.- Parameters:
programId- theIdof aProgramaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-programIdnot foundNullArgumentException-programIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-