Interface GradeAdminSession

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

public interface GradeAdminSession extends OsidSession

This session creates, updates, and deletes Grades . 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 Grade , a GradeForm is requested using getGradeFormForCreate() specifying the desired grade system and record Types or none if no record Types are needed. The returned GradeForm 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 GradeForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each GradeForm corresponds to an attempted transaction.

For updates, GradeForms are requested to the Grade Id that is to be updated using getGradeFormForUpdate() . Similarly, the GradeForm has metadata about the data that can be updated and it can perform validation before submitting the update. The GradeForm can only be used once for a successful update and cannot be reused.

The delete operations delete Grades . To unmap a Grade from the current Gradebook , the GradeGradebookAssignmentSession should be used. These delete operations attempt to remove the Grade itself thus removing it from all known Gradebook catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id .

  • Method Details

    • getGradebookId

      Id getGradebookId()
      Gets the Gradebook Id associated with this session.
      Returns:
      the Gradebook Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getGradebook

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

      boolean canCreateGrades()
      Tests if this user can create Grades . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Grade will result in a PERMISSION_DENIED. Th is is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if Grade creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateGradeWithRecordTypes

      boolean canCreateGradeWithRecordTypes(Type[] gradeRecordTypes)
      Tests if this user can create a single Grade using the desired record types. While GradingManager.getGradeRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Grade . Providing an empty array tests if a Grade can be cr eated with no records.
      Parameters:
      gradeRecordTypes - array of grade record types
      Returns:
      true if Grade creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - gradeRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getGradeFormForCreate

      GradeForm getGradeFormForCreate(Id gradeSystemId, Type[] gradeRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the grade form for creating new grades. A new form should be requested for each create transaction.
      Parameters:
      gradeSystemId - a grade system Id
      gradeRecordTypes - array of grade record types
      Returns:
      the grade form
      Throws:
      NotFoundException - gradeSystemId not found
      NullArgumentException - gradeSystemId or gradeRecordTypes 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.
    • createGrade

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

      boolean canUpdateGrades()
      Tests if this user can update Grades . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Grade will result in a PERMISSION_DENIED. Th is is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if Grade modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getGradeFormForUpdate

      Gets the grade form for updating an existing grade. A new grade form should be requested for each update transaction.
      Parameters:
      gradeId - the Id of the Grade
      Returns:
      the grade form
      Throws:
      NotFoundException - gradeId is not found
      NullArgumentException - gradeId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateGrade

      void updateGrade(GradeForm gradeForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing grade.
      Parameters:
      gradeForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - gradeForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - gradeForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - gradeForm did not originate from getGradeFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteGrades

      boolean canDeleteGrades()
      Tests if this user can delete Grades . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Grade will result in a PERMISSION_DENIED. Th is is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if Grade deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteGrade

      Deletes a Grade .
      Parameters:
      gradeId - the Id of the Grade to remove
      Throws:
      NotFoundException - gradeId not found
      NullArgumentException - gradeId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageGradeAliases

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

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