001: /**********************************************************************************
002: *
003: * $Id: GradebookServiceHibernateImpl.java 28316 2007-04-04 18:18:49Z ajpoland@iupui.edu $
004: *
005: ***********************************************************************************
006: *
007: * Copyright (c) 2005, 2006 The Regents of the University of California, The MIT Corporation
008: *
009: * Licensed under the Educational Community License Version 1.0 (the "License");
010: * By obtaining, using and/or copying this Original Work, you agree that you have read,
011: * understand, and will comply with the terms and conditions of the Educational Community License.
012: * You may obtain a copy of the License at:
013: *
014: * http://www.opensource.org/licenses/ecl1.php
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
017: * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
018: * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
019: * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
020: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
021: *
022: **********************************************************************************/package org.sakaiproject.component.gradebook;
023:
024: import java.util.ArrayList;
025: import java.util.Collection;
026: import java.util.Date;
027: import java.util.HashMap;
028: import java.util.Iterator;
029: import java.util.List;
030: import java.util.Map;
031: import java.util.Set;
032:
033: import org.apache.commons.lang.StringUtils;
034: import org.apache.commons.logging.Log;
035: import org.apache.commons.logging.LogFactory;
036: import org.hibernate.HibernateException;
037: import org.hibernate.Query;
038: import org.hibernate.Session;
039: import org.sakaiproject.service.gradebook.shared.AssessmentNotFoundException;
040: import org.sakaiproject.service.gradebook.shared.AssignmentHasIllegalPointsException;
041: import org.sakaiproject.service.gradebook.shared.CommentDefinition;
042: import org.sakaiproject.service.gradebook.shared.ConflictingAssignmentNameException;
043: import org.sakaiproject.service.gradebook.shared.ConflictingExternalIdException;
044: import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService;
045: import org.sakaiproject.service.gradebook.shared.GradebookFrameworkService;
046: import org.sakaiproject.service.gradebook.shared.GradebookNotFoundException;
047: import org.sakaiproject.service.gradebook.shared.GradebookService;
048: import org.sakaiproject.tool.gradebook.Assignment;
049: import org.sakaiproject.tool.gradebook.AssignmentGradeRecord;
050: import org.sakaiproject.tool.gradebook.Comment;
051: import org.sakaiproject.tool.gradebook.GradeMapping;
052: import org.sakaiproject.tool.gradebook.Gradebook;
053: import org.sakaiproject.tool.gradebook.GradingEvent;
054: import org.sakaiproject.tool.gradebook.facades.Authz;
055: import org.springframework.orm.hibernate3.HibernateCallback;
056:
057: /**
058: * A Hibernate implementation of GradebookService.
059: */
060: public class GradebookServiceHibernateImpl extends BaseHibernateManager
061: implements GradebookService {
062: private static final Log log = LogFactory
063: .getLog(GradebookServiceHibernateImpl.class);
064:
065: private GradebookFrameworkService frameworkService;
066: private GradebookExternalAssessmentService externalAssessmentService;
067: private Authz authz;
068:
069: public boolean isAssignmentDefined(final String gradebookUid,
070: final String assignmentName)
071: throws GradebookNotFoundException {
072: if (!isUserAbleToViewAssignments(gradebookUid)) {
073: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
074: + " in gradebook " + gradebookUid
075: + " attempted to check for assignment "
076: + assignmentName);
077: throw new SecurityException(
078: "You do not have permission to perform this operation");
079: }
080: Assignment assignment = (Assignment) getHibernateTemplate()
081: .execute(new HibernateCallback() {
082: public Object doInHibernate(Session session)
083: throws HibernateException {
084: return getAssignmentWithoutStats(gradebookUid,
085: assignmentName, session);
086: }
087: });
088: return (assignment != null);
089: }
090:
091: private boolean isUserAbleToViewAssignments(String gradebookUid) {
092: Authz authz = getAuthz();
093: return (authz.isUserAbleToEditAssessments(gradebookUid) || authz
094: .isUserAbleToGrade(gradebookUid));
095: }
096:
097: public boolean isUserAbleToGradeStudent(String gradebookUid,
098: String studentUid) {
099: return getAuthz().isUserAbleToGradeStudent(gradebookUid,
100: studentUid);
101: }
102:
103: public List<org.sakaiproject.service.gradebook.shared.Assignment> getAssignments(
104: String gradebookUid) throws GradebookNotFoundException {
105: if (!isUserAbleToViewAssignments(gradebookUid)) {
106: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
107: + " in gradebook " + gradebookUid
108: + " attempted to get assignments list");
109: throw new SecurityException(
110: "You do not have permission to perform this operation");
111: }
112:
113: final Long gradebookId = getGradebook(gradebookUid).getId();
114:
115: List internalAssignments = (List) getHibernateTemplate()
116: .execute(new HibernateCallback() {
117: public Object doInHibernate(Session session)
118: throws HibernateException {
119: return getAssignments(gradebookId, session);
120: }
121: });
122:
123: List<org.sakaiproject.service.gradebook.shared.Assignment> assignments = new ArrayList<org.sakaiproject.service.gradebook.shared.Assignment>();
124: for (Iterator iter = internalAssignments.iterator(); iter
125: .hasNext();) {
126: Assignment assignment = (Assignment) iter.next();
127: assignments.add(getAssignmentDefinition(assignment));
128: }
129: return assignments;
130: }
131:
132: public org.sakaiproject.service.gradebook.shared.Assignment getAssignment(
133: final String gradebookUid, final String assignmentName)
134: throws GradebookNotFoundException {
135: if (!isUserAbleToViewAssignments(gradebookUid)) {
136: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
137: + " in gradebook " + gradebookUid
138: + " attempted to get assignment " + assignmentName);
139: throw new SecurityException(
140: "You do not have permission to perform this operation");
141: }
142: Assignment assignment = (Assignment) getHibernateTemplate()
143: .execute(new HibernateCallback() {
144: public Object doInHibernate(Session session)
145: throws HibernateException {
146: return getAssignmentWithoutStats(gradebookUid,
147: assignmentName, session);
148: }
149: });
150: if (assignment != null) {
151: return getAssignmentDefinition(assignment);
152: } else {
153: return null;
154: }
155: }
156:
157: private org.sakaiproject.service.gradebook.shared.Assignment getAssignmentDefinition(
158: Assignment internalAssignment) {
159: org.sakaiproject.service.gradebook.shared.Assignment assignmentDefinition = new org.sakaiproject.service.gradebook.shared.Assignment();
160: assignmentDefinition.setName(internalAssignment.getName());
161: assignmentDefinition.setPoints(internalAssignment
162: .getPointsPossible());
163: assignmentDefinition
164: .setDueDate(internalAssignment.getDueDate());
165: assignmentDefinition.setCounted(internalAssignment.isCounted());
166: assignmentDefinition.setExternallyMaintained(internalAssignment
167: .isExternallyMaintained());
168: assignmentDefinition.setExternalAppName(internalAssignment
169: .getExternalAppName());
170: assignmentDefinition.setExternalId(internalAssignment
171: .getExternalId());
172: assignmentDefinition.setReleased(internalAssignment
173: .isReleased());
174: return assignmentDefinition;
175: }
176:
177: public Double getAssignmentScore(final String gradebookUid,
178: final String assignmentName, final String studentUid)
179: throws GradebookNotFoundException,
180: AssessmentNotFoundException {
181: final boolean studentRequestingOwnScore = authn.getUserUid()
182: .equals(studentUid);
183: if (!studentRequestingOwnScore
184: && !isUserAbleToGradeStudent(gradebookUid, studentUid)) {
185: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
186: + " in gradebook " + gradebookUid
187: + " attempted to retrieve grade for student "
188: + studentUid);
189: throw new SecurityException(
190: "You do not have permission to perform this operation");
191: }
192:
193: Double assignmentScore = (Double) getHibernateTemplate()
194: .execute(new HibernateCallback() {
195: public Object doInHibernate(Session session)
196: throws HibernateException {
197: Assignment assignment = getAssignmentWithoutStats(
198: gradebookUid, assignmentName, session);
199: if (assignment == null) {
200: throw new AssessmentNotFoundException(
201: "There is no assignment named "
202: + assignmentName
203: + " in gradebook "
204: + gradebookUid);
205: }
206:
207: // If this is the student, then the assignment needs to have
208: // been released.
209: if (studentRequestingOwnScore
210: && !assignment.isReleased()) {
211: log
212: .error("AUTHORIZATION FAILURE: Student "
213: + getUserUid()
214: + " in gradebook "
215: + gradebookUid
216: + " attempted to retrieve score for unreleased assignment "
217: + assignment.getName());
218: throw new SecurityException(
219: "You do not have permission to perform this operation");
220: }
221:
222: AssignmentGradeRecord gradeRecord = getAssignmentGradeRecord(
223: assignment, studentUid, session);
224: if (log.isDebugEnabled())
225: log.debug("gradeRecord=" + gradeRecord);
226: if (gradeRecord == null) {
227: return null;
228: } else {
229: return gradeRecord.getPointsEarned();
230: }
231: }
232: });
233: if (log.isDebugEnabled())
234: log.debug("returning " + assignmentScore);
235: return assignmentScore;
236: }
237:
238: public void setAssignmentScore(final String gradebookUid,
239: final String assignmentName, final String studentUid,
240: final Double score, final String clientServiceDescription)
241: throws GradebookNotFoundException,
242: AssessmentNotFoundException {
243: if (!isUserAbleToGradeStudent(gradebookUid, studentUid)) {
244: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
245: + " in gradebook " + gradebookUid
246: + " attempted to grade student " + studentUid
247: + " from " + clientServiceDescription);
248: throw new SecurityException(
249: "You do not have permission to perform this operation");
250: }
251:
252: getHibernateTemplate().execute(new HibernateCallback() {
253: public Object doInHibernate(Session session)
254: throws HibernateException {
255: Assignment assignment = getAssignmentWithoutStats(
256: gradebookUid, assignmentName, session);
257: if (assignment == null) {
258: throw new AssessmentNotFoundException(
259: "There is no assignment named "
260: + assignmentName + " in gradebook "
261: + gradebookUid);
262: }
263: if (assignment.isExternallyMaintained()) {
264: log
265: .error("AUTHORIZATION FAILURE: User "
266: + getUserUid()
267: + " in gradebook "
268: + gradebookUid
269: + " attempted to grade externally maintained assignment "
270: + assignmentName + " from "
271: + clientServiceDescription);
272: throw new SecurityException(
273: "You do not have permission to perform this operation");
274: }
275:
276: Date now = new Date();
277: String graderId = getAuthn().getUserUid();
278: AssignmentGradeRecord gradeRecord = getAssignmentGradeRecord(
279: assignment, studentUid, session);
280: if (gradeRecord == null) {
281: // Creating a new grade record.
282: gradeRecord = new AssignmentGradeRecord(assignment,
283: studentUid, score);
284: } else {
285: gradeRecord.setPointsEarned(score);
286: }
287: gradeRecord.setGraderId(graderId);
288: gradeRecord.setDateRecorded(now);
289: session.saveOrUpdate(gradeRecord);
290:
291: session.save(new GradingEvent(assignment, graderId,
292: studentUid, score));
293:
294: // Sync database.
295: session.flush();
296: session.clear();
297: return null;
298: }
299: });
300:
301: if (log.isInfoEnabled())
302: log
303: .info("Score updated in gradebookUid="
304: + gradebookUid + ", assignmentName="
305: + assignmentName + " by userUid="
306: + getUserUid() + " from client="
307: + clientServiceDescription + ", new score="
308: + score);
309: }
310:
311: private Comment getInternalComment(String gradebookUid,
312: String assignmentName, String studentUid, Session session) {
313: Query q = session
314: .createQuery("from Comment as c where c.studentId=:studentId and c.gradableObject.gradebook.uid=:gradebookUid and c.gradableObject.name=:assignmentName");
315: q.setParameter("studentId", studentUid);
316: q.setParameter("gradebookUid", gradebookUid);
317: q.setParameter("assignmentName", assignmentName);
318: return (Comment) q.uniqueResult();
319: }
320:
321: public CommentDefinition getAssignmentScoreComment(
322: final String gradebookUid, final String assignmentName,
323: final String studentUid) throws GradebookNotFoundException,
324: AssessmentNotFoundException {
325: CommentDefinition commentDefinition = null;
326: Comment comment = (Comment) getHibernateTemplate().execute(
327: new HibernateCallback() {
328: public Object doInHibernate(Session session)
329: throws HibernateException {
330: return getInternalComment(gradebookUid,
331: assignmentName, studentUid, session);
332: }
333: });
334: if (comment != null) {
335: commentDefinition = new CommentDefinition();
336: commentDefinition.setAssignmentName(assignmentName);
337: commentDefinition.setCommentText(comment.getCommentText());
338: commentDefinition
339: .setDateRecorded(comment.getDateRecorded());
340: commentDefinition.setGraderUid(comment.getGraderId());
341: commentDefinition.setStudentUid(comment.getStudentId());
342: }
343: return commentDefinition;
344: }
345:
346: public void setAssignmentScoreComment(final String gradebookUid,
347: final String assignmentName, final String studentUid,
348: final String commentText)
349: throws GradebookNotFoundException,
350: AssessmentNotFoundException {
351: getHibernateTemplate().execute(new HibernateCallback() {
352: public Object doInHibernate(Session session)
353: throws HibernateException {
354: Comment comment = getInternalComment(gradebookUid,
355: assignmentName, studentUid, session);
356: if (comment == null) {
357: comment = new Comment(studentUid, commentText,
358: getAssignmentWithoutStats(gradebookUid,
359: assignmentName, session));
360: } else {
361: comment.setCommentText(commentText);
362: }
363: comment.setGraderId(authn.getUserUid());
364: comment.setDateRecorded(new Date());
365: session.saveOrUpdate(comment);
366: return null;
367: }
368: });
369: }
370:
371: public String getGradebookDefinitionXml(String gradebookUid) {
372: Gradebook gradebook = getGradebook(gradebookUid);
373:
374: GradebookDefinition gradebookDefinition = new GradebookDefinition();
375: GradeMapping selectedGradeMapping = gradebook
376: .getSelectedGradeMapping();
377: gradebookDefinition
378: .setSelectedGradingScaleUid(selectedGradeMapping
379: .getGradingScale().getUid());
380: gradebookDefinition
381: .setSelectedGradingScaleBottomPercents(new HashMap<String, Double>(
382: selectedGradeMapping.getGradeMap()));
383: gradebookDefinition
384: .setAssignments(getAssignments(gradebookUid));
385:
386: return VersionedExternalizable.toXml(gradebookDefinition);
387: }
388:
389: public void mergeGradebookDefinitionXml(String toGradebookUid,
390: String fromGradebookXml) {
391: final Gradebook gradebook = getGradebook(toGradebookUid);
392: GradebookDefinition gradebookDefinition = (GradebookDefinition) VersionedExternalizable
393: .fromXml(fromGradebookXml);
394:
395: List<String> assignmentNames = (List<String>) getHibernateTemplate()
396: .execute(new HibernateCallback() {
397: public Object doInHibernate(final Session session)
398: throws HibernateException {
399: return session
400: .createQuery(
401: "select asn.name from Assignment as asn where asn.gradebook.id=? and asn.removed=false")
402: .setLong(0,
403: gradebook.getId().longValue())
404: .list();
405: }
406: });
407:
408: // Add any non-externally-managed assignments with non-duplicate names.
409: int assignmentsAddedCount = 0;
410: for (org.sakaiproject.service.gradebook.shared.Assignment obj : gradebookDefinition
411: .getAssignments()) {
412: org.sakaiproject.service.gradebook.shared.Assignment assignmentDef = (org.sakaiproject.service.gradebook.shared.Assignment) obj;
413:
414: // Externally managed assessments should not be included.
415: if (assignmentDef.isExternallyMaintained()) {
416: continue;
417: }
418:
419: // Skip any input assignments with duplicate names.
420: if (assignmentNames.contains(assignmentDef.getName())) {
421: if (log.isInfoEnabled())
422: log.info("Merge to gradebook " + toGradebookUid
423: + " skipped duplicate assignment named "
424: + assignmentDef.getName());
425: continue;
426: }
427:
428: // All assignments should be unreleased even if they were released in the original.
429: createAssignment(gradebook.getId(),
430: assignmentDef.getName(), assignmentDef.getPoints(),
431: assignmentDef.getDueDate(), !assignmentDef
432: .isCounted(), false);
433: assignmentsAddedCount++;
434: }
435: if (log.isInfoEnabled())
436: log.info("Merge to gradebook " + toGradebookUid + " added "
437: + assignmentsAddedCount + " assignments");
438:
439: // Carry over the old gradebook's selected grading scheme if possible.
440: String fromGradingScaleUid = gradebookDefinition
441: .getSelectedGradingScaleUid();
442: MERGE_GRADE_MAPPING: if (!StringUtils
443: .isEmpty(fromGradingScaleUid)) {
444: for (GradeMapping gradeMapping : gradebook
445: .getGradeMappings()) {
446: if (gradeMapping.getGradingScale().getUid().equals(
447: fromGradingScaleUid)) {
448: // We have a match. Now make sure that the grades are as expected.
449: Map<String, Double> inputGradePercents = gradebookDefinition
450: .getSelectedGradingScaleBottomPercents();
451: Set<String> gradeCodes = (Set<String>) inputGradePercents
452: .keySet();
453: if (gradeCodes.containsAll(gradeMapping
454: .getGradeMap().keySet())) {
455: // Modify the existing grade-to-percentage map.
456: for (String gradeCode : gradeCodes) {
457: gradeMapping.getGradeMap().put(gradeCode,
458: inputGradePercents.get(gradeCode));
459: }
460: gradebook.setSelectedGradeMapping(gradeMapping);
461: updateGradebook(gradebook);
462: if (log.isInfoEnabled())
463: log.info("Merge to gradebook "
464: + toGradebookUid
465: + " updated grade mapping");
466: } else {
467: if (log.isInfoEnabled())
468: log
469: .info("Merge to gradebook "
470: + toGradebookUid
471: + " skipped grade mapping change because the "
472: + fromGradingScaleUid
473: + " grade codes did not match");
474: }
475: break MERGE_GRADE_MAPPING;
476: }
477: }
478: // Did not find a matching grading scale.
479: if (log.isInfoEnabled())
480: log
481: .info("Merge to gradebook "
482: + toGradebookUid
483: + " skipped grade mapping change because grading scale "
484: + fromGradingScaleUid
485: + " is not defined");
486: }
487: }
488:
489: public void addAssignment(
490: String gradebookUid,
491: org.sakaiproject.service.gradebook.shared.Assignment assignmentDefinition) {
492: if (!getAuthz().isUserAbleToEditAssessments(gradebookUid)) {
493: log.error("AUTHORIZATION FAILURE: User " + getUserUid()
494: + " in gradebook " + gradebookUid
495: + " attempted to add an assignment");
496: throw new SecurityException(
497: "You do not have permission to perform this operation");
498: }
499:
500: // Ensure that points is > zero.
501: Double points = assignmentDefinition.getPoints();
502: if ((points == null) || (points.doubleValue() <= 0)) {
503: throw new AssignmentHasIllegalPointsException(
504: "Points must be > 0");
505: }
506:
507: Gradebook gradebook = getGradebook(gradebookUid);
508: createAssignment(gradebook.getId(), assignmentDefinition
509: .getName(), points, assignmentDefinition.getDueDate(),
510: !assignmentDefinition.isCounted(), assignmentDefinition
511: .isReleased());
512: }
513:
514: public void updateAssignment(
515: final String gradebookUid,
516: final String assignmentName,
517: final org.sakaiproject.service.gradebook.shared.Assignment assignmentDefinition) {
518: if (!getAuthz().isUserAbleToEditAssessments(gradebookUid)) {
519: log
520: .error("AUTHORIZATION FAILURE: User "
521: + getUserUid()
522: + " in gradebook "
523: + gradebookUid
524: + " attempted to change the definition of assignment "
525: + assignmentName);
526: throw new SecurityException(
527: "You do not have permission to perform this operation");
528: }
529:
530: // This method is for Gradebook-managed assignments only.
531: if (assignmentDefinition.isExternallyMaintained()) {
532: log.error("User " + getUserUid() + " in gradebook "
533: + gradebookUid + " attempted to set assignment "
534: + assignmentName + " to be externally maintained");
535: throw new SecurityException(
536: "You do not have permission to perform this operation");
537: }
538:
539: getHibernateTemplate().execute(new HibernateCallback() {
540: public Object doInHibernate(Session session)
541: throws HibernateException {
542: Assignment assignment = getAssignmentWithoutStats(
543: gradebookUid, assignmentName, session);
544: if (assignment == null) {
545: throw new AssessmentNotFoundException(
546: "There is no assignment named "
547: + assignmentName + " in gradebook "
548: + gradebookUid);
549: }
550: if (assignment.isExternallyMaintained()) {
551: log
552: .error("AUTHORIZATION FAILURE: User "
553: + getUserUid()
554: + " in gradebook "
555: + gradebookUid
556: + " attempted to change the definition of externally maintained assignment "
557: + assignmentName);
558: throw new SecurityException(
559: "You do not have permission to perform this operation");
560: }
561: assignment.setCounted(assignmentDefinition.isCounted());
562: assignment
563: .setDueDate(assignmentDefinition.getDueDate());
564: assignment.setName(assignmentDefinition.getName());
565: assignment.setPointsPossible(assignmentDefinition
566: .getPoints());
567: assignment.setReleased(assignmentDefinition
568: .isReleased());
569: updateAssignment(assignment, session);
570: return null;
571: }
572: });
573: }
574:
575: public Authz getAuthz() {
576: return authz;
577: }
578:
579: public void setAuthz(Authz authz) {
580: this .authz = authz;
581: }
582:
583: // Deprecated calls to new framework-specific interface.
584:
585: public void addGradebook(String uid, String name) {
586: frameworkService.addGradebook(uid, name);
587: }
588:
589: public void setAvailableGradingScales(
590: Collection gradingScaleDefinitions) {
591: frameworkService
592: .setAvailableGradingScales(gradingScaleDefinitions);
593: }
594:
595: public void setDefaultGradingScale(String uid) {
596: frameworkService.setDefaultGradingScale(uid);
597: }
598:
599: public void deleteGradebook(String uid)
600: throws GradebookNotFoundException {
601: frameworkService.deleteGradebook(uid);
602: }
603:
604: public boolean isGradebookDefined(String gradebookUid) {
605: return frameworkService.isGradebookDefined(gradebookUid);
606: }
607:
608: public GradebookFrameworkService getFrameworkService() {
609: return frameworkService;
610: }
611:
612: public void setFrameworkService(
613: GradebookFrameworkService frameworkService) {
614: this .frameworkService = frameworkService;
615: }
616:
617: // Deprecated calls to new interface for external assessment engines.
618:
619: public void addExternalAssessment(String gradebookUid,
620: String externalId, String externalUrl, String title,
621: double points, Date dueDate,
622: String externalServiceDescription)
623: throws ConflictingAssignmentNameException,
624: ConflictingExternalIdException, GradebookNotFoundException {
625: externalAssessmentService.addExternalAssessment(gradebookUid,
626: externalId, externalUrl, title, points, dueDate,
627: externalServiceDescription);
628: }
629:
630: public void updateExternalAssessment(String gradebookUid,
631: String externalId, String externalUrl, String title,
632: double points, Date dueDate)
633: throws GradebookNotFoundException,
634: AssessmentNotFoundException,
635: AssignmentHasIllegalPointsException {
636: externalAssessmentService.updateExternalAssessment(
637: gradebookUid, externalId, externalUrl, title, points,
638: dueDate);
639: }
640:
641: public void removeExternalAssessment(String gradebookUid,
642: String externalId) throws GradebookNotFoundException,
643: AssessmentNotFoundException {
644: externalAssessmentService.removeExternalAssessment(
645: gradebookUid, externalId);
646: }
647:
648: public void updateExternalAssessmentScore(String gradebookUid,
649: String externalId, String studentUid, Double points)
650: throws GradebookNotFoundException,
651: AssessmentNotFoundException {
652: externalAssessmentService.updateExternalAssessmentScore(
653: gradebookUid, externalId, studentUid, points);
654: }
655:
656: public void updateExternalAssessmentScores(String gradebookUid,
657: String externalId, Map studentUidsToScores)
658: throws GradebookNotFoundException,
659: AssessmentNotFoundException {
660: externalAssessmentService.updateExternalAssessmentScores(
661: gradebookUid, externalId, studentUidsToScores);
662: }
663:
664: public boolean isExternalAssignmentDefined(String gradebookUid,
665: String externalId) throws GradebookNotFoundException {
666: return externalAssessmentService.isExternalAssignmentDefined(
667: gradebookUid, externalId);
668: }
669:
670: public GradebookExternalAssessmentService getExternalAssessmentService() {
671: return externalAssessmentService;
672: }
673:
674: public void setExternalAssessmentService(
675: GradebookExternalAssessmentService externalAssessmentService) {
676: this.externalAssessmentService = externalAssessmentService;
677: }
678:
679: }
|