org.sakaiproject.component.gradebook
Class GradebookServiceHibernateImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.sakaiproject.component.gradebook.BaseHibernateManager
              extended by org.sakaiproject.component.gradebook.GradebookServiceHibernateImpl
All Implemented Interfaces:
GradebookService, org.springframework.beans.factory.InitializingBean

public class GradebookServiceHibernateImpl
extends BaseHibernateManager
implements GradebookService

A Hibernate implementation of GradebookService.


Field Summary
 
Fields inherited from class org.sakaiproject.component.gradebook.BaseHibernateManager
authn, MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST, propertiesMap, sectionAwareness
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface org.sakaiproject.service.gradebook.shared.GradebookService
CATEGORY_TYPE_NO_CATEGORY, CATEGORY_TYPE_ONLY_CATEGORY, CATEGORY_TYPE_WEIGHTED_CATEGORY, enableLetterGradeString, GRADE_TYPE_LETTER, GRADE_TYPE_PERCENTAGE, GRADE_TYPE_POINTS, gradePermission, lettergradeComparator, MATH_CONTEXT, validLetterGrade, viewPermission
 
Constructor Summary
GradebookServiceHibernateImpl()
           
 
Method Summary
 void addAssignment(String gradebookUid, Assignment assignmentDefinition)
          Create a new Gradebook-managed assignment.
 void addExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, double points, Date dueDate, String externalServiceDescription)
           
 void addExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, Double points, Date dueDate, String externalServiceDescription, Boolean ungraded)
           
 void addGradebook(String uid, String name)
           
 boolean checkStudentsNotSubmitted(String gradebookUid)
           
 boolean checkStuendsNotSubmitted(String gradebookUid)
           
 boolean currentUserHasEditPerm(String gradebookUid)
           
 boolean currentUserHasGradeAllPerm(String gradebookUid)
           
 boolean currentUserHasGradingPerm(String gradebookUid)
           
 boolean currentUserHasViewOwnGradesPerm(String gradebookUid)
           
 void deleteGradebook(String uid)
           
 void finalizeGrades(String gradebookUid)
          Finalize the gradebook's course grades by setting all still-unscored assignments to zero scores.
 List getAllAssignmentGradeRecords(Long gradebookId, Collection studentUids)
           
 Assignment getAssignment(String gradebookUid, Long gbItemId)
           
 Assignment getAssignment(String gradebookUid, String assignmentName)
           
 List getAssignments(Long gradebookId, String sortBy, boolean ascending)
           
 List<Assignment> getAssignments(String gradebookUid)
           
 Double getAssignmentScore(String gradebookUid, Long gbItemId, String studentUid)
           
 Double getAssignmentScore(String gradebookUid, String assignmentName, String studentUid)
           
 CommentDefinition getAssignmentScoreComment(String gradebookUid, Long gbItemId, String studentUid)
          Get the comment (if any) currently provided for the given combination of student and assignment.
 CommentDefinition getAssignmentScoreComment(String gradebookUid, String assignmentName, String studentUid)
          Get the comment (if any) currently provided for the given combination of student and assignment.
 String getAssignmentScoreString(String gradebookUid, Long gbItemId, String studentUid)
          Get student's assignment's score as string.
 String getAssignmentScoreString(String gradebookUid, String assignmentName, String studentUid)
          Get student's assignment's score as string.
