Interface PlanAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Plans . 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
Plan , a PlanForm is requested using
getPlanFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned PlanForm
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
PlanForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each PlanForm corresponds to an attempted transaction.
For updates, PlanForms are requested to the PlanForm
Id that is to be updated using getPlanFormForUpdate() .
Similarly, the PlanForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
PlanForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Plans . To unmap a Plan
from the current CourseCatalog , the
PlanCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the Plan 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 TypeMethodDescriptionvoidAdds anIdto aPlanfor the purpose of creating compatibility.booleanTests if this user can create plans.booleancanCreatePlanWithRecordTypes(Type[] planRecordTypes) Tests if this user can create a singlePlanusing the desired record types.booleanTests if this user can delete plans.booleanTests if this user can manageIdaliases forPlans.booleanTests if this user can update plans.createPlan(PlanForm planForm) Creates a newPlan.voiddeletePlan(Id planId) Deletes aPlan.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.getPlanFormForCreate(Id syllabusId, Id courseOfferingId, Type[] planRecordTypes) Gets the plan form for creating new plans.getPlanFormForUpdate(Id planId) Gets the plan form for updating an existing plan.voidupdatePlan(PlanForm planForm) Updates an existing plan.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.
-
canCreatePlans
boolean canCreatePlans()Tests if this user can create plans. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPlanwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifPlancreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePlanWithRecordTypes
Tests if this user can create a singlePlanusing the desired record types. WhileCoursePlanManager.getPlanRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPlan. Providing an empty array tests if aPlancan be created with no records.- Parameters:
planRecordTypes- array of plan record types- Returns:
trueifPlancreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-planRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPlanFormForCreate
PlanForm getPlanFormForCreate(Id syllabusId, Id courseOfferingId, Type[] planRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the plan form for creating new plans. A new form should be requested for each create transaction.- Parameters:
syllabusId- a syllabusIdcourseOfferingId- a course offeringIdplanRecordTypes- array of plan record types- Returns:
- the plan form
- Throws:
NotFoundException-syllabusIdorcourseOfferingIdis not foundNullArgumentException-syllabusId, courseOfferingId, orplanRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createPlan
Creates a newPlan.- Parameters:
planForm- the form for thisPlan- Returns:
- the new
Plan - Throws:
IllegalStateException-planFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-planFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-planFormdid not originate fromgetPlanFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePlans
boolean canUpdatePlans()Tests if this user can update plans. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPlanwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifPlanmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getPlanFormForUpdate
PlanForm getPlanFormForUpdate(Id planId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the plan form for updating an existing plan. A new plan form should be requested for each update transaction.- Parameters:
planId- theIdof thePlan- Returns:
- the plan form
- Throws:
NotFoundException-planIdis not foundNullArgumentException-planIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePlan
Updates an existing plan.- Parameters:
planForm- the form containing the elements to be updated- Throws:
IllegalStateException-planFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-planFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-planFormdid not originate fromgetPlanFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePlans
boolean canDeletePlans()Tests if this user can delete plans. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anPlanwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifPlandeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deletePlan
void deletePlan(Id planId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aPlan.- Parameters:
planId- theIdof thePlanto remove- Throws:
NotFoundException-planIdnot foundNullArgumentException-planIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePlanAliases
boolean canManagePlanAliases()Tests if this user can manageIdaliases forPlans. 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:
falseifPlanaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPlan
void aliasPlan(Id planId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPlanfor the purpose of creating compatibility. The primaryIdof thePlanis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another plan, it is reassigned to the given planId.- Parameters:
planId- theIdof aPlanaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-planIdnot foundNullArgumentException-planIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-