org.sakaiproject.component.gradebook
Class GradebookServiceHibernateImpl

java.lang.Object
  extended byorg.springframework.dao.support.DaoSupport
      extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
          extended byorg.sakaiproject.tool.gradebook.business.impl.BaseHibernateManager
              extended byorg.sakaiproject.component.gradebook.GradebookServiceHibernateImpl
All Implemented Interfaces:
GradebookService, InitializingBean

public class GradebookServiceHibernateImpl
extends BaseHibernateManager
implements GradebookService

A Hibernate implementation of GradebookService, which can be used by other applications to insert, modify, and remove "read-only" assignments and scores in the gradebook.

Author:
Josh Holtzman

Field Summary
 
Fields inherited from class org.sakaiproject.tool.gradebook.business.impl.BaseHibernateManager
authn, sectionAwareness
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
GradebookServiceHibernateImpl()
           
 
Method Summary
 void addExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, double points, Date dueDate, String externalServiceDescription)
          Add an externally-managed assessment to a gradebook to be treated as a read-only assignment.
 void addGradebook(String uid, String name)
          Creates a new gradebook with the given UID and name
 void deleteGradebook(String uid)
          Deletes the gradebook with the given UID, along with all its associated data.
 List getAssignments(String gradebookUid)
           
 Double getAssignmentScore(String gradebookUid, String assignmentName, String studentUid)
          Besides the declared exceptions, possible runtime exceptions include: SecurityException - If the current user is not authorized to grade the student
 Authz getAuthz()
           
 GradebookManager getGradebookManager()
           
 GradeManager getGradeManager()
           
 boolean gradebookExists(String gradebookUid)
           
 boolean isAssignmentDefined(String gradebookUid, String assignmentName)
          Check to see if an assignment with the given name already exists in the given gradebook.
 boolean isGradebookDefined(String gradebookUid)
          Checks to see whether a gradebook with the given uid exists.
 boolean isUserAbleToGradeStudent(String gradebookUid, String studentUid)
          Check to see if the current user is allowed to grade the given student in the given gradebook.
 void removeExternalAssessment(String gradebookUid, String externalId)
          Remove the assessment reference from the gradebook.
 void setAssignmentScore(String gradebookUid, String assignmentName, String studentUid, Double score, String clientServiceDescription)
          Besides the declared exceptions, possible runtime exceptions include: SecurityException - If the current user is not authorized to grade the student, or if the assignment is externally maintained.
 void setAuthz(Authz authz)
           
 void setGradebookManager(GradebookManager gradebookManager)
           
 void setGradeManager(GradeManager gradeManager)
           
 void updateExternalAssessment(String gradebookUid, String externalId, String externalUrl, String title, double points, Date dueDate)
           
 void updateExternalAssessmentScore(String gradebookUid, String externalId, String studentUid, Double points)
          Updates an external score for an external assignment in the gradebook.
 
Methods inherited from class org.sakaiproject.tool.gradebook.business.impl.BaseHibernateManager
getAllEnrollments, getAssignments, getAuthn, getCountedStudentGradeRecords, getCourseGrade, getCourseGradeRecord, getGradebookUid, getSectionAwareness, getUserUid, recalculateCourseGradeRecords, recalculateCourseGradeRecords, setAuthn, setSectionAwareness
 
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
 

Constructor Detail

GradebookServiceHibernateImpl

public GradebookServiceHibernateImpl()
Method Detail

addGradebook

public void addGradebook(String uid,
                         String name)
Description copied from interface: GradebookService
Creates a new gradebook with the given UID and name

Specified by:
addGradebook in interface GradebookService
Parameters:
uid - The UID used to specify a gradebook and its associated data. It is the caller's responsibility to ensure that this is unique within gradebook storage.
name - The name of the gradebook, to be used for logging and other conveniences by the application. This should be the name of the site or the course. It is only used for convenience, and does not need to be unique.

deleteGradebook

public void deleteGradebook(String uid)
                     throws GradebookNotFoundException
Description copied from interface: GradebookService
Deletes the gradebook with the given UID, along with all its associated data.

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
Parameters:
gradebookUid - The gradebook UID to check
Returns:
Whether the gradebook exists
See Also:
GradebookService.isGradebookDefined(java.lang.String)

gradebookExists

public boolean gradebookExists(String gradebookUid)
Specified by:
gradebookExists in interface GradebookService
See Also:
GradebookService.gradebookExists(java.lang.String)

addExternalAssessment

public void addExternalAssessment(String gradebookUid,
                                  String externalId,
                                  String externalUrl,
                                  String title,
                                  double points,
                                  Date dueDate,
                                  String externalServiceDescription)
                           throws ConflictingAssignmentNameException,
                                  ConflictingExternalIdException,
                                  GradebookNotFoundException
