001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/tool/src/java/org/sakaiproject/tool/assessment/ui/bean/delivery/DeliveryBean.java $
003: * $Id: DeliveryBean.java 9268 2006-05-10 21:27:24Z 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.ui.bean.delivery;
021:
022: import java.io.Serializable;
023:
024: import org.apache.commons.logging.Log;
025: import org.apache.commons.logging.LogFactory;
026:
027: import org.sakaiproject.tool.assessment.ui.bean.util.Validator;
028: import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil;
029:
030: import java.text.SimpleDateFormat;
031: import org.sakaiproject.tool.assessment.ui.listener.util.TimeUtil;
032:
033: /**
034: *
035: * @author casong
036: * @author esmiley@stanford.edu added agentState
037: * $Id: DeliveryBean.java 9268 2006-05-10 21:27:24Z daisyf@stanford.edu $
038: *
039: * Used to be org.navigoproject.ui.web.asi.delivery.XmlDeliveryForm.java
040: */
041: public class DeliveryBeanie implements Serializable {
042: /**
043: *
044: */
045: private static final long serialVersionUID = 3740101653033385370L;
046:
047: private static Log log = LogFactory.getLog(DeliveryBeanie.class);
048:
049: private String assessmentId;
050: private String assessmentTitle;
051: private String timeElapse;
052: private String feedback;
053: private String statistics;
054: private boolean submitted;
055: private String grade;
056: private java.util.Date submissionDate;
057: private long subTime;
058: private long raw;
059: private String rawScore;
060: private java.util.Date feedbackDate;
061: private String feedbackDelivery;
062: private String showScore;
063: private String submissionHours;
064: private String submissionMinutes;
065: private java.util.Date dueDate;
066: private boolean pastDue;
067: private boolean timeRunning;
068:
069: // display * and notes for multiple submissions
070: private boolean multipleSubmissions;
071: private String scoringOption;
072:
073: // lydial added for timezone conversion
074: //private String display_dateFormat= ContextUtil.getLocalizedString("org.sakaiproject.tool.assessment.bundle.GeneralMessages","output_date_no_sec");
075: private String display_dateFormat = "yyyy-MMM-dd hh:mm aaa";
076: private SimpleDateFormat displayFormat = new SimpleDateFormat(
077: display_dateFormat);
078:
079: /**
080: * Creates a new DeliveryBean object.
081: */
082: public DeliveryBeanie() {
083: }
084:
085: public String getAssessmentId() {
086: return assessmentId;
087: }
088:
089: public void setAssessmentId(String assessmentId) {
090: this .assessmentId = assessmentId;
091: }
092:
093: public String getAssessmentTitle() {
094: return assessmentTitle;
095: }
096:
097: public void setAssessmentTitle(String assessmentTitle) {
098: this .assessmentTitle = assessmentTitle;
099: }
100:
101: public String getTimeElapse() {
102: return timeElapse;
103: }
104:
105: public void setTimeElapse(String timeElapse) {
106: this .timeElapse = timeElapse;
107: }
108:
109: public String getFeedback() {
110: return feedback;
111: }
112:
113: public void setFeedback(String feedback) {
114: this .feedback = feedback;
115: }
116:
117: public String getStatistics() {
118: return statistics;
119: }
120:
121: public void setStatistics(String statistics) {
122: this .statistics = statistics;
123: }
124:
125: public long getRaw() {
126: return raw;
127: }
128:
129: public void setRaw(long raw) {
130: this .raw = raw;
131: }
132:
133: public String getRawScore() {
134: return rawScore;
135: }
136:
137: public void setRawScore(String rawScore) {
138: this .rawScore = rawScore;
139: }
140:
141: public String getGrade() {
142: return grade;
143: }
144:
145: public void setGrade(String grade) {
146: this .grade = grade;
147: }
148:
149: public java.util.Date getSubmissionDate() {
150: return submissionDate;
151: }
152:
153: public void setSubmissionDate(java.util.Date submissionDate) {
154: this .submissionDate = submissionDate;
155: }
156:
157: public long getSubTime() {
158: return subTime;
159: }
160:
161: public void setSubTime(long newSubTime) {
162: subTime = newSubTime;
163: }
164:
165: public String getSubmissionHours() {
166: return submissionHours;
167: }
168:
169: public void setSubmissionHours(String newHours) {
170: submissionHours = newHours;
171: }
172:
173: public String getSubmissionMinutes() {
174: return submissionMinutes;
175: }
176:
177: public void setSubmissionMinutes(String newMinutes) {
178: submissionMinutes = newMinutes;
179: }
180:
181: public java.util.Date getFeedbackDate() {
182: return feedbackDate;
183: }
184:
185: public String getFeedbackDateString() {
186: String dateString = "";
187: if (feedbackDate == null) {
188: return dateString;
189: }
190:
191: try {
192: TimeUtil tu = new TimeUtil();
193: dateString = tu.getDisplayDateTime(displayFormat,
194: feedbackDate);
195: } catch (Exception ex) {
196: // we will leave it as an empty string
197: log.warn("Unable to format date.");
198: ex.printStackTrace();
199: }
200: return dateString;
201: }
202:
203: public void setFeedbackDate(java.util.Date feedbackDate) {
204: this .feedbackDate = feedbackDate;
205: }
206:
207: public String getFeedbackDelivery() {
208: return feedbackDelivery;
209: }
210:
211: public void setFeedbackDelivery(String feedbackDelivery) {
212: this .feedbackDelivery = feedbackDelivery;
213: }
214:
215: public String getShowScore() {
216: return showScore;
217: }
218:
219: public void setShowScore(String showScore) {
220: this .showScore = showScore;
221: }
222:
223: public boolean getSubmitted() {
224: return submitted;
225: }
226:
227: public void setSubmitted(boolean submitted) {
228: this .submitted = submitted;
229: }
230:
231: public boolean isSubmitted() {
232: return submitted;
233: }
234:
235: public java.util.Date getDueDate() {
236: return dueDate;
237: }
238:
239: public String getDueDateString() {
240: String dateString = "";
241: if (dueDate == null) {
242: return dateString;
243: }
244:
245: try {
246: TimeUtil tu = new TimeUtil();
247: dateString = tu.getDisplayDateTime(displayFormat, dueDate);
248: } catch (Exception ex) {
249: // we will leave it as an empty string
250: log.warn("Unable to format date.");
251: ex.printStackTrace();
252: }
253: return dateString;
254: }
255:
256: public void setDueDate(java.util.Date dueDate) {
257: this .dueDate = dueDate;
258: }
259:
260: public boolean getPastDue() {
261: return pastDue;
262: }
263:
264: public void setPastDue(boolean pastDue) {
265: this .pastDue = pastDue;
266: }
267:
268: public boolean isTimeRunning() {
269: return timeRunning;
270: }
271:
272: public boolean getTimeRunning() {
273: return timeRunning;
274: }
275:
276: public void setTimeRunning(boolean timeRunning) {
277: this .timeRunning = timeRunning;
278: }
279:
280: public String getRoundedRawScore() {
281: try {
282: String newscore = ContextUtil.getRoundedValue(rawScore, 2);
283: return Validator.check(newscore, "N/A");
284: } catch (Exception e) {
285: // encountered some weird number format/locale
286: return Validator.check(rawScore, "0");
287: }
288:
289: }
290:
291: public String getSubmissionDateString() {
292: String dateString = "";
293: if (submissionDate == null) {
294: return dateString;
295: }
296:
297: try {
298: TimeUtil tu = new TimeUtil();
299: dateString = tu.getDisplayDateTime(displayFormat,
300: submissionDate);
301: } catch (Exception ex) {
302: // we will leave it as an empty string
303: log.warn("Unable to format date.");
304: ex.printStackTrace();
305: }
306: return dateString;
307: }
308:
309: /**
310: * @return Returns the multipleSubmissions.
311: */
312: public boolean isMultipleSubmissions() {
313: return multipleSubmissions;
314: }
315:
316: /**
317: * @param multipleSubmissions The multipleSubmissions to set.
318: */
319: public void setMultipleSubmissions(boolean multipleSubmissions) {
320: this .multipleSubmissions = multipleSubmissions;
321: }
322:
323: /**
324: * @return Returns the scoringOption.
325: */
326: public String getScoringOption() {
327: return scoringOption;
328: }
329:
330: /**
331: * @param scoringOption The scoringOption to set.
332: */
333: public void setScoringOption(String scoringOption) {
334: this.scoringOption = scoringOption;
335: }
336:
337: }
|