protected  List getAssignmentsCounted(Long gradebookId)
           
 Authz getAuthz()
           
 Map getCalculatedCourseGrade(String gradebookUid)
          Get a Map of auto calculated CourseGrade for students.
 List<CategoryDefinition> getCategoryDefinitions(String gradebookUid)
           
 CourseGrade getCourseGrade(Long gradebookId)
           
 Map getEnteredCourseGrade(String gradebookUid)
          Get a Map of overridden CourseGrade for students.
 GradebookExternalAssessmentService getExternalAssessmentService()
           
 Map getFixedGrade(String gradebookUid)
          Get fixed grades for students by using course grade scale.
 Map getFixedPoint(String gradebookUid)
          Get fixed earned points for students by using course grade scale.
 GradebookFrameworkService getFrameworkService()
           
 Gradebook getGradebook(Long id)
           
 String getGradebookDefinitionXml(String gradebookUid)
          Get an archivable definition of gradebook data suitable for migration between sites.
 GradebookPermissionService getGradebookPermissionService()
           
 GradeDefinition getGradeDefinitionForStudentForItem(String gradebookUid, Long gbItemId, String studentUid)
           
 int getGradeEntryType(String gradebookUid)
           
 List<GradeDefinition> getGradesForStudentsForItem(String gradebookUid, Long gradableObjectId, List<String> studentIds)
           
 String getGradeViewFunctionForUserForStudentForItem(String gradebookUid, Long itemId, String studentUid)
          Check to see if current user may grade or view the given student for the given item in the given gradebook.
 String getGradeViewFunctionForUserForStudentForItem(String gradebookUid, String itemName, String studentUid)
          Check to see if current user may grade or view the given student for the given item in the given gradebook.
 Map getImportCourseGrade(String gradebookUid)
           
 String getLowestPossibleGradeForGbItem(String gradebookUid, Long gradebookItemId)
           
 Map getOldPoint(String gradebookUid)
          Get old earned points for students by using letter grade scale.
 List getPointsEarnedCourseGradeRecords(CourseGrade courseGrade, Collection studentUids)
           
 List getPointsEarnedCourseGradeRecordsFixing(CourseGrade courseGrade, Collection studentUids)
           
 List<Assignment> getViewableAssignmentsForCurrentUser(String gradebookUid)
           
 Map getViewableSectionUuidToNameMap(String gradebookUid)
          Using the grader permissions, return map of section uuid to section name that includes all sections that the current user may view or grade
 Map<String,String> getViewableStudentsForItemForCurrentUser(String gradebookUid, Long gradableObjectId)
           
 Map<String,String> getViewableStudentsForItemForUser(String userUid, String gradebookUid, Long gradableObjectId)
           
 List<String> identifyStudentsWithInvalidGrades(String gradebookUid, Map<String,String> studentIdToGradeMap)
           
 boolean isAssignmentDefined(String gradebookUid, String assignmentName)
          Check to see if an assignment with the given name already exists in the given gradebook.
 boolean isExternalAssignmentDefined(String gradebookUid, String externalId)
           
 boolean isGradableObjectDefined(Long gradableObjectId)
           
 boolean isGradebookDefined(String gradebookUid)
          Checks to see whether a gradebook with the given uid exists.
 boolean isGradeValid(String gradebookUuid, String grade)
           
 boolean isUserAbleToGradeItemForStudent(String gradebookUid, Long itemId, String studentUid)
          Check to see if the current user is allowed to grade the given item for the given student in the given gradebook.
 boolean isUserAbleToGradeItemForStudent(String gradebookUid, String itemName, String studentUid)
          Check to see if the current user is allowed to grade the given item for the given student in the given gradebook.
 boolean isUserAbleToViewItemForStudent(String gradebookUid, Long itemId, String studentUid)
          Check to see if the current user is allowed to view the given item for the given student in the given gradebook.
 boolean isUserAbleToViewItemForStudent(String gradebookUid, String itemName, String studentUid)
          Check to see if the current user is allowed to view the given item for the given student in the given gradebook.
 boolean isUserAllowedToGrade(String gradebookUid, String userUid)
           
 boolean isUserAllowedToGradeAll(String gradebookUid, String userUid)
           
 void mergeGradebookDefinitionXml(String toGradebookUid, String fromGradebookXml)
          Attempt to merge archived gradebook data (notably the assignnments) into a new gradebook.
 void removeAssignment(Long assignmentId)
          Removes an assignment from a gradebook.
 void removeExternalAssessment(String gradebookUid, String externalId)
           
 void saveGradeAndCommentForStudent(String gradebookUid, Long gradableObjectId, String studentUid, String grade, String comment)
          Save a student score and comment for a gradebook item.
 void saveGradesAndComments(String gradebookUid, Long gradableObjectId, List<GradeDefinition> gradeDefList)
          Given a list of GradeDefinitions for students for a given gradebook and gradable object, will save the associated scores and comments.
 void setAssignmentScore(String gradebookUid, String assignmentName, String studentUid, Double score, String clientServiceDescription)
           
 void setAssignmentScoreComment(String gradebookUid, String assignmentName, String studentUid, String commentText)
          Provide a student-viewable comment on the score (or lack of score) associated with the given assignment.
 void setAssignmentScoreString(String gradebookUid, String assignmentName, String studentUid, String score, String clientServiceDescription)
          set student's score for assignment.
 void setAuthz(Authz authz)
           
 void setAvailableGradingScales(Collection gradingScaleDefinitions)
           
 void setDefaultGradingScale(String uid)
           
 void setEventTrackingService(EventTrackingService eventTrackingService)
           
 void setExternalAssessmentService(GradebookExternalAssessmentService externalAssessmentService)
           
 void setFrameworkService(GradebookFrameworkService frameworkService)
           
 void setGradebookPermissionService(GradebookPermissionService gradebookPermissionService)
           
 void transferGradebookDefinitionXml(String fromGradebookUid, String toGradebookUid, String fromGradebookXml)
          Attempt to transfer gradebook data with Category and weight and settings
 void updateAssignment(String gradebookUid, String assignmentName, Assignment assignmentDefinition)
          Modify the definition of an existing Gradebook-managed assignment.
 void updateExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, double points, Date dueDate)
           
 void updateExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, Double points, Date dueDate)
           
 void updateExternalAssessmentScore(String gradebookUid, String externalId, String studentUid, Double points)
           
 void updateExternalAssessmentScores(String gradebookUid, String externalId, Map studentUidsToScores)
           
 
