Interface ActivityAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
ActivityBatchAdminSession

public interface ActivityAdminSession extends OsidSession

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 Details

    • getObjectiveBankId

      Id getObjectiveBankId()
      Gets the ObjectiveBank Id associated with this session.
      Returns:
      the ObjectiveBank Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getObjectiveBank

      Gets the ObjectiveBank associated with this session.
      Returns:
      the ObjectiveBank associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateActivities

      boolean canCreateActivities()
      Tests if this user can create Activities . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Activity 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.
      Returns:
      false if Activity creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateActivityWithRecordTypes

      boolean canCreateActivityWithRecordTypes(Type[] activityRecordTypes)
      Tests if this user can create a single Activity using the desired record types. While LearningManager.getActivityRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Activity . Providing an empty array tests if an Activity can be created with no records.
      Parameters:
      activityRecordTypes - array of activity record types
      Returns:
      true if Activity creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - activityRecordTypes is null
      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 - the Id of the Objective
      activityRecordTypes - array of activity record types
      Returns:
      the activity form
      Throws:
      NotFoundException - objectiveId is not found
      NullArgumentException - objectiveId or activityRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createActivity

      Creates a new Activity .
      Parameters:
      activityForm - the form for this Activity
      Returns:
      the new Activity
      Throws:
      IllegalStateException - activityForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - activityForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - activityForm did not originate from getActivityFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateActivities

      boolean canUpdateActivities()
      Tests if this user can update Activities . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Activity 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.
      Returns:
      false if activity modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getActivityFormForUpdate

      Gets the activity form for updating an existing activity. A new activity form should be requested for each update transaction.
      Parameters:
      activityId - the Id of the Activity
      Returns:
      the activity form
      Throws:
      NotFoundException - activityId is not found
      NullArgumentException - activityId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - activityForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - activityForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - activityForm did not originate from getActivityFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteActivities

      boolean canDeleteActivities()
      Tests if this user can delete Activities . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Activity 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.
      Returns:
      false if Activity deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteActivity

      void deleteActivity(Id activityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes the Activity identified by the given Id .
      Parameters:
      activityId - the Id of the Activity to delete
      Throws:
      NotFoundException - an Activity was not found identified by the given Id
      NullArgumentException - activityId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageActivityAliases

      boolean canManageActivityAliases()
      Tests if this user can manage Id aliases 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 a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if Activity aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasActivity

      Adds an Id to an Activity for the purpose of creating compatibility. The primary Id of the Activity is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another activity, it is reassigned to the given activity Id .
      Parameters:
      activityId - the Id of an Activity
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - activityId not found
      NullArgumentException - activityId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.