Description copied from interface: GradebookService
Add an externally-managed assessment to a gradebook to be treated as a read-only assignment. The gradebook application will not modify the assessment properties or create any scores for the assessment. Since each assignment in a given gradebook must have a unique name, conflicts are possible.

Specified by:
addExternalAssessment in interface GradebookService
Parameters:
externalId - some unique identifier which Samigo uses for the assessment. The externalId is globally namespaced within the gradebook, so if other apps decide to put assessments into the gradebook, they should prefix their externalIds with a well known (and unique within sakai) string.
externalUrl - a link to go to if the instructor or student wants to look at the assessment in Samigo; if null, no direct link will be provided in the gradebook, and the user will have to navigate to the assessment within the other application
points - this is the total amount of points available and must be greater than zero
externalServiceDescription - what to display as the source of the assignment (e.g., "from Samigo")
Throws:
ConflictingAssignmentNameException
ConflictingExternalIdException
GradebookNotFoundException
See Also:
org.sakaiproject.service.gradebook.shared.GradebookService#addExternalAssessment(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, java.util.Date, java.lang.String)

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
See Also:
org.sakaiproject.service.gradebook.shared.GradebookService#updateExternalAssessment(java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, java.util.Date)

removeExternalAssessment

public void removeExternalAssessment(String gradebookUid,
                                     String externalId)
                              throws GradebookNotFoundException,
                                     AssessmentNotFoundException
Description copied from interface: GradebookService
Remove the assessment reference from the gradebook. Although Samigo doesn't currently delete assessments, an instructor can retract an assessment to keep it from students. Since such an assessment would presumably no longer be used to calculate final grades, Samigo should also remove that assessment from the gradebook.

Specified by:
removeExternalAssessment in interface GradebookService
Parameters:
externalId - the UID of the assessment
Throws:
GradebookNotFoundException
AssessmentNotFoundException
See Also:
GradebookService.removeExternalAssessment(java.lang.String, java.lang.String)

updateExternalAssessmentScore

public void updateExternalAssessmentScore(String gradebookUid,
                                          String externalId,
                                          String studentUid,
                                          Double points)
                                   throws GradebookNotFoundException,
                                          AssessmentNotFoundException
Description copied from interface: GradebookService
Updates an external score for an external assignment in the gradebook.

Specified by:
updateExternalAssessmentScore in interface GradebookService
Parameters:
gradebookUid - The Uid of the gradebook
externalId - The external ID of the assignment/assessment
studentUid - The unique id of the student
points - The number of points earned on this assessment, or null if a score should be removed
Throws:
GradebookNotFoundException
AssessmentNotFoundException
See Also:
GradebookService.updateExternalAssessmentScore(java.lang.String, java.lang.String, java.lang.String, Double)

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 external assessment systems a chance to avoid the ConflictingAssignmentNameException.

Specified by:
isAssignmentDefined in interface GradebookService
Throws:
GradebookNotFoundException

isUserAbleToGradeStudent

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

Specified by:
isUserAbleToGradeStudent in interface GradebookService

getAssignments

public List 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

getAssignmentScore

public Double getAssignmentScore(String gradebookUid,
                                 String assignmentName,
                                 String studentUid)
                          throws GradebookNotFoundException,
                                 AssessmentNotFoundException
Description copied from interface: GradebookService
Besides the declared exceptions, possible runtime exceptions include:

Specified by:
getAssignmentScore in interface GradebookService
Returns:
Returns the current score for the student, or null if no score has been assigned yet.
Throws:
GradebookNotFoundException
AssessmentNotFoundException

setAssignmentScore

public void setAssignmentScore(String gradebookUid,
                               String assignmentName,
                               String studentUid,
                               Double score,
                               String clientServiceDescription)
                        throws GradebookNotFoundException,
                               AssessmentNotFoundException
Description copied from interface: GradebookService
Besides the declared exceptions, possible runtime exceptions include:

Specified by:
setAssignmentScore in interface GradebookService
Parameters:
clientServiceDescription - What to display as the programmatic source of the score (e.g., "Message Center").
Throws:
GradebookNotFoundException
AssessmentNotFoundException

getGradebookManager

public GradebookManager getGradebookManager()

setGradebookManager

public void setGradebookManager(GradebookManager gradebookManager)

getGradeManager

public GradeManager getGradeManager()

setGradeManager

public void setGradeManager(GradeManager gradeManager)

getAuthz

public Authz getAuthz()

setAuthz

public void setAuthz(Authz authz)