Methods inherited from class org.sakaiproject.component.gradebook.BaseHibernateManager
addPermission, calculateEquivalentPercent, calculateEquivalentPointValueForPercent, convertPointsToLetterGrade, convertPointsToPercentage, createAssignment, createAssignmentForCategory, createCategory, createDefaultLetterGradePercentMapping, createOrUpdateDefaultLetterGradePercentMapping, createUngradedAssignment, createUngradedAssignmentForCategory, deletePermission, filterGradeRecordsByStudents, finalizeNullGradeRecords, getAllStudentUids, getAssignment, getAssignmentGradeRecord, getAssignments, getAssignmentsForCategory, getAssignmentWithoutStats, getAssignmentWithoutStats, getAuthn, getCategories, getCategoriesWithAssignments, getCategory, getComments, getCountedStudentGradeRecords, getCourseGradeRecord, getDefaultLetterGradePercentMapping, getEventTrackingService, getGradebook, getGradebookUid, getLetterGradePercentMapping, getPermissionsForGB, getPermissionsForGBForCategoryIds, getPermissionsForUser, getPermissionsForUserAnyCategory, getPermissionsForUserAnyGroup, getPermissionsForUserAnyGroupAnyCategory, getPermissionsForUserAnyGroupForCategory, getPermissionsForUserForCategory, getPermissionsForUserForGoupsAnyCategory, getPermissionsForUserForGroup, getPropertiesMap, getPropertyValue, getSectionAwareness, getUserUid, isAssignmentDefined, isExplicitlyEnteredCourseGradeRecords, postEvent, removeCategory, saveOrUpdateLetterGradePercentMapping, setAuthn, setPropertyValue, setSectionAwareness, updateAssignment, updateCategory, updateGradebook, updatePermission, updatePermission, validateLetterGradeMapping
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.service.gradebook.shared.GradebookService
getCategories, getGradebook, removeCategory
 

Constructor Detail

GradebookServiceHibernateImpl

public GradebookServiceHibernateImpl()
Method Detail

setEventTrackingService

public void setEventTrackingService(EventTrackingService eventTrackingService)
Overrides:
setEventTrackingService in class BaseHibernateManager

isAssignmentDefined

public boolean isAssignmentDefined(String gradebookUid,
                                   String assignmentName)
                            throws GradebookNotFoundException
Description copied from interface: GradebookService
Check to see if an assignment with the given name already exists in the given gradebook. This will give clients a chance to avoid the ConflictingAssignmentNameException.

Specified by:
isAssignmentDefined in interface GradebookService
Throws:
GradebookNotFoundException

isUserAbleToGradeItemForStudent

public boolean isUserAbleToGradeItemForStudent(String gradebookUid,
                                               Long itemId,
                                               String studentUid)
Description copied from interface: GradebookService
Check to see if the current user is allowed to grade the given item for the given student in the given gradebook. This will give clients a chance to avoid a security exception.

Specified by:
isUserAbleToGradeItemForStudent in interface GradebookService

isUserAbleToGradeItemForStudent

public boolean isUserAbleToGradeItemForStudent(String gradebookUid,
                                               String itemName,
                                               String studentUid)
Description copied from interface: GradebookService
Check to see if the current user is allowed to grade the given item for the given student in the given gradebook. This will give clients a chance to avoid a security exception.

Specified by:
isUserAbleToGradeItemForStudent in interface GradebookService
Returns:

isUserAbleToViewItemForStudent

public boolean isUserAbleToViewItemForStudent(String gradebookUid,
                                              Long itemId,
                                              String studentUid)
Description copied from interface: GradebookService
Check to see if the current user is allowed to view the given item for the given student in the given gradebook. This will give clients a chance to avoid a security exception.

Specified by:
isUserAbleToViewItemForStudent in interface GradebookService
Returns:

isUserAbleToViewItemForStudent

public boolean isUserAbleToViewItemForStudent(String gradebookUid,
                                              String itemName,
                                              String studentUid)
Description copied from interface: GradebookService
Check to see if the current user is allowed to view the given item for the given student in the given gradebook. This will give clients a chance to avoid a security exception.

