001: /**********************************************************************************
002: * $URL$
003: * $Id$
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.ui.model.delivery;
021:
022: import java.util.Date;
023:
024: /**
025: * <p>Title: </p>
026: * <p>Description: </p>
027: * <p>Copyright: Copyright (c) 2004</p>
028: * <p>Company: </p>
029: * @author not attributable
030: * @version 1.0
031: */
032:
033: public class TimedAssessmentGradingModel {
034: private Long assessmentGradingId;
035: private int timeLimit; // in seconds
036: private int timeLeft; // in seconds
037: private Date beginDate;
038: private Date expirationDate;
039: private Date bufferedExpirationDate;
040: private Date localBeginDate;
041: private Date localExpirationDate;
042: private boolean submittedForGrade = false;
043: private String timerId;
044:
045: /* 30 sec, this is to allow JScript clock to catch up before server submit the
046: * assessment for grade
047: */
048: private int latencyBuffer = 30;
049:
050: /* timedAG is removed from timedAssessmentQueue immediately if the submission for
051: * grade is initiated by user OR the AutoSubmit script in the web page. If user exit
052: * application unexpectedly (e.g.closing browser), server will do the submission
053: * when time is up and also clean up the timedAG in queue. So we add a transactionBuffer
054: * here before server clean up
055: */
056: private int transactionBuffer = 30; // 30 sec
057:
058: public TimedAssessmentGradingModel() {
059: }
060:
061: public TimedAssessmentGradingModel(Long assessmentGradingId,
062: int timeLimit, int timeLeft, Date beginDate,
063: Date localBeginDate, boolean submittedForGrade,
064: String timerId) {
065: this .assessmentGradingId = assessmentGradingId;
066: this .timeLimit = timeLimit;
067: this .timeLeft = timeLeft;
068: this .beginDate = beginDate;
069: this .expirationDate = new Date(beginDate.getTime() + timeLeft
070: * 1000);
071: this .bufferedExpirationDate = new Date(beginDate.getTime()
072: + timeLeft * 1000 + latencyBuffer * 1000);
073: this .submittedForGrade = submittedForGrade;
074: this .localBeginDate = localBeginDate;
075: this .localExpirationDate = new Date(localBeginDate.getTime()
076: + timeLeft * 1000);
077: this .timerId = timerId;
078: }
079:
080: public TimedAssessmentGradingModel(Long assessmentGradingId,
081: int timeLimit, int timeLeft, int latencyBuffer,
082: int transactionBuffer, Date beginDate, Date localBeginDate,
083: boolean submittedForGrade, String timerId) {
084: this .assessmentGradingId = assessmentGradingId;
085: this .timeLimit = timeLimit;
086: this .timeLeft = timeLeft;
087: this .latencyBuffer = latencyBuffer;
088: this .transactionBuffer = transactionBuffer;
089: this .beginDate = beginDate;
090: this .expirationDate = new Date(beginDate.getTime() + timeLeft
091: * 1000);
092: this .bufferedExpirationDate = new Date(beginDate.getTime()
093: + timeLeft * 1000 + latencyBuffer * 1000);
094: this .submittedForGrade = submittedForGrade;
095: this .localBeginDate = localBeginDate;
096: this .localExpirationDate = new Date(localBeginDate.getTime()
097: + timeLeft * 1000);
098: this .timerId = timerId;
099: }
100:
101: public Long getAssessmentGradingId() {
102: return assessmentGradingId;
103: }
104:
105: public void setAssessmentGradingId(Long assessmentGradingId) {
106: this .assessmentGradingId = assessmentGradingId;
107: }
108:
109: public int getTimeLimit() {
110: return timeLimit;
111: }
112:
113: public void setTimeLimit(int timeLimit) {
114: this .timeLimit = timeLimit;
115: }
116:
117: public int getTimeLeft() {
118: return timeLeft;
119: }
120:
121: public void setTimeLeft(int timeLeft) {
122: this .timeLeft = timeLeft;
123: }
124:
125: public int getLatencyBuffer() {
126: return latencyBuffer;
127: }
128:
129: public void setLatencyBuffer(int latencyBuffer) {
130: this .latencyBuffer = latencyBuffer;
131: }
132:
133: public int getTransactionBuffer() {
134: return transactionBuffer;
135: }
136:
137: public void setTransactionBuffer(int transactionBuffer) {
138: this .transactionBuffer = transactionBuffer;
139: }
140:
141: public Date getBeginDate() {
142: return beginDate;
143: }
144:
145: public void setBeginDate(Date beginDate) {
146: this .beginDate = beginDate;
147: }
148:
149: public Date getExpirationDate() {
150: return expirationDate;
151: }
152:
153: public void setExpirationDate(Date expirationDate) {
154: this .expirationDate = expirationDate;
155: }
156:
157: public Date getBufferedExpirationDate() {
158: return bufferedExpirationDate;
159: }
160:
161: public void setBufferedExpirationDate(Date bufferedExpirationDate) {
162: this .bufferedExpirationDate = bufferedExpirationDate;
163: }
164:
165: public Date getLocalBeginDate() {
166: return localBeginDate;
167: }
168:
169: public void setLocalBeginDate(Date localBeginDate) {
170: this .localBeginDate = localBeginDate;
171: }
172:
173: public Date getLocalExpirationDate() {
174: return localExpirationDate;
175: }
176:
177: public void setLocalExpirationDate(Date localExpirationDate) {
178: this .localExpirationDate = localExpirationDate;
179: }
180:
181: public boolean getSubmittedForGrade() {
182: return submittedForGrade;
183: }
184:
185: public void setSubmittedForGrade(boolean submittedForGrade) {
186: this .submittedForGrade = submittedForGrade;
187: }
188:
189: public String getTimerId() {
190: return timerId;
191: }
192:
193: public void setTimerId(String timerId) {
194: this.timerId = timerId;
195: }
196:
197: }
|