org.sakaiproject.tool.gradebook.business
Interface GradeManager

All Known Implementing Classes:
GradeManagerHibernateImpl

public interface GradeManager

Manages GradableRecord persistence.

Author:
Josh Holtzman

Method Summary
 Long createAssignment(Long gradebookId, String name, Double points, Date dueDate, Boolean isNotCounted)
          Add a new assignment to a gradebook
 List getAssignments(Long gradebookId)
          Convenience method to get assignments with the default sort ordering
 List getAssignments(Long gradebookId, String sortBy, boolean ascending)
          Fetches a List of Assignments, but does not populate non-persistent fields.
 List getAssignmentsAndCourseGradeWithStats(Long gradebookId, String sortBy, boolean ascending)
          Same as the other getAssignmentsWithStats except for tacking the CourseGrade (with statistics) at the end of the list.
 List getAssignmentsWithStats(Long gradebookId, String sortBy, boolean ascending)
          Fetches a List of Assignments for a given gradebook, and populates the Assignments with all of the statistics fields available in the Assignment object.
 Assignment getAssignmentWithStats(Long assignmentId)
          Fetches an assignment and populates its non-persistent statistics fields.
 CourseGrade getCourseGrade(Long gradebookId)
          Fetches the course grade for a gradebook
 CourseGrade getCourseGradeWithStats(Long gradebookId)
          Fetches the course grade for a gradebook and populates its non-persistent statistics fields
 GradableObject getGradableObject(Long gradableObjectId)
          Fetches a GradableObject
 GradingEvents getGradingEvents(GradableObject gradableObject, Collection enrollments)
          Gets the grading events for the enrollments on the given gradable object.
 List getPointsEarnedSortedAllGradeRecords(Long gradebookId, Collection studentUids)
          Gets all grade records that belong to a collection of enrollments in a gradebook.
 List getPointsEarnedSortedGradeRecords(GradableObject gradableObject, Collection studentUids)
          Get all grade records for the given gradable object and the given set of student UIDs
 CourseGradeRecord getStudentCourseGradeRecord(Gradebook gradebook, String studentId)
          Gets the course grade for a single student.
 List getStudentGradeRecords(Long gradebookId, String studentId)
          Gets all grade records for a single student in a single gradebook, not including the course grade.
 double getTotalPoints(Long gradebookId)
           
 boolean isEnteredAssignmentScores(Long assignmentId)
          Gets whether scores have been entered for the given assignment.
 boolean isExplicitlyEnteredCourseGradeRecords(Long gradebookId)
          Gets whether there are explicitly entered course grade records in a gradebook.
 void updateAssignment(Assignment assignment)
          Updates an existing assignment
 Set updateAssignmentGradeRecords(GradeRecordSet gradeRecordSet)
          Updates the grade records in the GradeRecordSet.
 void updateCourseGradeRecords(GradeRecordSet gradeRecordSet)
          Updates the grade records for the keys (student IDs) in the studentsToPoints map.
 void updateCourseGradeRecordSortValues(Long gradebookId, boolean manuallyEnteredRecords)
          Updates the values used for sorting on any course grade record where a letter grade has (or hasn't) been explicitly set.
 

Method Detail

getPointsEarnedSortedGradeRecords

public List getPointsEarnedSortedGradeRecords(GradableObject gradableObject,
                                              Collection studentUids)
Get all grade records for the given gradable object and the given set of student UIDs

Parameters:
gradableObject - Find grade records for this gradable object
studentUids -
Returns:
A List of grade records

getPointsEarnedSortedAllGradeRecords

public List getPointsEarnedSortedAllGradeRecords(Long gradebookId,
                                                 Collection studentUids)
Gets all grade records that belong to a collection of enrollments in a gradebook.

Parameters:
gradebookId -
studentUids -

isExplicitlyEnteredCourseGradeRecords

public boolean isExplicitlyEnteredCourseGradeRecords(Long gradebookId)
Gets whether there are explicitly entered course grade records in a gradebook. (This may include grades for students who are not currently enrolled.)

Parameters:
gradebookId - The gradebook
Returns:
Whether there are course grade records that have a non-null enteredGrade field

isEnteredAssignmentScores

public boolean isEnteredAssignmentScores(Long assignmentId)
Gets whether scores have been entered for the given assignment. (This may include scores for students who are not currently enrolled.)

Parameters:
assignmentId - The assignment
Returns:
How many scores have been entered for the assignment

updateAssignmentGradeRecords

public Set updateAssignmentGradeRecords(GradeRecordSet gradeRecordSet)
                                 throws StaleObjectModificationException
Updates the grade records in the GradeRecordSet. Implementations of this method should add a new GradingEvent for each grade record modified, and should update the autocalculated value for each graded student's CourseGradeRecord.

Returns:
The set of student UIDs who were given scores higher than the assignment's value.
Throws:
StaleObjectModificationException

updateCourseGradeRecords

public void updateCourseGradeRecords(GradeRecordSet gradeRecordSet)
                              throws StaleObjectModificationException
Updates the grade records for the keys (student IDs) in the studentsToPoints map. Map values must be valid strings (that exist in the gradebook's grade mapping) or nulls.

Throws:
StaleObjectModificationException

getStudentGradeRecords

public List getStudentGradeRecords(Long gradebookId,
                                   String studentId)
Gets all grade records for a single student in a single gradebook, not including the course grade.

Parameters:
gradebookId - The gradebook id
studentId - The unique student identifier
Returns:
A List of all of this student's grade records in the gradebook

getStudentCourseGradeRecord

public CourseGradeRecord getStudentCourseGradeRecord(Gradebook gradebook,
                                                     String studentId)
Gets the course grade for a single student.


getGradingEvents

public GradingEvents getGradingEvents(GradableObject gradableObject,
                                      Collection enrollments)
Gets the grading events for the enrollments on the given gradable object.

Parameters:
gradableObject -
enrollments -
Returns:

getAssignments

public List getAssignments(Long gradebookId,
                           String sortBy,
                           boolean ascending)
Fetches a List of Assignments, but does not populate non-persistent fields.

Parameters:
gradebookId - The gradebook ID
sortBy - The field by which to sort the list.
Returns:
A list of Assignments with only persistent fields populated

getAssignments

public List getAssignments(Long gradebookId)
Convenience method to get assignments with the default sort ordering

Parameters:
gradebookId - The gradebook ID

getAssignmentsWithStats

public List getAssignmentsWithStats(Long gradebookId,
                                    String sortBy,
                                    boolean ascending)
Fetches a List of Assignments for a given gradebook, and populates the Assignments with all of the statistics fields available in the Assignment object.

Parameters:
gradebookId - The gradebook ID
sortBy - The field by which to sort the list.
Returns:
A list of Assignments with their statistics fields populated

getAssignmentsAndCourseGradeWithStats

public List getAssignmentsAndCourseGradeWithStats(Long gradebookId,
                                                  String sortBy,
                                                  boolean ascending)
Same as the other getAssignmentsWithStats except for tacking the CourseGrade (with statistics) at the end of the list. This is combined into one call as a way to avoid either exposing the full enrollment list for the site or fetching it twice.


getGradableObject

public GradableObject getGradableObject(Long gradableObjectId)
Fetches a GradableObject

Parameters:
gradableObjectId - The gradable object ID
Returns:
The GradableObject

getAssignmentWithStats

public Assignment getAssignmentWithStats(Long assignmentId)
Fetches an assignment and populates its non-persistent statistics fields.

Parameters:
assignmentId - The assignment ID
Returns:
The GradableObject with all statistics fields populated

createAssignment

public Long createAssignment(Long gradebookId,
                             String name,
                             Double points,
                             Date dueDate,
                             Boolean isNotCounted)
                      throws ConflictingAssignmentNameException,
                             StaleObjectModificationException
Add a new assignment to a gradebook

Parameters:
gradebookId - The gradebook ID to which this new assignment belongs
name - The assignment's name (must be unique in the gradebook and not be null)
points - The number of points possible for this assignment (must not be null)
dueDate - The due date for the assignment (optional)
isNotCounted - True if the assignment should not count towards the final course grade (optional)
Returns:
The ID of the new assignment
Throws:
ConflictingAssignmentNameException
StaleObjectModificationException

updateAssignment

public void updateAssignment(Assignment assignment)
                      throws ConflictingAssignmentNameException,
                             StaleObjectModificationException
Updates an existing assignment

Throws:
ConflictingAssignmentNameException
StaleObjectModificationException

getCourseGrade

public CourseGrade getCourseGrade(Long gradebookId)
Fetches the course grade for a gradebook

Parameters:
gradebookId - The gradebook id
Returns:
The course grade

getCourseGradeWithStats

public CourseGrade getCourseGradeWithStats(Long gradebookId)
Fetches the course grade for a gradebook and populates its non-persistent statistics fields

Parameters:
gradebookId - The gradebook id
Returns:
The course grade

updateCourseGradeRecordSortValues

public void updateCourseGradeRecordSortValues(Long gradebookId,
                                              boolean manuallyEnteredRecords)
Updates the values used for sorting on any course grade record where a letter grade has (or hasn't) been explicitly set. This should happen anytime a gradebook's grade mapping has been modified (using true to operate on manually entered course grade records) and when an existing assignment's point value changes (using false, so the sort values are changed only on auto-calculated course grade records).

Parameters:
gradebookId - The gradebook id
manuallyEnteredRecords - Whether to update manually entered records or

getTotalPoints

public double getTotalPoints(Long gradebookId)