Specified by:
isUserAbleToViewItemForStudent in interface GradebookService
Returns:

getGradeViewFunctionForUserForStudentForItem

public String getGradeViewFunctionForUserForStudentForItem(String gradebookUid,
                                                           Long itemId,
                                                           String studentUid)
Description copied from interface: GradebookService
Check to see if current user may grade or view the given student for the given item in the given gradebook. Returns string representation of function per GradebookService vars (view/grade) or null if no permission

Specified by:
getGradeViewFunctionForUserForStudentForItem in interface GradebookService
Returns:
GradebookService.gradePermission, GradebookService.viewPermission, or null if no permission

getGradeViewFunctionForUserForStudentForItem

public String getGradeViewFunctionForUserForStudentForItem(String gradebookUid,
                                                           String itemName,
                                                           String studentUid)
Description copied from interface: GradebookService
Check to see if current user may grade or view the given student for the given item in the given gradebook. Returns string representation of function per GradebookService vars (view/grade) or null if no permission

Specified by:
getGradeViewFunctionForUserForStudentForItem in interface GradebookService
Returns:
GradebookService.gradePermission, GradebookService.viewPermission, or null if no permission

getAssignments

public List<Assignment> getAssignments(String gradebookUid)
                                throws GradebookNotFoundException
Specified by:
getAssignments in interface GradebookService
Returns:
Returns a list of Assignment objects describing the assignments that are currently defined in the given gradebook.
Throws:
GradebookNotFoundException

getAssignment

public Assignment getAssignment(String gradebookUid,
                                String assignmentName)
                         throws GradebookNotFoundException
Specified by:
getAssignment in interface GradebookService
Returns:
the assignment definition, or null if not found
Throws:
GradebookNotFoundException

getAssignment

public Assignment getAssignment(String gradebookUid,
                                Long gbItemId)
                         throws AssessmentNotFoundException
Specified by:
getAssignment in interface GradebookService
Returns:
the associated Assignment with the given gbItemId
Throws:
AssessmentNotFoundException

getAssignmentScore

public Double getAssignmentScore(String gradebookUid,
                                 String assignmentName,
                                 String studentUid)
                          throws GradebookNotFoundException,
                                 AssessmentNotFoundException
Specified by:
getAssignmentScore in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getAssignmentScore

public Double getAssignmentScore(String gradebookUid,
                                 Long gbItemId,
                                 String studentUid)
Specified by:
getAssignmentScore in interface GradebookService

getGradeDefinitionForStudentForItem

public GradeDefinition getGradeDefinitionForStudentForItem(String gradebookUid,
                                                           Long gbItemId,
                                                           String studentUid)
Specified by:
getGradeDefinitionForStudentForItem in interface GradebookService
Returns:
Returns a GradeDefinition for the student, respecting the grade entry type for the gradebook (ie in %, letter grade, or points format). Returns null if no grade

setAssignmentScore

public void setAssignmentScore(String gradebookUid,
                               String assignmentName,
                               String studentUid,
                               Double score,
                               String clientServiceDescription)
                        throws GradebookNotFoundException,
                               AssessmentNotFoundException
Specified by:
setAssignmentScore in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getAssignmentScoreComment

public CommentDefinition getAssignmentScoreComment(String gradebookUid,
                                                   String assignmentName,
                                                   String studentUid)
                                            throws GradebookNotFoundException,
                                                   AssessmentNotFoundException
Description copied from interface: GradebookService
Get the comment (if any) currently provided for the given combination of student and assignment.

Specified by:
getAssignmentScoreComment in interface GradebookService
Returns:
null if no comment is avaailable
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getAssignmentScoreComment

public CommentDefinition getAssignmentScoreComment(String gradebookUid,
                                                   Long gbItemId,
                                                   String studentUid)
                                            throws GradebookNotFoundException,
                                                   AssessmentNotFoundException
Description copied from interface: GradebookService
Get the comment (if any) currently provided for the given combination of student and assignment.

Specified by:
getAssignmentScoreComment in interface GradebookService
Returns:
null if no comment is avaailable
Throws:
GradebookNotFoundException
AssessmentNotFoundException

setAssignmentScoreComment

public void setAssignmentScoreComment(String gradebookUid,
                                      String assignmentName,
                                      String studentUid,
                                      String commentText)
                               throws GradebookNotFoundException,
                                      AssessmentNotFoundException
Description copied from interface: GradebookService
Provide a student-viewable comment on the score (or lack of score) associated with the given assignment.

Specified by:
setAssignmentScoreComment in interface GradebookService
commentText - a plain text comment, or null to remove any currrent comment
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getGradebookDefinitionXml

