001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-hibernate/src/java/org/sakaiproject/tool/assessment/data/dao/assessment/AssessmentAccessControl.java $
003: * $Id: AssessmentAccessControl.java 15083 2006-09-20 20:03:55Z lydial@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.data.dao.assessment;
021:
022: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentAccessControlIfc;
023: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentBaseIfc;
024: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentTemplateIfc;
025: import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
026: import java.util.Date;
027:
028: /**
029: * This keeps track of the submission scheme, and the number allowed.
030: *
031: * @author Rachel Gollub
032: */
033: public class AssessmentAccessControl implements java.io.Serializable,
034: AssessmentAccessControlIfc {
035: // keep in mind that this id can be an assesmentId or assessmentTemplateId.
036: // This depends on the AssessmentBase object (superclass of AssessmentData and
037: // AssessmentTemplateData) that is associated with it.
038:
039: /**
040: *
041: */
042: private static final long serialVersionUID = 8330416434678491916L;
043: // flag it when no editing on the property is desire
044: public static final Integer NO_EDIT = new Integer(-1);
045: // timedAssessment
046: public static final Integer TIMED_ASSESSMENT = new Integer(1);
047: public static final Integer DO_NOT_TIMED_ASSESSMENT = new Integer(0);
048: // autoSubmit
049: public static final Integer AUTO_SUBMIT = new Integer(1);
050: public static final Integer DO_NOT_AUTO_SUBMIT = new Integer(0);
051: // autoSave
052: public static final Integer SAVE_ON_CLICK = new Integer(1);
053: public static final Integer AUTO_SAVE = new Integer(2);
054: // itemNavigation
055: public static final Integer LINEAR_ACCESS = new Integer(1);
056: public static final Integer RANDOM_ACCESS = new Integer(2);
057: // assessmentFormat
058: public static final Integer BY_QUESTION = new Integer(1);
059: public static final Integer BY_PART = new Integer(2);
060: public static final Integer BY_ASSESSMENT = new Integer(3);
061: // itemNumbering
062: public static final Integer CONTINUOUS_NUMBERING = new Integer(1);
063: public static final Integer RESTART_NUMBERING_BY_PART = new Integer(
064: 2);
065: // submissionsAllowed
066: public static final Integer UNLIMITED_SUBMISSIONS_ALLOWED = new Integer(
067: 9999);
068: // lateHandling
069: public static final Integer ACCEPT_LATE_SUBMISSION = new Integer(1);
070: public static final Integer NOT_ACCEPT_LATE_SUBMISSION = new Integer(
071: 2);
072:
073: private Long id;
074:
075: private AssessmentBaseIfc assessmentBase;
076: private Integer submissionsAllowed;
077: private Boolean unlimitedSubmissions;
078: private Integer submissionsSaved;
079: private Integer assessmentFormat;
080: private Integer bookMarkingItem;
081: private Integer timeLimit;
082: private Integer timedAssessment;
083: private Integer retryAllowed;
084: private Integer lateHandling;
085: private Date startDate;
086: private Date dueDate;
087: private Date scoreDate;
088: private Date feedbackDate;
089: private Date retractDate;
090: private Integer autoSubmit; // auto submit when time expires
091: private Integer itemNavigation; // linear (1)or random (0)
092: private Integer itemNumbering; // continuous between parts(1), restart between parts(0)
093: private String submissionMessage;
094: private String finalPageUrl;
095: private String releaseTo;
096: private String username;
097: private String password;
098:
099: /**
100: * Creates a new SubmissionModel object.
101: */
102: public AssessmentAccessControl() {
103: this .submissionsAllowed = new Integer(9999); // = no limit
104: this .submissionsSaved = new Integer(1); // no. of copy
105: }
106:
107: public AssessmentAccessControl(Integer submissionsAllowed,
108: Integer submissionsSaved, Integer assessmentFormat,
109: Integer bookMarkingItem, Integer timeLimit,
110: Integer timedAssessment, Integer retryAllowed,
111: Integer lateHandling, Date startDate, Date dueDate,
112: Date scoreDate, Date feedbackDate, Date retractDate,
113: Integer autoSubmit, Integer itemNavigation,
114: Integer itemNumbering, String submissionMessage,
115: String releaseTo) {
116: this .submissionsAllowed = submissionsAllowed; // = no limit
117: this .submissionsSaved = submissionsSaved; // no. of copy
118: this .assessmentFormat = assessmentFormat;
119: this .bookMarkingItem = bookMarkingItem;
120: this .timeLimit = timeLimit;
121: this .timedAssessment = timedAssessment;
122: this .retryAllowed = retryAllowed; // cannot edit(0)
123: this .lateHandling = lateHandling; // cannot edit(0)
124: this .startDate = startDate;
125: this .dueDate = dueDate;
126: this .scoreDate = scoreDate;
127: this .feedbackDate = feedbackDate;
128: this .retractDate = retractDate;
129: this .autoSubmit = autoSubmit; // cannot edit (0) auto submit(1) when time expires (2)
130: this .itemNavigation = itemNavigation; // cannot edit (0) linear(1) or random (2)
131: this .itemNumbering = itemNumbering; // cannot edit(0) continuous between parts (1), restart between parts (2)
132: this .submissionMessage = submissionMessage;
133: this .releaseTo = releaseTo;
134: }
135:
136: public Object clone() throws CloneNotSupportedException {
137: Object cloned = new AssessmentAccessControl(this
138: .getSubmissionsAllowed(), this .getSubmissionsSaved(),
139: this .getAssessmentFormat(), this .getBookMarkingItem(),
140: this .getTimeLimit(), this .getTimedAssessment(), this
141: .getRetryAllowed(), this .getLateHandling(),
142: this .getStartDate(), this .getDueDate(), this
143: .getScoreDate(), this .getFeedbackDate(), this
144: .getRetractDate(), this .getAutoSubmit(), this
145: .getItemNavigation(), this .getItemNumbering(),
146: this .getSubmissionMessage(), this .getReleaseTo());
147: ((AssessmentAccessControl) cloned)
148: .setRetractDate(this .retractDate);
149: ((AssessmentAccessControl) cloned)
150: .setAutoSubmit(this .autoSubmit);
151: ((AssessmentAccessControl) cloned)
152: .setItemNavigation(this .itemNavigation);
153: ((AssessmentAccessControl) cloned)
154: .setItemNumbering(this .itemNumbering);
155: ((AssessmentAccessControl) cloned)
156: .setSubmissionMessage(this .submissionMessage);
157: ((AssessmentAccessControl) cloned).setUsername(this .username);
158: ((AssessmentAccessControl) cloned).setPassword(this .password);
159: ((AssessmentAccessControl) cloned)
160: .setFinalPageUrl(this .finalPageUrl);
161: ((AssessmentAccessControl) cloned)
162: .setUnlimitedSubmissions(this .unlimitedSubmissions);
163: return cloned;
164: }
165:
166: public Long getId() {
167: return id;
168: }
169:
170: public void setId(Long id) {
171: this .id = id;
172: }
173:
174: public void setAssessmentBase(AssessmentBaseIfc assessmentBase) {
175: this .assessmentBase = assessmentBase;
176: }
177:
178: public AssessmentBaseIfc getAssessmentBase() {
179: if (assessmentBase.getIsTemplate().equals(Boolean.TRUE))
180: return (AssessmentTemplateIfc) assessmentBase;
181: else
182: return (AssessmentIfc) assessmentBase;
183: }
184:
185: public Integer getSubmissionsAllowed() {
186: return submissionsAllowed;
187: }
188:
189: public void setSubmissionsAllowed(Integer psubmissionsAllowed) {
190: submissionsAllowed = psubmissionsAllowed;
191: }
192:
193: public Integer getSubmissionsSaved() {
194: return submissionsSaved;
195: }
196:
197: public void setSubmissionsSaved(Integer psubmissionsSaved) {
198: submissionsSaved = psubmissionsSaved;
199: }
200:
201: public Integer getAssessmentFormat() {
202: return assessmentFormat;
203: }
204:
205: public void setAssessmentFormat(Integer assessmentFormat) {
206: this .assessmentFormat = assessmentFormat;
207: }
208:
209: public Integer getBookMarkingItem() {
210: return bookMarkingItem;
211: }
212:
213: public void setBookMarkingItem(Integer bookMarkingItem) {
214: this .bookMarkingItem = bookMarkingItem;
215: }
216:
217: public Integer getTimeLimit() {
218: return timeLimit;
219: }
220:
221: public void setTimeLimit(Integer timeLimit) {
222: this .timeLimit = timeLimit;
223: }
224:
225: public Integer getTimedAssessment() {
226: return timedAssessment;
227: }
228:
229: public void setTimedAssessment(Integer timedAssessment) {
230: this .timedAssessment = timedAssessment;
231: }
232:
233: public void setRetryAllowed(Integer retryAllowed) {
234: this .retryAllowed = retryAllowed;
235: }
236:
237: public Integer getRetryAllowed() {
238: return retryAllowed;
239: }
240:
241: public void setLateHandling(Integer lateHandling) {
242: this .lateHandling = lateHandling;
243: }
244:
245: public Integer getLateHandling() {
246: return lateHandling;
247: }
248:
249: public Date getStartDate() {
250: return this .startDate;
251: }
252:
253: public void setStartDate(Date startDate) {
254: this .startDate = startDate;
255: }
256:
257: public Date getDueDate() {
258: return this .dueDate;
259: }
260:
261: public void setDueDate(Date dueDate) {
262: this .dueDate = dueDate;
263: }
264:
265: public Date getScoreDate() {
266: return this .scoreDate;
267: }
268:
269: public void setScoreDate(Date scoreDate) {
270: this .scoreDate = scoreDate;
271: }
272:
273: public Date getFeedbackDate() {
274: return this .feedbackDate;
275: }
276:
277: public void setFeedbackDate(Date feedbackDate) {
278: this .feedbackDate = feedbackDate;
279: }
280:
281: public Date getRetractDate() {
282: return this .retractDate;
283: }
284:
285: public void setRetractDate(Date retractDate) {
286: this .retractDate = retractDate;
287: }
288:
289: public void setAutoSubmit(Integer autoSubmit) {
290: this .autoSubmit = autoSubmit;
291: }
292:
293: public Integer getAutoSubmit() {
294: return autoSubmit;
295: }
296:
297: public void setItemNavigation(Integer itemNavigation) {
298: this .itemNavigation = itemNavigation;
299: }
300:
301: public Integer getItemNavigation() {
302: return itemNavigation;
303: }
304:
305: public void setItemNumbering(Integer itemNumbering) {
306: this .itemNumbering = itemNumbering;
307: }
308:
309: public Integer getItemNumbering() {
310: return itemNumbering;
311: }
312:
313: public void setSubmissionMessage(String submissionMessage) {
314: this .submissionMessage = submissionMessage;
315: }
316:
317: public String getSubmissionMessage() {
318: return submissionMessage;
319: }
320:
321: public void setFinalPageUrl(String finalPageUrl) {
322: this .finalPageUrl = finalPageUrl;
323: }
324:
325: public String getFinalPageUrl() {
326: return finalPageUrl;
327: }
328:
329: public String getReleaseTo() {
330: return this .releaseTo;
331: }
332:
333: public void setReleaseTo(String releaseTo) {
334: this .releaseTo = releaseTo;
335: }
336:
337: public String getUsername() {
338: return this .username;
339: }
340:
341: public void setUsername(String username) {
342: this .username = username;
343: }
344:
345: public String getPassword() {
346: return this .password;
347: }
348:
349: public void setPassword(String password) {
350: this .password = password;
351: }
352:
353: public Boolean getUnlimitedSubmissions() {
354: return this .unlimitedSubmissions;
355: }
356:
357: public void setUnlimitedSubmissions(Boolean unlimitedSubmissions) {
358: this.unlimitedSubmissions = unlimitedSubmissions;
359: }
360:
361: }
|