org.sakaiproject.component.gradebook
Class BaseHibernateManager
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
org.sakaiproject.component.gradebook.BaseHibernateManager
- All Implemented Interfaces:
- org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- GradebookExternalAssessmentServiceImpl, GradebookFrameworkServiceImpl, GradebookPermissionServiceImpl, GradebookServiceHibernateImpl
public abstract class BaseHibernateManager
- extends org.springframework.orm.hibernate3.support.HibernateDaoSupport
Provides methods which are shared between service business logic and application business
logic, but not exposed to external callers.
| Fields inherited from class org.springframework.dao.support.DaoSupport |
logger |
|
Method Summary |
Long |
addPermission(Long gradebookId,
String userId,
String function,
Long categoryId,
String groupId)
|
protected Double |
calculateEquivalentPercent(Double doublePointsPossible,
Double doublePointsEarned)
|
protected Double |
calculateEquivalentPointValueForPercent(Double doublePointsPossible,
Double doublePercentEarned)
|
protected List |
convertPointsToLetterGrade(Gradebook gradebook,
List studentRecordsFromDB)
Converts points to letter grade for the given AssignmentGradeRecords |
protected List |
convertPointsToPercentage(Gradebook gradebook,
List studentRecordsFromDB)
Converts points to percentage for the given AssignmentGradeRecords |
Long |
createAssignment(Long gradebookId,
String name,
Double points,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
|
Long |
createAssignmentForCategory(Long gradebookId,
Long categoryId,
String name,
Double points,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
|
Long |
createCategory(Long gradebookId,
String name,
Double weight,
Integer drop_lowest,
Integer dropHighest,
Integer keepHighest,
Boolean is_extra_credit)
|
void |
createDefaultLetterGradePercentMapping(Map gradeMap)
|
void |
createOrUpdateDefaultLetterGradePercentMapping(Map gradeMap)
|
Long |
createUngradedAssignment(Long gradebookId,
String name,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
|
Long |
createUngradedAssignmentForCategory(Long gradebookId,
Long categoryId,
String name,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
|
void |
deletePermission(Permission perm)
|
protected List |
filterGradeRecordsByStudents(Collection gradeRecords,
Collection studentUids)
Oracle has a low limit on the maximum length of a parameter list
in SQL queries of the form "WHERE tbl.col IN (:paramList)". |
protected void |
finalizeNullGradeRecords(Gradebook gradebook)
|
protected Set |
getAllStudentUids(String gradebookUid)
|
Assignment |
getAssignment(Long gradableObjectId)
|
protected AssignmentGradeRecord |
getAssignmentGradeRecord(Assignment assignment,
String studentUid,
org.hibernate.Session session)
|
protected List |
getAssignments(Long gradebookId,
org.hibernate.Session session)
|
List |
getAssignmentsForCategory(Long categoryId)
|
protected Assignment |
getAssignmentWithoutStats(String gradebookUid,
Long assignmentId,
org.hibernate.Session session)
|
protected Assignment |
getAssignmentWithoutStats(String gradebookUid,
String assignmentName,
org.hibernate.Session session)
|
Authn |
getAuthn()
|
List |
getCategories(Long gradebookId)
|
List |
getCategoriesWithAssignments(Long gradebookId)
|
Category |
getCategory(Long categoryId)
|
List |
getComments(Assignment assignment,
Collection studentIds)
|
protected List |
getCountedStudentGradeRecords(Long gradebookId,
String studentId,
org.hibernate.Session session)
|
CourseGrade |
getCourseGrade(Long gradebookId)
|
protected CourseGradeRecord |
getCourseGradeRecord(Gradebook gradebook,
String studentId,
org.hibernate.Session session)
Gets the course grade record for a student, or null if it does not yet exist. |
LetterGradePercentMapping |
getDefaultLetterGradePercentMapping()
|
protected EventTrackingService |
getEventTrackingService()
|
Gradebook |
getGradebook(String uid)
|
protected GradebookExternalAssessmentService |
getGradebookExternalAssessmentService()
|
String |
getGradebookUid(Long id)
|
LetterGradePercentMapping |
getLetterGradePercentMapping(Gradebook gradebook)
|
List |
getPermissionsForGB(Long gradebookId)
|
List |
getPermissionsForGBForCategoryIds(Long gradebookId,
List cateIds)
|
List<Permission> |
getPermissionsForUser(Long gradebookId,
String userId)
|
List |
getPermissionsForUserAnyCategory(Long gradebookId,
String userId)
|
List |
getPermissionsForUserAnyGroup(Long gradebookId,
String userId)
|
List |
getPermissionsForUserAnyGroupAnyCategory(Long gradebookId,
String userId)
|
List<Permission> |
getPermissionsForUserAnyGroupForCategory(Long gradebookId,
String userId,
List cateIds)
|
List |
getPermissionsForUserForCategory(Long gradebookId,
String userId,
List cateIds)
|
List |
getPermissionsForUserForGoupsAnyCategory(Long gradebookId,
String userId,
List groupIds)
|
List |
getPermissionsForUserForGroup(Long gradebookId,
String userId,
List groupIds)
|
protected Map |
getPropertiesMap()
|
String |
getPropertyValue(String name)
|
protected SectionAwareness |
getSectionAwareness()
|
protected org.sakaiproject.component.api.ServerConfigurationService |
getServerConfigurationService()
|
protected String |
getUserUid()
|
protected Map<String,Set<Assignment>> |
getVisibleExternalAssignments(Gradebook gradebook,
Collection<String> studentIds,
List<Assignment> assignments)
|
boolean |
isAssignmentDefined(Long gradableObjectId)
|
boolean |
isExplicitlyEnteredCourseGradeRecords(Long gradebookId)
|
boolean |
isGradebookDefined(String gradebookUid)
|
void |
postEvent(String message,
String objectReference)
|
void |
removeCategory(Long categoryId)
|
void |
saveOrUpdateLetterGradePercentMapping(Map gradeMap,
Gradebook gradebook)
|
void |
setAuthn(Authn authn)
|
void |
setEventTrackingService(EventTrackingService eventTrackingService)
|
void |
setGradebookExternalAssessmentService(GradebookExternalAssessmentService externalAssessmentService)
|
void |
setPropertyValue(String name,
String value)
|
void |
setSectionAwareness(SectionAwareness sectionAwareness)
|
void |
setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService)
|
protected boolean |
studentCanView(String studentId,
Assignment assignment)
|
protected void |
updateAssignment(Assignment assignment,
org.hibernate.Session session)
|
void |
updateCategory(Category category)
|
protected void |
updateCategory(Category category,
org.hibernate.Session session)
|
void |
updateGradebook(Gradebook gradebook)
|
void |
updatePermission(Collection perms)
|
void |
updatePermission(Permission perm)
|
protected boolean |
validateLetterGradeMapping(Map gradeMap)
|
| 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 |
MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST
public static int MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST
sectionAwareness
protected SectionAwareness sectionAwareness
authn
protected Authn authn
eventTrackingService
protected EventTrackingService eventTrackingService
serverConfigurationService
protected org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService
externalAssessmentService
protected GradebookExternalAssessmentService externalAssessmentService
propertiesMap
protected Map propertiesMap
BaseHibernateManager
public BaseHibernateManager()
getGradebook
public Gradebook getGradebook(String uid)
throws GradebookNotFoundException
- Throws:
GradebookNotFoundException
isGradebookDefined
public boolean isGradebookDefined(String gradebookUid)
getAssignments
protected List getAssignments(Long gradebookId,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
getCountedStudentGradeRecords
protected List getCountedStudentGradeRecords(Long gradebookId,
String studentId,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
getCourseGrade
public CourseGrade getCourseGrade(Long gradebookId)
getCourseGradeRecord
protected CourseGradeRecord getCourseGradeRecord(Gradebook gradebook,
String studentId,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Gets the course grade record for a student, or null if it does not yet exist.
- Parameters:
studentId - The student IDsession - The hibernate session
- Returns:
- A List of grade records
- Throws:
org.hibernate.HibernateException
getGradebookUid
public String getGradebookUid(Long id)
getAllStudentUids
protected Set getAllStudentUids(String gradebookUid)
getPropertiesMap
protected Map getPropertiesMap()
getPropertyValue
public String getPropertyValue(String name)
setPropertyValue
public void setPropertyValue(String name,
String value)
filterGradeRecordsByStudents
protected List filterGradeRecordsByStudents(Collection gradeRecords,
Collection studentUids)
- Oracle has a low limit on the maximum length of a parameter list
in SQL queries of the form "WHERE tbl.col IN (:paramList)".
Since enrollment lists can sometimes be very long, we've replaced
such queries with full selects followed by filtering. This helper
method filters out unwanted grade records. (Typically they're not
wanted because they're either no longer officially enrolled in the
course or they're not members of the selected section.)
getAssignmentWithoutStats
protected Assignment getAssignmentWithoutStats(String gradebookUid,
String assignmentName,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
getAssignmentWithoutStats
protected Assignment getAssignmentWithoutStats(String gradebookUid,
Long assignmentId,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
updateAssignment
protected void updateAssignment(Assignment assignment,
org.hibernate.Session session)
throws ConflictingAssignmentNameException,
org.hibernate.HibernateException
- Throws:
ConflictingAssignmentNameException
org.hibernate.HibernateException
getAssignmentGradeRecord
protected AssignmentGradeRecord getAssignmentGradeRecord(Assignment assignment,
String studentUid,
org.hibernate.Session session)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
createAssignment
public Long createAssignment(Long gradebookId,
String name,
Double points,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
throws ConflictingAssignmentNameException,
StaleObjectModificationException
- Throws:
ConflictingAssignmentNameException
StaleObjectModificationException
updateGradebook
public void updateGradebook(Gradebook gradebook)
throws StaleObjectModificationException
- Throws:
StaleObjectModificationException
isExplicitlyEnteredCourseGradeRecords
public boolean isExplicitlyEnteredCourseGradeRecords(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)
getServerConfigurationService
protected org.sakaiproject.component.api.ServerConfigurationService getServerConfigurationService()
setServerConfigurationService
public void setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService)
getEventTrackingService
protected EventTrackingService getEventTrackingService()
setEventTrackingService
public void setEventTrackingService(EventTrackingService eventTrackingService)
getGradebookExternalAssessmentService
protected GradebookExternalAssessmentService getGradebookExternalAssessmentService()
setGradebookExternalAssessmentService
public void setGradebookExternalAssessmentService(GradebookExternalAssessmentService externalAssessmentService)
postEvent
public void postEvent(String message,
String objectReference)
createCategory
public Long createCategory(Long gradebookId,
String name,
Double weight,
Integer drop_lowest,
Integer dropHighest,
Integer keepHighest,
Boolean is_extra_credit)
throws ConflictingCategoryNameException,
StaleObjectModificationException
- Throws:
ConflictingCategoryNameException
StaleObjectModificationException
getCategories
public List getCategories(Long gradebookId)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
getCategoriesWithAssignments
public List getCategoriesWithAssignments(Long gradebookId)
createAssignmentForCategory
public Long createAssignmentForCategory(Long gradebookId,
Long categoryId,
String name,
Double points,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
throws ConflictingAssignmentNameException,
StaleObjectModificationException,
IllegalArgumentException
- Throws:
ConflictingAssignmentNameException
StaleObjectModificationException
IllegalArgumentException
getAssignmentsForCategory
public List getAssignmentsForCategory(Long categoryId)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
getCategory
public Category getCategory(Long categoryId)
throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
updateCategory
protected void updateCategory(Category category,
org.hibernate.Session session)
throws ConflictingAssignmentNameException,
org.hibernate.HibernateException
- Throws:
ConflictingAssignmentNameException
org.hibernate.HibernateException
updateCategory
public void updateCategory(Category category)
throws ConflictingCategoryNameException,
StaleObjectModificationException
- Throws:
ConflictingCategoryNameException
StaleObjectModificationException
removeCategory
public void removeCategory(Long categoryId)
throws StaleObjectModificationException
- Throws:
StaleObjectModificationException
getDefaultLetterGradePercentMapping
public LetterGradePercentMapping getDefaultLetterGradePercentMapping()
createOrUpdateDefaultLetterGradePercentMapping
public void createOrUpdateDefaultLetterGradePercentMapping(Map gradeMap)
createDefaultLetterGradePercentMapping
public void createDefaultLetterGradePercentMapping(Map gradeMap)
getLetterGradePercentMapping
public LetterGradePercentMapping getLetterGradePercentMapping(Gradebook gradebook)
saveOrUpdateLetterGradePercentMapping
public void saveOrUpdateLetterGradePercentMapping(Map gradeMap,
Gradebook gradebook)
validateLetterGradeMapping
protected boolean validateLetterGradeMapping(Map gradeMap)
createUngradedAssignment
public Long createUngradedAssignment(Long gradebookId,
String name,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
throws ConflictingAssignmentNameException,
StaleObjectModificationException
- Throws:
ConflictingAssignmentNameException
StaleObjectModificationException
createUngradedAssignmentForCategory
public Long createUngradedAssignmentForCategory(Long gradebookId,
Long categoryId,
String name,
Date dueDate,
Boolean isNotCounted,
Boolean isReleased)
throws ConflictingAssignmentNameException,
StaleObjectModificationException,
IllegalArgumentException
- Throws:
ConflictingAssignmentNameException
StaleObjectModificationException
IllegalArgumentException
addPermission
public Long addPermission(Long gradebookId,
String userId,
String function,
Long categoryId,
String groupId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForGB
public List getPermissionsForGB(Long gradebookId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
updatePermission
public void updatePermission(Collection perms)
updatePermission
public void updatePermission(Permission perm)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
deletePermission
public void deletePermission(Permission perm)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUser
public List<Permission> getPermissionsForUser(Long gradebookId,
String userId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserForCategory
public List getPermissionsForUserForCategory(Long gradebookId,
String userId,
List cateIds)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserAnyCategory
public List getPermissionsForUserAnyCategory(Long gradebookId,
String userId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserAnyGroup
public List getPermissionsForUserAnyGroup(Long gradebookId,
String userId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserAnyGroupForCategory
public List<Permission> getPermissionsForUserAnyGroupForCategory(Long gradebookId,
String userId,
List cateIds)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForGBForCategoryIds
public List getPermissionsForGBForCategoryIds(Long gradebookId,
List cateIds)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserAnyGroupAnyCategory
public List getPermissionsForUserAnyGroupAnyCategory(Long gradebookId,
String userId)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserForGoupsAnyCategory
public List getPermissionsForUserForGoupsAnyCategory(Long gradebookId,
String userId,
List groupIds)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getPermissionsForUserForGroup
public List getPermissionsForUserForGroup(Long gradebookId,
String userId,
List groupIds)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
isAssignmentDefined
public boolean isAssignmentDefined(Long gradableObjectId)
getAssignment
public Assignment getAssignment(Long gradableObjectId)
- Parameters:
gradableObjectId -
- Returns:
- the Assignment object with the given id
calculateEquivalentPercent
protected Double calculateEquivalentPercent(Double doublePointsPossible,
Double doublePointsEarned)
- Parameters:
doublePointsPossible - doublePointsEarned -
- Returns:
- the % equivalent for the given points possible and points earned
convertPointsToPercentage
protected List convertPointsToPercentage(Gradebook gradebook,
List studentRecordsFromDB)
- Converts points to percentage for the given AssignmentGradeRecords
- Parameters:
gradebook - studentRecordsFromDB -
- Returns:
convertPointsToLetterGrade
protected List convertPointsToLetterGrade(Gradebook gradebook,
List studentRecordsFromDB)
- Converts points to letter grade for the given AssignmentGradeRecords
- Parameters:
gradebook - studentRecordsFromDB -
- Returns:
calculateEquivalentPointValueForPercent
protected Double calculateEquivalentPointValueForPercent(Double doublePointsPossible,
Double doublePercentEarned)
getComments
public List getComments(Assignment assignment,
Collection studentIds)
getVisibleExternalAssignments
protected Map<String,Set<Assignment>> getVisibleExternalAssignments(Gradebook gradebook,
Collection<String> studentIds,
List<Assignment> assignments)
studentCanView
protected boolean studentCanView(String studentId,
Assignment assignment)
finalizeNullGradeRecords
protected void finalizeNullGradeRecords(Gradebook gradebook)
Copyright © 2003-2013 Sakai Project. All Rights Reserved.