public String getGradebookDefinitionXml(String gradebookUid)
Description copied from interface: GradebookService
Get an archivable definition of gradebook data suitable for migration between sites. Assignment definitions and the currently selected grading scale are included. Student view options and all information related to specific students or instructors (such as scores) are not.

Specified by:
getGradebookDefinitionXml in interface GradebookService
Returns:
a versioned XML string

transferGradebookDefinitionXml

public void transferGradebookDefinitionXml(String fromGradebookUid,
                                           String toGradebookUid,
                                           String fromGradebookXml)
Description copied from interface: GradebookService
Attempt to transfer gradebook data with Category and weight and settings

Specified by:
transferGradebookDefinitionXml in interface GradebookService

mergeGradebookDefinitionXml

public void mergeGradebookDefinitionXml(String toGradebookUid,
                                        String fromGradebookXml)
Description copied from interface: GradebookService
Attempt to merge archived gradebook data (notably the assignnments) into a new gradebook. Assignment definitions whose names match assignments that are already in the targeted gradebook will be skipped. Imported assignments will not automatically be released to students, even if they were released in the original gradebook. Externally managed assessments will not be imported, since such imports should be handled by the external assessment engine. If possible, the targeted gradebook's selected grading scale will be set to match the archived grading scale. If there are any mismatches that make this impossible, the existing grading scale will be left alone, but assignment imports will still happen.

Specified by:
mergeGradebookDefinitionXml in interface GradebookService

removeAssignment

public void removeAssignment(Long assignmentId)
                      throws StaleObjectModificationException
Description copied from interface: GradebookService
Removes an assignment from a gradebook. The assignment should not be deleted, but the assignment and all grade records associated with the assignment should be ignored by the application. A removed assignment should not count toward the total number of points in the gradebook.

Specified by:
removeAssignment in interface GradebookService
Parameters:
assignmentId - The assignment id
Throws:
StaleObjectModificationException

addAssignment

public void addAssignment(String gradebookUid,
                          Assignment assignmentDefinition)
Description copied from interface: GradebookService
Create a new Gradebook-managed assignment.

Specified by:
addAssignment in interface GradebookService

updateAssignment

public void updateAssignment(String gradebookUid,
                             String assignmentName,
                             Assignment assignmentDefinition)
Description copied from interface: GradebookService
Modify the definition of an existing Gradebook-managed assignment. Clients should be aware that it's allowed to change the points value of an assignment even if students have already been scored on it. Any existing scores will not be adjusted. This method cannot be used to modify the defintions of externally-managed assessments or to make Gradebook-managed assignments externally managed.

Specified by:
updateAssignment in interface GradebookService
assignmentName - the name of the assignment that needs to be changed
assignmentDefinition - the new properties of the assignment

getAuthz

public Authz getAuthz()

setAuthz

public void setAuthz(Authz authz)

getGradebookPermissionService

public GradebookPermissionService getGradebookPermissionService()

setGradebookPermissionService

public void setGradebookPermissionService(GradebookPermissionService gradebookPermissionService)

addGradebook

public void addGradebook(String uid,
                         String name)
Specified by:
addGradebook in interface GradebookService

setAvailableGradingScales

public void setAvailableGradingScales(Collection gradingScaleDefinitions)
Specified by:
setAvailableGradingScales in interface GradebookService

setDefaultGradingScale

public void setDefaultGradingScale(String uid)
Specified by:
setDefaultGradingScale in interface GradebookService

deleteGradebook

public void deleteGradebook(String uid)
                     throws GradebookNotFoundException
Specified by:
deleteGradebook in interface GradebookService
Throws:
GradebookNotFoundException

isGradebookDefined

public boolean isGradebookDefined(String gradebookUid)
Description copied from interface: GradebookService
Checks to see whether a gradebook with the given uid exists.

Specified by:
isGradebookDefined in interface GradebookService
Overrides:
isGradebookDefined in class BaseHibernateManager
Parameters:
gradebookUid - The gradebook UID to check
Returns:
Whether the gradebook exists

getFrameworkService

public GradebookFrameworkService getFrameworkService()

setFrameworkService

public void setFrameworkService(GradebookFrameworkService frameworkService)

addExternalAssessment

public void addExternalAssessment(String gradebookUid,
                                  String externalId,
                                  String externalUrl,
                                  String title,
                                  double points,
                                  Date dueDate,
                                  String externalServiceDescription)
                           throws ConflictingAssignmentNameException,
                                  ConflictingExternalIdException,
                                  GradebookNotFoundException
Specified by:
addExternalAssessment in interface GradebookService
Throws:
ConflictingAssignmentNameException
ConflictingExternalIdException
GradebookNotFoundException

