001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/facade/AssessmentBaseFacade.java $
003: * $Id: AssessmentBaseFacade.java 9273 2006-05-10 22:34:28Z daisyf@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the"License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.assessment.facade;
021:
022: import java.io.IOException;
023: import java.util.Date;
024: import java.util.HashMap;
025: import java.util.HashSet;
026: import java.util.Iterator;
027: import java.util.Set;
028:
029: import org.apache.commons.logging.Log;
030: import org.apache.commons.logging.LogFactory;
031: import org.osid.assessment.Assessment;
032: import org.osid.assessment.AssessmentException;
033: import org.osid.shared.Type;
034: import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentBaseData;
035: import org.sakaiproject.tool.assessment.data.dao.assessment.AssessmentMetaData;
036: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
037: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc;
038: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentFeedbackIfc;
039: import org.sakaiproject.tool.assessment.data.ifc.assessment.EvaluationModelIfc;
040: import org.sakaiproject.tool.assessment.data.ifc.shared.TypeIfc;
041: import org.sakaiproject.tool.assessment.osid.assessment.impl.AssessmentImpl;
042: import org.sakaiproject.tool.assessment.services.PersistenceService;
043:
044: public class AssessmentBaseFacade implements java.io.Serializable,
045: AssessmentBaseIfc {
046: private static Log log = LogFactory
047: .getLog(AssessmentBaseFacade.class);
048:
049: private AssessmentImpl assessmentImpl = new AssessmentImpl(); //<-- place holder
050: protected org.osid.assessment.Assessment assessment = (Assessment) assessmentImpl;
051:
052: private static final long serialVersionUID = 7526471155622776147L;
053: // We have 2 sets of properties:
054: // #1) properties according to org.osid.assessment.Assessment.
055: // Properties "description" will be persisted through data - daisyf 09/28/04
056: private org.osid.shared.Id id;
057: private String displayName;
058: private String description;
059: private AssessmentBaseIfc data;
060: private org.osid.shared.Type assessmentType;
061: // #2) properties according to AssessmentBaseIfc
062: private Long assessmentId;
063: private Boolean isTemplate;
064: private String title;
065: private Long typeId;
066: private Long parentId;
067: private Integer instructorNotification;
068: private Integer testeeNotification;
069: private Integer multipartAllowed;
070: private Integer status;
071: private String comments;
072: private String createdBy;
073: private Date createdDate;
074: private String lastModifiedBy;
075: private Date lastModifiedDate;
076: private AssessmentAccessControlIfc assessmentAccessControl;
077: private EvaluationModelIfc evaluationModel;
078: private AssessmentFeedbackIfc assessmentFeedback;
079: private Set assessmentMetaDataSet = new HashSet();
080: private HashMap assessmentMetaDataMap = new HashMap();
081: private Set securedIPAddressSet;
082: private String assessmentAttachmentMetaData;
083:
084: /** AssessmentBaseFacade is the class that is exposed to developer
085: * It contains some of the useful methods specified in
086: * org.osid.assessment.Assessment and it implements
087: * org.sakaiproject.tool.assessment.ifc.
088: * When new methods is added to osid api, this code is still workable.
089: * If signature in any of the osid methods that we mirrored changes,
090: * we only need to modify those particular methods.
091: * - daisyf
092: */
093:
094: public AssessmentBaseFacade() {
095: // need to hook AssessmentFacade.data to IsessmentData, our POJO for Hibernate
096: // persistence
097: this .data = new AssessmentBaseData();
098: try {
099: assessment.updateData(this .data);
100: } catch (AssessmentException ex) {
101: throw new DataFacadeException(ex.getMessage());
102: }
103: }
104:
105: /**
106: * This is a very important constructor. Please make sure that you have
107: * set all the properties (declared above as private) of AssessmentBaseFacade
108: * using the "data" supplied. "data" is a org.osid.assessment.Assessment properties
109: * and I use it to store info about an assessment.
110: * @param data
111: */
112: public AssessmentBaseFacade(AssessmentBaseIfc data) {
113: try {
114: setData(data);
115: } catch (AssessmentException ex) {
116: throw new DataFacadeException(ex.getMessage());
117: }
118: }
119:
120: /**
121: * Get the Id for this AssessmentBaseFacade.
122: * @return org.osid.shared.Id
123: */
124: org.osid.shared.Id getId() {
125: try {
126: this .data = (AssessmentBaseIfc) assessment.getData();
127: } catch (AssessmentException ex) {
128: throw new DataFacadeException(ex.getMessage());
129: }
130: return PersistenceService.getInstance()
131: .getAssessmentFacadeQueries().getId(
132: this .data.getAssessmentBaseId());
133: }
134:
135: /**
136: * Get the Type for this AssessmentBaseFacade.
137: * @return org.osid.shared.Type
138: */
139: Type getAssessmentType() {
140: try {
141: this .data = (AssessmentBaseIfc) assessment.getData();
142: } catch (AssessmentException ex) {
143: throw new DataFacadeException(ex.getMessage());
144: }
145: TypeFacadeQueriesAPI typeFacadeQueries = PersistenceService
146: .getInstance().getTypeFacadeQueries();
147: return typeFacadeQueries.getTypeById(this .data.getTypeId());
148: }
149:
150: public TypeIfc getType() {
151: return getAssessmentTypeFacade();
152: }
153:
154: public TypeFacade getAssessmentTypeFacade() {
155: try {
156: this .data = (AssessmentBaseIfc) assessment.getData();
157: } catch (AssessmentException ex) {
158: throw new DataFacadeException(ex.getMessage());
159: }
160: TypeFacadeQueriesAPI typeFacadeQueries = PersistenceService
161: .getInstance().getTypeFacadeQueries();
162: return typeFacadeQueries.getTypeFacadeById(this .data
163: .getTypeId());
164: }
165:
166: /**
167: * Get the data for this AssessmentBaseFacade.
168: * @return AssessmentDataIfc
169: */
170: public AssessmentBaseIfc getData() {
171: return this .data;
172: }
173:
174: /**
175: * Call setDate() to update data in AssessmentBaseFacade
176: * @param data
177: */
178: public void updateData(AssessmentBaseIfc data) {
179: try {
180: setData(data);
181: } catch (AssessmentException ex) {
182: throw new DataFacadeException(ex.getMessage());
183: }
184: }
185:
186: /**
187: * Set data for AssessmentBaseFacade
188: * @param data
189: */
190: public void setData(AssessmentBaseIfc data)
191: throws AssessmentException {
192: this .data = data;
193: try {
194: assessment.updateData(data);
195: } catch (AssessmentException ex) {
196: throw new DataFacadeException(ex.getMessage());
197: }
198: this .id = getId();
199: this .displayName = getDisplayName();
200: this .description = getDescription();
201: this .typeId = getTypeId();
202: this .parentId = getParentId();
203: this .assessmentType = getAssessmentType();
204: this .assessmentId = getAssessmentBaseId();
205: this .isTemplate = getIsTemplate();
206: this .title = getTitle();
207: this .comments = getComments();
208: this .assessmentMetaDataSet = getAssessmentMetaDataSet();
209: this .instructorNotification = getInstructorNotification();
210: this .testeeNotification = getTesteeNotification();
211: this .multipartAllowed = getMultipartAllowed();
212: this .status = getStatus();
213: this .createdBy = getCreatedBy();
214: this .createdDate = getCreatedDate();
215: this .lastModifiedBy = getLastModifiedBy();
216: this .lastModifiedDate = getLastModifiedDate();
217: this .assessmentAccessControl = getAssessmentAccessControl();
218: this .assessmentFeedback = getAssessmentFeedback();
219: this .evaluationModel = getEvaluationModel();
220: this .assessmentMetaDataMap = getAssessmentMetaDataMap(this .assessmentMetaDataSet);
221: this .securedIPAddressSet = getSecuredIPAddressSet();
222: }
223:
224: // the following methods implements
225: // org.sakaiproject.tool.assessment.ifc.AssessmentBaseIfc
226: public Long getAssessmentBaseId() throws DataFacadeException {
227: try {
228: this .data = (AssessmentBaseIfc) assessment.getData();
229: } catch (AssessmentException ex) {
230: throw new DataFacadeException(ex.getMessage());
231: }
232: return this .data.getAssessmentBaseId();
233: }
234:
235: /**
236: * Set assessmentId for AssessmentTemlateFacade
237: * @param assessmentId
238: */
239: public void setAssessmentBaseId(Long assessmentId) {
240: this .assessmentId = assessmentId;
241: this .data.setAssessmentBaseId(assessmentId);
242: }
243:
244: public Boolean getIsTemplate() throws DataFacadeException {
245: try {
246: this .data = (AssessmentBaseIfc) assessment.getData();
247: } catch (AssessmentException ex) {
248: throw new DataFacadeException(ex.getMessage());
249: }
250: return this .data.getIsTemplate();
251: }
252:
253: /**
254: * Set to true if record is a assessmentTemplate
255: */
256: public void setIsTemplate(Boolean isTemplate) {
257: this .isTemplate = isTemplate;
258: this .data.setIsTemplate(isTemplate);
259: }
260:
261: public String getDisplayName() throws DataFacadeException {
262: try {
263: this .data = (AssessmentBaseIfc) assessment.getData();
264: } catch (AssessmentException ex) {
265: throw new DataFacadeException(ex.getMessage());
266: }
267: return this .data.getDescription();
268: }
269:
270: /**
271: * Set description for AssessmentBaseFacade
272: * @param description
273: */
274: public void setDisplayName(String displayName) {
275: this .displayName = displayName;
276: this .data.setTitle(displayName);
277: }
278:
279: public String getDescription() throws DataFacadeException {
280: try {
281: this .data = (AssessmentBaseIfc) assessment.getData();
282: } catch (AssessmentException ex) {
283: throw new DataFacadeException(ex.getMessage());
284: }
285: return this .data.getDescription();
286: }
287:
288: /**
289: * Set description for AssessmentBaseFacade
290: * @param description
291: */
292: public void setDescription(String description) {
293: this .description = description;
294: this .data.setDescription(description);
295: }
296:
297: public Long getTypeId() throws DataFacadeException {
298: try {
299: this .data = (AssessmentBaseIfc) assessment.getData();
300: } catch (AssessmentException ex) {
301: throw new DataFacadeException(ex.getMessage());
302: }
303: return this .data.getTypeId();
304: }
305:
306: /**
307: * Set TypeId for AssessmentBaseType. This property is used to indicate an
308: * assessment type. e.g. 11 = Quiz, 12 = Homework, 13 = Mid Term.
309: * Please check out ddl/02_TypeData.sql and table "type".
310: * @param typeId
311: */
312: public void setTypeId(Long typeId) {
313: this .typeId = typeId;
314: this .data.setTypeId(typeId);
315: }
316:
317: /**
318: * Get parentId of AssessmentBaseFacade.
319: * @return
320: * @throws DataFacadeException
321: */
322: public Long getParentId() throws DataFacadeException {
323: try {
324: this .data = (AssessmentBaseIfc) assessment.getData();
325: } catch (AssessmentException ex) {
326: throw new DataFacadeException(ex.getMessage());
327: }
328: return this .data.getParentId();
329: }
330:
331: /**
332: * Set parentId for AssessmentBaseFacade.
333: * @param parentId
334: */
335: public void setParentId(Long parentId) {
336: this .parentId = parentId;
337: this .data.setParentId(parentId);
338: }
339:
340: /**
341: * Get Title for AssessmentBaseFacade
342: * @return
343: * @throws DataFacadeException
344: */
345: public String getTitle() throws DataFacadeException {
346: try {
347: this .data = (AssessmentBaseIfc) assessment.getData();
348: } catch (AssessmentException ex) {
349: throw new DataFacadeException(ex.getMessage());
350: }
351: return this .data.getTitle();
352: }
353:
354: /**
355: * Set Title for AssessmentBaseFacade
356: * @param title
357: */
358: public void setTitle(String title) {
359: this .title = title;
360: this .data.setTitle(title);
361: }
362:
363: /**
364: * Set Comments for AssessmentBaseFacade
365: * @param comments
366: */
367: public void setComments(String comments) {
368: this .comments = comments;
369: this .data.setComments(comments);
370: }
371:
372: /**
373: * Get Comments for AssessmentBaseFacade
374: * @return
375: * @throws DataFacadeException
376: */
377: public String getComments() throws DataFacadeException {
378: try {
379: this .data = (AssessmentBaseIfc) assessment.getData();
380: } catch (AssessmentException ex) {
381: throw new DataFacadeException(ex.getMessage());
382: }
383: return this .data.getComments();
384: }
385:
386: /**
387: * Set InstructorNotification for AssessmentBaseFacade
388: * @param instructorNotification
389: */
390: public void setInstructorNotification(Integer instructorNotification) {
391: this .instructorNotification = instructorNotification;
392: this .data.setInstructorNotification(instructorNotification);
393: }
394:
395: /**
396: * Get InstructorNotification for AssessmentBaseFacade
397: * @return
398: * @throws DataFacadeException
399: */
400: public Integer getInstructorNotification()
401: throws DataFacadeException {
402: try {
403: this .data = (AssessmentBaseIfc) assessment.getData();
404: } catch (AssessmentException ex) {
405: throw new DataFacadeException(ex.getMessage());
406: }
407: return this .data.getInstructorNotification();
408: }
409:
410: /**
411: * Set TesteeNotification for AssessmentBaseFacade
412: * @param testeeNotification
413: */
414: public void setTesteeNotification(Integer testeeNotification) {
415: this .testeeNotification = testeeNotification;
416: this .data.setTesteeNotification(testeeNotification);
417: }
418:
419: /**
420: * Get TesteeNotification for AssessmentBaseFacade
421: * @return
422: * @throws DataFacadeException
423: */
424: public Integer getTesteeNotification() throws DataFacadeException {
425: try {
426: this .data = (AssessmentBaseIfc) assessment.getData();
427: } catch (AssessmentException ex) {
428: throw new DataFacadeException(ex.getMessage());
429: }
430: return this .data.getTesteeNotification();
431: }
432:
433: /**
434: * Set MultipartAllowed for AssessmentBaseFacade
435: * @param multipartAllowed
436: */
437: public void setMultipartAllowed(Integer multipartAllowed) {
438: this .multipartAllowed = multipartAllowed;
439: this .data.setMultipartAllowed(multipartAllowed);
440: }
441:
442: /**
443: * Get MultipartAllowed for AssessmentBaseFacade
444: * @return
445: * @throws DataFacadeException
446: */
447: public Integer getMultipartAllowed() throws DataFacadeException {
448: try {
449: this .data = (AssessmentBaseIfc) assessment.getData();
450: } catch (AssessmentException ex) {
451: throw new DataFacadeException(ex.getMessage());
452: }
453: return this .data.getMultipartAllowed();
454: }
455:
456: /**
457: * Get status of AssessmentBaseFacade. 1 = active, 0 = inactive
458: * @return
459: * @throws DataFacadeException
460: */
461: public Integer getStatus() throws DataFacadeException {
462: try {
463: this .data = (AssessmentBaseIfc) assessment.getData();
464: } catch (AssessmentException ex) {
465: throw new DataFacadeException(ex.getMessage());
466: }
467: return this .data.getStatus();
468: }
469:
470: /**
471: * Set status for AssessmentBaseFacade. 1 = active, 0 = inactive
472: * @param status
473: */
474: public void setStatus(Integer status) {
475: this .status = status;
476: this .data.setStatus(status);
477: }
478:
479: /**
480: * Get createdBy for AssessmentBaseFacade. This represents the agentId of the person
481: * who created the record
482: * @return
483: * @throws DataFacadeException
484: */
485: public String getCreatedBy() throws DataFacadeException {
486: try {
487: this .data = (AssessmentBaseIfc) assessment.getData();
488: } catch (AssessmentException ex) {
489: throw new DataFacadeException(ex.getMessage());
490: }
491: return this .data.getCreatedBy();
492: }
493:
494: /**
495: * Set createdBy for AssessmentBaseFacade. This represents the agentId of the person
496: * who created the record
497: * @param createdBy
498: */
499: public void setCreatedBy(String createdBy) {
500: this .createdBy = createdBy;
501: this .data.setCreatedBy(createdBy);
502: }
503:
504: /**
505: * Get the creation date of AssessmentBaseFacade.
506: * @return
507: * @throws DataFacadeException
508: */
509: public Date getCreatedDate() throws DataFacadeException {
510: try {
511: this .data = (AssessmentBaseIfc) assessment.getData();
512: } catch (AssessmentException ex) {
513: throw new DataFacadeException(ex.getMessage());
514: }
515: return this .data.getCreatedDate();
516: }
517:
518: /**
519: * Set the creation date of AssessmentBaseFacade
520: * @param createdDate
521: */
522: public void setCreatedDate(Date createdDate) {
523: this .createdDate = createdDate;
524: this .data.setCreatedDate(createdDate);
525: }
526:
527: /**
528: * Get the agentId of the person who last modified AssessmentBaseFacade
529: * @return
530: * @throws DataFacadeException
531: */
532: public String getLastModifiedBy() throws DataFacadeException {
533: try {
534: this .data = (AssessmentBaseIfc) assessment.getData();
535: } catch (AssessmentException ex) {
536: throw new DataFacadeException(ex.getMessage());
537: }
538: return this .data.getLastModifiedBy();
539: }
540:
541: /**
542: * set the agentId of the person who last modified AssessmentBaseFacade
543: * @param lastModifiedBy
544: */
545: public void setLastModifiedBy(String lastModifiedBy) {
546: this .lastModifiedBy = lastModifiedBy;
547: this .data.setLastModifiedBy(lastModifiedBy);
548: }
549:
550: /**
551: * Get the date when AssessmentBaseFacade where last modified By
552: * @return
553: * @throws DataFacadeException
554: */
555: public Date getLastModifiedDate() throws DataFacadeException {
556: try {
557: this .data = (AssessmentBaseIfc) assessment.getData();
558: } catch (AssessmentException ex) {
559: throw new DataFacadeException(ex.getMessage());
560: }
561: return this .data.getLastModifiedDate();
562: }
563:
564: /**
565: * Set the last modified date
566: * @param lastModifiedBy
567: */
568: public void setLastModifiedDate(Date lastModifiedDate) {
569: this .lastModifiedDate = lastModifiedDate;
570: this .data.setLastModifiedDate(lastModifiedDate);
571: }
572:
573: /**
574: * Get the AccessControl of the person who last modified AssessmentBaseFacade
575: * @return
576: * @throws DataFacadeException
577: */
578: public AssessmentAccessControlIfc getAssessmentAccessControl()
579: throws DataFacadeException {
580: try {
581: this .data = (AssessmentBaseIfc) assessment.getData();
582: } catch (AssessmentException ex) {
583: throw new DataFacadeException(ex.getMessage());
584: }
585: return this .data.getAssessmentAccessControl();
586: }
587:
588: /**
589: * set the AccessControl of the person who last modified AssessmentBaseFacade
590: * @param assessmentAccessControl
591: */
592: public void setAssessmentAccessControl(
593: AssessmentAccessControlIfc assessmentAccessControl) {
594: this .assessmentAccessControl = assessmentAccessControl;
595: this .data.setAssessmentAccessControl(assessmentAccessControl);
596: }
597:
598: /**
599: * Get the EvaluationModel of the person who last modified AssessmentBaseFacade
600: * @return
601: * @throws DataFacadeException
602: */
603: public EvaluationModelIfc getEvaluationModel()
604: throws DataFacadeException {
605: try {
606: this .data = (AssessmentBaseIfc) assessment.getData();
607: } catch (AssessmentException ex) {
608: throw new DataFacadeException(ex.getMessage());
609: }
610: return this .data.getEvaluationModel();
611: }
612:
613: /**
614: * set the EvaluationModel of the person who last modified AssessmentBaseFacade
615: * @param evaluationModel
616: */
617: public void setEvaluationModel(EvaluationModelIfc evaluationModel) {
618: this .evaluationModel = evaluationModel;
619: this .data.setEvaluationModel(evaluationModel);
620: }
621:
622: public AssessmentFeedbackIfc getAssessmentFeedback() {
623: try {
624: this .data = (AssessmentBaseIfc) assessment.getData();
625: } catch (AssessmentException ex) {
626: throw new DataFacadeException(ex.getMessage());
627: }
628: return this .data.getAssessmentFeedback();
629: }
630:
631: public void setAssessmentFeedback(
632: AssessmentFeedbackIfc assessmentFeedback) {
633: this .assessmentFeedback = assessmentFeedback;
634: this .data.setAssessmentFeedback(assessmentFeedback);
635: }
636:
637: public Set getSecuredIPAddressSet() {
638: try {
639: this .data = (AssessmentBaseIfc) assessment.getData();
640: } catch (AssessmentException ex) {
641: throw new DataFacadeException(ex.getMessage());
642: }
643: return this .data.getSecuredIPAddressSet();
644: }
645:
646: public void setSecuredIPAddressSet(Set securedIPAddressSet) {
647: this .securedIPAddressSet = securedIPAddressSet;
648: this .data.setSecuredIPAddressSet(securedIPAddressSet);
649: }
650:
651: public Set getAssessmentMetaDataSet() throws DataFacadeException {
652: try {
653: this .data = (AssessmentBaseIfc) assessment.getData();
654: } catch (AssessmentException ex) {
655: throw new DataFacadeException(ex.getMessage());
656: }
657: return this .data.getAssessmentMetaDataSet();
658: }
659:
660: /**
661: * Set assessment metadata set in AssessmentBaseFacade and
662: * AssessmentBaseFacade.data
663: * @param assessmentMetaDataSet
664: */
665: public void setAssessmentMetaDataSet(Set assessmentMetaDataSet) {
666: this .assessmentMetaDataSet = assessmentMetaDataSet;
667: this .data.setAssessmentMetaDataSet(assessmentMetaDataSet);
668: this .assessmentMetaDataMap = getAssessmentMetaDataMap(assessmentMetaDataSet);
669: }
670:
671: /**
672: * Get assessment metadata in HashMap (String Label, AssessmentMetaData assessmentMetaData) of
673: * AssessmentFacade
674: * @param assessmentMetaDataSet
675: * @return
676: */
677: public HashMap getAssessmentMetaDataMap(Set assessmentMetaDataSet) {
678: HashMap assessmentMetaDataMap = new HashMap();
679: if (assessmentMetaDataSet != null) {
680: for (Iterator i = assessmentMetaDataSet.iterator(); i
681: .hasNext();) {
682: AssessmentMetaData assessmentMetaData = (AssessmentMetaData) i
683: .next();
684: assessmentMetaDataMap.put(
685: assessmentMetaData.getLabel(),
686: assessmentMetaData.getEntry());
687: }
688: }
689: return assessmentMetaDataMap;
690: }
691:
692: public HashMap getAssessmentMetaDataMap() {
693: HashMap assessmentMetaDataMap = new HashMap();
694: if (this .assessmentMetaDataSet != null) {
695: for (Iterator i = assessmentMetaDataSet.iterator(); i
696: .hasNext();) {
697: AssessmentMetaData assessmentMetaData = (AssessmentMetaData) i
698: .next();
699: assessmentMetaDataMap.put(
700: assessmentMetaData.getLabel(),
701: assessmentMetaData.getEntry());
702: }
703: }
704: return assessmentMetaDataMap;
705: }
706:
707: /**
708: * Get meta data by label
709: * @param label
710: * @return
711: */
712: public String getAssessmentMetaDataByLabel(String label) {
713: return (String) this .assessmentMetaDataMap.get(label);
714: }
715:
716: /**
717: * Convenient method to check if question metadata is editable
718: * @param label
719: * @param entry
720: */
721: public String getMetaDataQuestions_isInstructorEditable() {
722: return (String) this .assessmentMetaDataMap
723: .get(METADATAQUESTIONS_ISINSTRUCTOREDITABLE);
724: }
725:
726: /**
727: * Convenient method to check if this is question metadata
728: * @param label
729: * @param entry
730: */
731: public String getHasMetaDataForQuestions() {
732: return (String) this .assessmentMetaDataMap
733: .get(HASMETADATAFORQUESTIONS);
734: }
735:
736: public String getShowFeedbackAuthoring() {
737: return (String) this .assessmentMetaDataMap
738: .get(SHOWFEEDBACKAUTHORING);
739: }
740:
741: /**
742: * Add a Meta Data to AssessmentFacade
743: * @param label
744: * @param entry
745: */
746: public void addAssessmentMetaData(String label, String entry) {
747: this .assessmentMetaDataMap = getAssessmentMetaDataMap();
748: if (this .assessmentMetaDataMap.get(label) != null) {
749: // just update
750: Iterator iter = this .assessmentMetaDataSet.iterator();
751: while (iter.hasNext()) {
752: AssessmentMetaData metadata = (AssessmentMetaData) iter
753: .next();
754: if (metadata.getLabel().equals(label))
755: metadata.setEntry(entry);
756: }
757: } else { // add
758: AssessmentMetaData metadata = null;
759: if (entry != null && !("").equals(entry)) {
760: metadata = new AssessmentMetaData(this .data, label,
761: entry);
762: this .assessmentMetaDataSet.add(metadata);
763: }
764: setAssessmentMetaDataSet(this .assessmentMetaDataSet);
765: }
766: }
767:
768: public void updateAssessmentMetaData(String label, String entry) {
769: addAssessmentMetaData(label, entry);
770: }
771:
772: public void addAssessmentAttachmentMetaData(String entry) {
773: assessmentAttachmentMetaData = entry;
774: }
775:
776: public String getAssessmentAttachmentMetaData() {
777: return assessmentAttachmentMetaData;
778: }
779:
780: private void writeObject(java.io.ObjectOutputStream out)
781: throws IOException {
782: out.defaultWriteObject();
783: }
784:
785: private void readObject(java.io.ObjectInputStream in)
786: throws IOException, ClassNotFoundException {
787: in.defaultReadObject();
788: }
789: }
|