org.sakaiproject.tool.gradebook.business.impl
Class BaseHibernateManager

java.lang.Object
  extended byorg.springframework.dao.support.DaoSupport
      extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
          extended byorg.sakaiproject.tool.gradebook.business.impl.BaseHibernateManager
All Implemented Interfaces:
InitializingBean
Direct Known Subclasses:
GradebookManagerHibernateImpl, GradebookServiceHibernateImpl, GradeManagerHibernateImpl

public abstract class BaseHibernateManager
extends HibernateDaoSupport

Base class for all gradebook managers. Provides methods common to two or more managers, thus eliminating (for now) a tangle of circular dependencies.

Author:
Josh Holtzman

Field Summary
protected  Authn authn
           
protected  SectionAwareness sectionAwareness
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BaseHibernateManager()
           
 
Method Summary
 List getAllEnrollments(Long gradebookId)
           
protected  List getAssignments(Long gradebookId, net.sf.hibernate.Session session)
           
 Authn getAuthn()
           
protected  List getCountedStudentGradeRecords(Long gradebookId, String studentId, net.sf.hibernate.Session session)
           
 CourseGrade getCourseGrade(Long gradebookId)
           
protected  CourseGradeRecord getCourseGradeRecord(Gradebook gradebook, String studentId, net.sf.hibernate.Session session)
          Gets the course grade record for a student, or null if it does not yet exist.
 String getGradebookUid(Long id)
           
protected  SectionAwareness getSectionAwareness()
           
protected  String getUserUid()
           
protected  void recalculateCourseGradeRecords(Gradebook gradebook, Collection studentIds, net.sf.hibernate.Session session)
          Recalculates the course grade records for the specified set of students.
protected  void recalculateCourseGradeRecords(Gradebook gradebook, net.sf.hibernate.Session session)
          Recalculates the course grade records for all students in a gradebook.
 void setAuthn(Authn authn)
           
 void setSectionAwareness(SectionAwareness sectionAwareness)
           
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, closeSessionIfNecessary, 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
 

Field Detail

sectionAwareness

protected SectionAwareness sectionAwareness

authn

protected Authn authn
Constructor Detail

BaseHibernateManager

public BaseHibernateManager()
Method Detail

getAssignments

protected List getAssignments(Long gradebookId,
                              net.sf.hibernate.Session session)
                       throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

getCountedStudentGradeRecords

protected List getCountedStudentGradeRecords(Long gradebookId,
                                             String studentId,
                                             net.sf.hibernate.Session session)
                                      throws net.sf.hibernate.HibernateException
Throws:
net.sf.hibernate.HibernateException

getCourseGrade

public CourseGrade getCourseGrade(Long gradebookId)

getCourseGradeRecord

protected CourseGradeRecord getCourseGradeRecord(Gradebook gradebook,
                                                 String studentId,
                                                 net.sf.hibernate.Session session)
                                          throws net.sf.hibernate.HibernateException
Gets the course grade record for a student, or null if it does not yet exist.

Parameters:
studentId - The student ID
session - The hibernate session
Returns:
A List of grade records
Throws:
net.sf.hibernate.HibernateException

recalculateCourseGradeRecords

protected void recalculateCourseGradeRecords(Gradebook gradebook,
                                             Collection studentIds,
                                             net.sf.hibernate.Session session)
                                      throws net.sf.hibernate.HibernateException
Recalculates the course grade records for the specified set of students. This should be called any time the total number of points possible in a gradebook is modified, either by editing, adding, or removing assignments or external assessments. You must flush and clear the hibernate session prior to calling this method, or you risk causing data contention here. If data contention does occur here, you will be unable to catch the exception (due to the spring proxy mechanism). TODO Clean up optimistic locking difficulties in recalculate grades

Parameters:
gradebook - The gradebook containing the course grade records to update
studentIds - The collection of student IDs
session - The hibernate session
Throws:
net.sf.hibernate.HibernateException

recalculateCourseGradeRecords

protected void recalculateCourseGradeRecords(Gradebook gradebook,
                                             net.sf.hibernate.Session session)
                                      throws net.sf.hibernate.HibernateException
Recalculates the course grade records for all students in a gradebook. This should be called any time the total number of points possible in a gradebook is modified, either by editing, adding, or removing assignments or external assessments.

Parameters:
gradebook -
session -
Throws:
net.sf.hibernate.HibernateException

getGradebookUid

public String getGradebookUid(Long id)

getAllEnrollments

public List getAllEnrollments(Long gradebookId)

getAuthn

public Authn getAuthn()

setAuthn

public void setAuthn(Authn authn)

getUserUid

protected String getUserUid()

getSectionAwareness

protected SectionAwareness getSectionAwareness()

setSectionAwareness

public void setSectionAwareness(SectionAwareness sectionAwareness)