addExternalAssessment

public void addExternalAssessment(String gradebookUid,
                                  String externalId,
                                  String externalUrl,
                                  String title,
                                  Double points,
                                  Date dueDate,
                                  String externalServiceDescription,
                                  Boolean ungraded)
                           throws ConflictingAssignmentNameException,
                                  ConflictingExternalIdException,
                                  GradebookNotFoundException
Specified by:
addExternalAssessment in interface GradebookService
Throws:
ConflictingAssignmentNameException
ConflictingExternalIdException
GradebookNotFoundException

updateExternalAssessment

public void updateExternalAssessment(String gradebookUid,
                                     String externalId,
                                     String externalUrl,
                                     String title,
                                     double points,
                                     Date dueDate)
                              throws GradebookNotFoundException,
                                     AssessmentNotFoundException,
                                     AssignmentHasIllegalPointsException
Specified by:
updateExternalAssessment in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException
AssignmentHasIllegalPointsException

updateExternalAssessment

public void updateExternalAssessment(String gradebookUid,
                                     String externalId,
                                     String externalUrl,
                                     String title,
                                     Double points,
                                     Date dueDate)
                              throws GradebookNotFoundException,
                                     AssessmentNotFoundException,
                                     AssignmentHasIllegalPointsException
Specified by:
updateExternalAssessment in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException
AssignmentHasIllegalPointsException

removeExternalAssessment

public void removeExternalAssessment(String gradebookUid,
                                     String externalId)
                              throws GradebookNotFoundException,
                                     AssessmentNotFoundException
Specified by:
removeExternalAssessment in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

updateExternalAssessmentScore

public void updateExternalAssessmentScore(String gradebookUid,
                                          String externalId,
                                          String studentUid,
                                          Double points)
                                   throws GradebookNotFoundException,
                                          AssessmentNotFoundException
Specified by:
updateExternalAssessmentScore in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

updateExternalAssessmentScores

public void updateExternalAssessmentScores(String gradebookUid,
                                           String externalId,
                                           Map studentUidsToScores)
                                    throws GradebookNotFoundException,
                                           AssessmentNotFoundException
Specified by:
updateExternalAssessmentScores in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

isExternalAssignmentDefined

public boolean isExternalAssignmentDefined(String gradebookUid,
                                           String externalId)
                                    throws GradebookNotFoundException
Specified by:
isExternalAssignmentDefined in interface GradebookService
Throws:
GradebookNotFoundException

getExternalAssessmentService

public GradebookExternalAssessmentService getExternalAssessmentService()

setExternalAssessmentService

public void setExternalAssessmentService(GradebookExternalAssessmentService externalAssessmentService)

getImportCourseGrade

public Map getImportCourseGrade(String gradebookUid)
Specified by:
getImportCourseGrade in interface GradebookService

getCourseGrade

public CourseGrade getCourseGrade(Long gradebookId)
Overrides:
getCourseGrade in class BaseHibernateManager

getPointsEarnedCourseGradeRecords

public List getPointsEarnedCourseGradeRecords(CourseGrade courseGrade,
                                              Collection studentUids)

getGradebook

public Gradebook getGradebook(Long id)

getAssignmentsCounted

protected List getAssignmentsCounted(Long gradebookId)
                              throws org.hibernate.HibernateException
Throws:
org.hibernate.HibernateException

checkStudentsNotSubmitted

public boolean checkStudentsNotSubmitted(String gradebookUid)
Specified by:
checkStudentsNotSubmitted in interface GradebookService
Returns:

getAllAssignmentGradeRecords

public List getAllAssignmentGradeRecords(Long gradebookId,
                                         Collection studentUids)

getAssignments

public List getAssignments(Long gradebookId,
                           String sortBy,
                           boolean ascending)

getViewableAssignmentsForCurrentUser

public List<Assignment> getViewableAssignmentsForCurrentUser(String gradebookUid)
                                                      throws GradebookNotFoundException
Specified by:
getViewableAssignmentsForCurrentUser in interface GradebookService
Returns:
list of gb items that the current user is authorized to view. If user has gradeAll permission, returns all gb items. If user has gradeSection perm with no grader permissions, returns all gb items. If user has gradeSection with grader perms, returns only the items that the current user is authorized to view or grade. If user does not have grading privileges but does have viewOwnGrades perm, will return all released gb items.
Throws:
GradebookNotFoundException

getViewableStudentsForItemForCurrentUser

public Map<String,String> getViewableStudentsForItemForCurrentUser(String gradebookUid,
                                                                   Long gradableObjectId)
