Interface ActivityAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ActivityBatchAdminSession
This session creates, updates, and deletes Activities . 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 an
Activity , an ActivityForm is requested using
getActivityFormForCreate() specifying the desired objective and record
Types or none if no record Types are needed. The returned
ActivityForm 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 ActivityForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each ActivityForm corresponds to
an attempted transaction.
For updates, ActivityForms are requested to the
Activity Id that is to be updated using
getActivityFormForUpdate() . Similarly, the ActivityForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The ActivityForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Activities . To unmap an
Activity from the current ObjectiveBank , the
ActivityObjectiveBankAssignmentSession should be used. These delete
operations attempt to remove the Activity itself thus removing it
from all known ObjectiveBank catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasActivity(Id activityId, Id aliasId) Adds anIdto anActivityfor the purpose of creating compatibility.booleanTests if this user can createActivities.booleancanCreateActivityWithRecordTypes(Type[] activityRecordTypes) Tests if this user can create a singleActivityusing the desired record types.booleanTests if this user can deleteActivities.booleanTests if this user can manageIdaliases for activities.booleanTests if this user can updateActivities.createActivity(ActivityForm activityForm) Creates a newActivity.voiddeleteActivity(Id activityId) Deletes theActivityidentified by the givenId.getActivityFormForCreate(Id objectiveId, Type[] activityRecordTypes) Gets the activity form for creating new activities.getActivityFormForUpdate(Id activityId) Gets the activity form for updating an existing activity.Gets theObjectiveBankassociated with this session.Gets theObjectiveBankIdassociated with this session.voidupdateActivity(ActivityForm activityForm) Updates an existing activity,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
-
getObjectiveBankId
Id getObjectiveBankId()Gets theObjectiveBankIdassociated with this session.- Returns:
- the
ObjectiveBank Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getObjectiveBank
Gets theObjectiveBankassociated with this session.- Returns:
- the
ObjectiveBankassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateActivities
boolean canCreateActivities()Tests if this user can createActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anActivitywill 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:
falseifActivitycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateActivityWithRecordTypes
Tests if this user can create a singleActivityusing the desired record types. WhileLearningManager.getActivityRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificActivity. Providing an empty array tests if anActivitycan be created with no records.- Parameters:
activityRecordTypes- array of activity record types- Returns:
trueifActivitycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-activityRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getActivityFormForCreate
ActivityForm getActivityFormForCreate(Id objectiveId, Type[] activityRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity form for creating new activities. A new form should be requested for each create transaction.- Parameters:
objectiveId- theIdof theObjectiveactivityRecordTypes- array of activity record types- Returns:
- the activity form
- Throws:
NotFoundException-objectiveIdis not foundNullArgumentException-objectiveIdoractivityRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createActivity
Activity createActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException Creates a newActivity.- Parameters:
activityForm- the form for thisActivity- Returns:
- the new
Activity - Throws:
IllegalStateException-activityFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-activityFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityFormdid not originate fromgetActivityFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateActivities
boolean canUpdateActivities()Tests if this user can updateActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anActivitywill 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:
falseif activity modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getActivityFormForUpdate
ActivityForm getActivityFormForUpdate(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the activity form for updating an existing activity. A new activity form should be requested for each update transaction.- Parameters:
activityId- theIdof theActivity- Returns:
- the activity form
- Throws:
NotFoundException-activityIdis not foundNullArgumentException-activityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateActivity
void updateActivity(ActivityForm activityForm) throws OperationFailedException, PermissionDeniedException Updates an existing activity,- Parameters:
activityForm- the form containing the elements to be updated- Throws:
IllegalStateException-activityFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-activityFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-activityFormdid not originate fromgetActivityFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteActivities
boolean canDeleteActivities()Tests if this user can deleteActivities. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anActivitywill 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:
falseifActivitydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteActivity
void deleteActivity(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theActivityidentified by the givenId.- Parameters:
activityId- theIdof theActivityto delete- Throws:
NotFoundException- anActivitywas not found identified by the givenIdNullArgumentException-activityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageActivityAliases
boolean canManageActivityAliases()Tests if this user can manageIdaliases for activities. 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:
falseifActivityaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasActivity
void aliasActivity(Id activityId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anActivityfor the purpose of creating compatibility. The primaryIdof theActivityis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another activity, it is reassigned to the given activityId.- Parameters:
activityId- theIdof anActivityaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-activityIdnot foundNullArgumentException-activityIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-