Interface ActivityUnitAdminSession

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

public interface ActivityUnitAdminSession extends OsidSession

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 Details

    • getCourseCatalogId

      Id getCourseCatalogId()
      Gets the CourseCatalog Id associated with this session.
      Returns:
      the CourseCatalog Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getCourseCatalog

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

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

      boolean canCreateActivityUnitWithRecordTypes(Type[] activityUnitRecordTypes)
      Tests if this user can create a single ActivityUnit using the desired record types. While CourseManager.getActivityUnitRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ActivityUnit . Providing an empty array tests if an ActivityUnit can be created with no records.
      Parameters:
      activityUnitRecordTypes - array of activity unit record types
      Returns:
      true if ActivityUnit creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - activityUnitRecordTypes is null
      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 course Id
      activityUnitRecordTypes - array of activity unit record types
      Returns:
      the activity unit form
      Throws:
      NotFoundException - courseId is not found
      NullArgumentException - courseId or activityUnitRecordTypes 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.
    • createActivityUnit

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

      boolean canUpdateActivityUnits()
      Tests if this user can update ActivityUnits . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ActivityUnit 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 ActivityUnit modification is not authorized, true otherwise
      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 - the Id of the ActivityUnit
      Returns:
      the activity unit form
      Throws:
      NotFoundException - activityUnitId is not found
      NullArgumentException - activityUnitId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - activityForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - courseForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - activityUnitForm did not originate from getActivityUnitFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteActivityUnits

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

      void deleteActivityUnit(Id activityUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes an ActivityUnit .
      Parameters:
      activityUnitId - the Id of the ActivityUnit to remove
      Throws:
      NotFoundException - activityUnitId not found
      NullArgumentException - activityUnitId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageActivityUnitAliases

      boolean canManageActivityUnitAliases()
      Tests if this user can manage Id aliases for ActivityUnits . 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 ActivityUnit aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasActivityUnit

      void aliasActivityUnit(Id activityUnitId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
      Adds an Id to an ActivityUnit for the purpose of creating compatibility. The primary Id of the ActivityUnit is deactivityined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another activity unit, it is reassigned to the given activity unit Id .
      Parameters:
      activityUnitId - the Id of an ActivityUnit
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - activityUnitId not found
      NullArgumentException - activityUnitId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.