Specified by:
getViewableStudentsForItemForCurrentUser in interface GradebookService
Returns:
a map of studentId to view/grade function for the given gradebook and gradebook item. students who are not viewable or gradable will not be returned. if the current user does not have grading privileges, an empty map is returned

getViewableStudentsForItemForUser

public Map<String,String> getViewableStudentsForItemForUser(String userUid,
                                                            String gradebookUid,
                                                            Long gradableObjectId)
Specified by:
getViewableStudentsForItemForUser in interface GradebookService
Returns:
a map of studentId to view/grade function for the given gradebook and gradebook item that the given userUid is allowed to view or grade. students who are not viewable or gradable will not be returned. if the given user does not have grading privileges, an empty map is returned

isGradableObjectDefined

public boolean isGradableObjectDefined(Long gradableObjectId)
Specified by:
isGradableObjectDefined in interface GradebookService
Returns:
true if a gradable object with the given id exists and was not removed

getViewableSectionUuidToNameMap

public Map getViewableSectionUuidToNameMap(String gradebookUid)
Description copied from interface: GradebookService
Using the grader permissions, return map of section uuid to section name that includes all sections that the current user may view or grade

Specified by:
getViewableSectionUuidToNameMap in interface GradebookService
Returns:

currentUserHasGradeAllPerm

public boolean currentUserHasGradeAllPerm(String gradebookUid)
Specified by:
currentUserHasGradeAllPerm in interface GradebookService
Returns:
true if current user has the gradebook.gradeAll permission

isUserAllowedToGradeAll

public boolean isUserAllowedToGradeAll(String gradebookUid,
                                       String userUid)
Specified by:
isUserAllowedToGradeAll in interface GradebookService
Returns:
true if the given user is allowed to grade all students in this gradebook

currentUserHasGradingPerm

public boolean currentUserHasGradingPerm(String gradebookUid)
Specified by:
currentUserHasGradingPerm in interface GradebookService
Returns:
true if the current user has some form of grading privileges in the gradebook (grade all, grade section, etc)

isUserAllowedToGrade

public boolean isUserAllowedToGrade(String gradebookUid,
                                    String userUid)
Specified by:
isUserAllowedToGrade in interface GradebookService
Returns:
true if the given user has some form of grading privileges in the gradebook (grade all, grade section, etc)

currentUserHasEditPerm

public boolean currentUserHasEditPerm(String gradebookUid)
Specified by:
currentUserHasEditPerm in interface GradebookService
Returns:
true if the current user has the gradebook.editAssignments permission

currentUserHasViewOwnGradesPerm

public boolean currentUserHasViewOwnGradesPerm(String gradebookUid)
Specified by:
currentUserHasViewOwnGradesPerm in interface GradebookService
Returns:
true if the current user has the gradebook.viewOwnGrades permission

getGradesForStudentsForItem

public List<GradeDefinition> getGradesForStudentsForItem(String gradebookUid,
                                                         Long gradableObjectId,
                                                         List<String> studentIds)
Specified by:
getGradesForStudentsForItem in interface GradebookService
Returns:
a list of GradeDefinition with the grade information for the given students for the given gradableObjectId

isGradeValid

public boolean isGradeValid(String gradebookUuid,
                            String grade)
Specified by:
isGradeValid in interface GradebookService
Returns:
true if the given grade is a valid grade given the gradebook's grade entry type. ie, if gradebook is set to grade entry by points, will check for valid point value. if entry by letter, will check for valid letter, etc

identifyStudentsWithInvalidGrades

public List<String> identifyStudentsWithInvalidGrades(String gradebookUid,
                                                      Map<String,String> studentIdToGradeMap)
Specified by:
identifyStudentsWithInvalidGrades in interface GradebookService
studentIdToGradeMap - - the student's username mapped to their grade that you want to validate
Returns:
a list of the studentIds that were associated with invalid grades given the gradebook's grade entry type. useful if validating a list of student/grade pairs for a single gradebook (more efficient than calling gradeIsValid repeatedly). returns empty list if all grades are valid

saveGradeAndCommentForStudent

public void saveGradeAndCommentForStudent(String gradebookUid,
                                          Long gradableObjectId,
                                          String studentUid,
                                          String grade,
                                          String comment)
Description copied from interface: GradebookService
Save a student score and comment for a gradebook item. The input score must be valid according to the given gradebook's grade entry type.

Specified by:
saveGradeAndCommentForStudent in interface GradebookService
grade - - must be in format according to gradebook's grade entry type

saveGradesAndComments

public void saveGradesAndComments(String gradebookUid,
                                  Long gradableObjectId,
                                  List<GradeDefinition> gradeDefList)
