Interface ActivityUnitAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ActivityUnitBatchAdminSession
This session creates, updates, and deletes ActivityUnit . The
data for create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be
reused.
Create and update operations differ in their usage. To create an
ActivityUnit , an ActivityUnitForm is requested using
getActivityUnitFormForCreate() specifying the desired course and
record Types or none if no record Types are needed. The
returned ActivityUnitForm 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 ActivityUnitForm is submiited to a
create operation, it cannot be reused with another create operation unless
the first operation was unsuccessful. Each ActivityUnitForm
corresponds to an attempted transaction.
For updates, ActivityUnitForms are requested to the
ActivityUnit Id that is to be updated using
getActivityUnitFormForUpdate() . Similarly, the ActivityUnitForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The ActivityUnitForm can
only be used once for a successful update and cannot be reused.
The delete operations delete ActivityUnits . To unmap an
ActivityUnit from the current CourseCatalog , the
ActivityUnitCourseCatalogAssignmentSession should be used. These delete
operations attempt to remove the ActivityUnit 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 TypeMethodDescriptionvoidaliasActivityUnit(Id activityUnitId, Id aliasId) Adds anIdto anActivityUnitfor the purpose of creating compatibility.booleanTests if this user can createActivityUnits.booleancanCreateActivityUnitWithRecordTypes(Type[] activityUnitRecordTypes) Tests if this user can create a singleActivityUnitusing the desired record types.booleanTests if this user can deleteActivityUnits.booleanTests if this user can manageIdaliases forActivityUnits.booleanTests if this user can updateActivityUnits.createActivityUnit(ActivityUnitForm activityUnitForm) Creates a newActivityUnit.voiddeleteActivityUnit(Id activityUnitId) Deletes anActivityUnit.getActivityUnitFormForCreate(Id courseId, Type[] activityUnitRecordTypes) Gets the activity unit form for creating new activity units.getActivityUnitFormForUpdate(Id activityUnitId) Gets the activity unit form for updating an existing activity unit.Gets theCourseCatalogassociated with this session.Gets theCourseCatalogIdassociated with this session.voidupdateActivityUnit(ActivityUnitForm activityUnitForm) Updates an existing activity unit.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.
-
canCreateActivityUnits
boolean canCreateActivityUnits()Tests if this user can createActivityUnits. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anActivityUnitwill 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:
falseifActivityUnitcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateActivityUnitWithRecordTypes
Tests if this user can create a singleActivityUnitusing the desired record types. WhileCourseManager.getActivityUnitRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificActivityUnit. Providing an empty array tests if anActivityUnitcan be created with no records.- Parameters:
activityUnitRecordTypes- array of activity unit record types- Returns:
trueifActivityUnitcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-activityUnitRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getActivityUnitFormForCreate
ActivityUnitForm getActivityUnitFormForCreate(Id courseId, Type[] activityUnitRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity unit form for creating new activity units. A new form should be requested for each create transaction.- Parameters:
courseId- the courseIdactivityUnitRecordTypes- array of activity unit record types- Returns:
- the activity unit form
- Throws:
NotFoundException-courseIdis not foundNullArgumentException-courseIdoractivityUnitRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createActivityUnit
ActivityUnit createActivityUnit(ActivityUnitForm activityUnitForm) throws OperationFailedException, PermissionDeniedException Creates a newActivityUnit.- Parameters:
activityUnitForm- the form for thisActivityUnit- Returns:
- the new
ActivityUnit - Throws:
IllegalStateException-activityFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-activityUnitFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityUnitForm did not originate from getActivityUnitFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateActivityUnits
boolean canUpdateActivityUnits()Tests if this user can updateActivityUnits. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anActivityUnitwill 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:
falseifActivityUnitmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getActivityUnitFormForUpdate
ActivityUnitForm getActivityUnitFormForUpdate(Id activityUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity unit form for updating an existing activity unit. A new activity unit form should be requested for each update transaction.- Parameters:
activityUnitId- theIdof theActivityUnit- Returns:
- the activity unit form
- Throws:
NotFoundException-activityUnitIdis not foundNullArgumentException-activityUnitIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateActivityUnit
void updateActivityUnit(ActivityUnitForm activityUnitForm) throws OperationFailedException, PermissionDeniedException Updates an existing activity unit.- Parameters:
activityUnitForm- the form containing the elements to be updated- Throws:
IllegalStateException-activityFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-courseFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityUnitForm did not originate from getActivityUnitFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteActivityUnits
boolean canDeleteActivityUnits()Tests if this user can deleteActivityUnits. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anActivityUnitwill 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:
falseifActivityUnitdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteActivityUnit
void deleteActivityUnit(Id activityUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anActivityUnit.- Parameters:
activityUnitId- theIdof theActivityUnitto remove- Throws:
NotFoundException-activityUnitIdnot foundNullArgumentException-activityUnitIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageActivityUnitAliases
boolean canManageActivityUnitAliases()Tests if this user can manageIdaliases forActivityUnits. 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:
falseifActivityUnitaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasActivityUnit
void aliasActivityUnit(Id activityUnitId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anActivityUnitfor the purpose of creating compatibility. The primaryIdof theActivityUnitis deactivityined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another activity unit, it is reassigned to the given activity unitId.- Parameters:
activityUnitId- theIdof anActivityUnitaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-activityUnitIdnot foundNullArgumentException-activityUnitIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-