Description copied from interface: GradebookService
Given a list of GradeDefinitions for students for a given gradebook and gradable object, will save the associated scores and comments. Scores must be in a format according to the gradebook's grade entry type (ie points, %, letter).

Specified by:
saveGradesAndComments in interface GradebookService

getFixedGrade

public Map getFixedGrade(String gradebookUid)
Description copied from interface: GradebookService
Get fixed grades for students by using course grade scale.

Specified by:
getFixedGrade in interface GradebookService
Returns:
Map of enrollment displayId as key, grade as value

getPointsEarnedCourseGradeRecordsFixing

public List getPointsEarnedCourseGradeRecordsFixing(CourseGrade courseGrade,
                                                    Collection studentUids)

getFixedPoint

public Map getFixedPoint(String gradebookUid)
Description copied from interface: GradebookService
Get fixed earned points for students by using course grade scale.

Specified by:
getFixedPoint in interface GradebookService
Returns:
Map of enrollment displayId as key, point as value string

getOldPoint

public Map getOldPoint(String gradebookUid)
Description copied from interface: GradebookService
Get old earned points for students by using letter grade scale.

Specified by:
getOldPoint in interface GradebookService
Returns:
Map of enrollment displayId as key, point as value string

getGradeEntryType

public int getGradeEntryType(String gradebookUid)
Specified by:
getGradeEntryType in interface GradebookService
Returns:
the constant representation of the grade entry type (ie points, %, letter grade)

getEnteredCourseGrade

public Map getEnteredCourseGrade(String gradebookUid)
Description copied from interface: GradebookService
Get a Map of overridden CourseGrade for students.

Specified by:
getEnteredCourseGrade in interface GradebookService
Returns:
Map of enrollment displayId as key, point as value string

getCalculatedCourseGrade

public Map getCalculatedCourseGrade(String gradebookUid)
Description copied from interface: GradebookService
Get a Map of auto calculated CourseGrade for students.

Specified by:
getCalculatedCourseGrade in interface GradebookService
Returns:
Map of enrollment displayId as key, point as value

getAssignmentScoreString

public String getAssignmentScoreString(String gradebookUid,
                                       String assignmentName,
                                       String studentUid)
                                throws GradebookNotFoundException,
                                       AssessmentNotFoundException
Description copied from interface: GradebookService
Get student's assignment's score as string.

Specified by:
getAssignmentScoreString in interface GradebookService
Returns:
String of score
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getAssignmentScoreString

public String getAssignmentScoreString(String gradebookUid,
                                       Long gbItemId,
                                       String studentUid)
                                throws GradebookNotFoundException,
                                       AssessmentNotFoundException
Description copied from interface: GradebookService
Get student's assignment's score as string.

Specified by:
getAssignmentScoreString in interface GradebookService
Returns:
String of score
Throws:
GradebookNotFoundException
AssessmentNotFoundException

setAssignmentScoreString

public void setAssignmentScoreString(String gradebookUid,
                                     String assignmentName,
                                     String studentUid,
                                     String score,
                                     String clientServiceDescription)
                              throws GradebookNotFoundException,
                                     AssessmentNotFoundException
Description copied from interface: GradebookService
set student's score for assignment.

Specified by:
setAssignmentScoreString in interface GradebookService
Throws:
GradebookNotFoundException
AssessmentNotFoundException

finalizeGrades

public void finalizeGrades(String gradebookUid)
                    throws GradebookNotFoundException
Description copied from interface: GradebookService
Finalize the gradebook's course grades by setting all still-unscored assignments to zero scores.

Specified by:
finalizeGrades in interface GradebookService
Throws:
GradebookNotFoundException

getLowestPossibleGradeForGbItem

public String getLowestPossibleGradeForGbItem(String gradebookUid,
                                              Long gradebookItemId)
Specified by:
getLowestPossibleGradeForGbItem in interface GradebookService
Returns:
the lowest possible grade allowed for the given gradebookItemId. For example, in a points or %-based gradebook, the lowest possible grade for a gradebook item is 0. In a letter-grade gb, it may be 'F' depending on the letter grade mapping. Ungraded items have a lowest value of null.

getCategoryDefinitions

public List<CategoryDefinition> getCategoryDefinitions(String gradebookUid)
Specified by:
getCategoryDefinitions in interface GradebookService
Returns:
CategoryDefinitions for the categories defined for the given gradebook. Returns an empty list if the gradebook does not have categories.

checkStuendsNotSubmitted

public boolean checkStuendsNotSubmitted(String gradebookUid)
Specified by:
checkStuendsNotSubmitted in interface GradebookService
Returns:


Copyright © 2011 Sakai Project. All Rights Reserved.