001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/evaluation/AgentResults.java $
003: * $Id: AgentResults.java 29887 2007-05-02 21:44:12Z ajpoland@iupui.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.evaluation;
021:
022: import java.io.Serializable;
023: import java.util.ArrayList;
024: import java.util.Date;
025: import java.util.Set;
026:
027: import org.sakaiproject.tool.assessment.data.ifc.assessment.PublishedAssessmentIfc;
028: import org.sakaiproject.tool.assessment.ui.bean.util.Validator;
029: import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil;
030:
031: /**
032: * A set of information for an agent. This contains both totalScores
033: * and questionScores information.
034: */
035:
036: public class AgentResults implements Serializable {
037: /**
038: *
039: */
040: private static final long serialVersionUID = 2820488402465439395L;
041: private Long assessmentGradingId;
042: private Long itemGradingId;
043: private String agentId;
044: private String agentEid;
045: private String firstName;
046: private String lastName;
047: private String lastInitial;
048: private String email;
049: private String idString;
050: private String role;
051: private PublishedAssessmentIfc publishedAssessment;
052: private Date submittedDate;
053: private Date attemptDate;
054: private Boolean isLate;
055: private Boolean forGrade;
056: private String totalAutoScore;
057: private String totalOverrideScore;
058: private String finalScore; // final total score
059: private String answer; // The abbreviated text or link of the answer
060: private String fullAnswer = ""; // The full text or link of the answer
061: private String comments;
062: private Integer status;
063: private String gradedBy;
064: private Date gradedDate;
065: private Set itemGradingSet;
066: private ArrayList itemGradingArrayList;
067: private String rationale = "";
068: private boolean retakeAllowed;
069:
070: public AgentResults() {
071: }
072:
073: public Long getAssessmentGradingId() {
074: return assessmentGradingId;
075: }
076:
077: public void setAssessmentGradingId(Long assessmentGradingId) {
078: this .assessmentGradingId = assessmentGradingId;
079: }
080:
081: public Long getItemGradingId() {
082: return itemGradingId;
083: }
084:
085: public void setItemGradingId(Long itemGradingId) {
086: this .itemGradingId = itemGradingId;
087: }
088:
089: public PublishedAssessmentIfc getPublishedAssessment() {
090: return publishedAssessment;
091: }
092:
093: public void setPublishedAssessment(
094: PublishedAssessmentIfc publishedAssessment) {
095: this .publishedAssessment = publishedAssessment;
096: }
097:
098: public String getAgentId() {
099: return Validator.check(agentId, "N/A");
100: }
101:
102: public void setAgentId(String agentId) {
103: this .agentId = agentId;
104: }
105:
106: public String getAgentEid() {
107: return Validator.check(agentEid, "N/A");
108: }
109:
110: public void setAgentEid(String agentEid) {
111: this .agentEid = agentEid;
112: }
113:
114: public String getFirstName() {
115: return Validator.check(firstName, "");
116: }
117:
118: public void setFirstName(String name) {
119: firstName = name;
120: }
121:
122: public String getLastName() {
123: return Validator.check(lastName, "");
124: }
125:
126: public void setLastName(String name) {
127: lastName = name;
128: }
129:
130: public String getLastInitial() {
131: return Validator.check(lastInitial, "A");
132: }
133:
134: public void setLastInitial(String init) {
135: lastInitial = init;
136: }
137:
138: public String getEmail() {
139: return Validator.check(email, "");
140: }
141:
142: public void setEmail(String email) {
143: this .email = email;
144: }
145:
146: public String getIdString() {
147: String escapedIdString = ContextUtil.escapeApostrophe(idString);
148: return Validator.check(escapedIdString, "N/A");
149: }
150:
151: public void setIdString(String id) {
152: idString = id;
153: }
154:
155: public String getRole() {
156: return Validator.check(role, "N/A");
157: }
158:
159: public void setRole(String newrole) {
160: role = newrole;
161: }
162:
163: public Date getSubmittedDate() {
164: return submittedDate;
165: }
166:
167: public void setSubmittedDate(Date submittedDate) {
168: this .submittedDate = submittedDate;
169: }
170:
171: public Date getAttemptDate() {
172: return attemptDate;
173: }
174:
175: public void setAttemptDate(Date attemptDate) {
176: this .attemptDate = attemptDate;
177: }
178:
179: public Boolean getIsLate() {
180: return Validator.bcheck(isLate, false);
181: }
182:
183: public void setIsLate(Boolean isLate) {
184: this .isLate = isLate;
185: }
186:
187: public Boolean getForGrade() {
188: return Validator.bcheck(forGrade, true);
189: }
190:
191: public void setForGrade(Boolean forGrade) {
192: this .forGrade = forGrade;
193: }
194:
195: public String getTotalAutoScore() {
196: return getRoundedTotalAutoScore();
197: }
198:
199: public String getExactTotalAutoScore() {
200: return Validator.check(totalAutoScore, "0").replace(',', '.');
201: }
202:
203: public String getRoundedTotalAutoScore() {
204: if (totalAutoScore != null) {
205: try {
206: String newscore = ContextUtil.getRoundedValue(
207: totalAutoScore.replace(',', '.'), 2);
208: return Validator.check(newscore, "N/A").replace(',',
209: '.');
210: } catch (Exception e) {
211: // encountered some weird number format/locale
212: return Validator.check(totalAutoScore, "0").replace(
213: ',', '.');
214: }
215: } else {
216: return Validator.check(totalAutoScore, "0").replace(',',
217: '.');
218: }
219: }
220:
221: public void setTotalAutoScore(String totalAutoScore) {
222: if (totalAutoScore != null) {
223: this .totalAutoScore = totalAutoScore.replace(',', '.');
224: } else {
225: this .totalAutoScore = null;
226: }
227: }
228:
229: public String getTotalOverrideScore() {
230: return Validator.check(totalOverrideScore, "0").replace(',',
231: '.');
232: }
233:
234: public String getRoundedTotalOverrideScore() {
235: if (totalOverrideScore != null) {
236: try {
237: String newscore = ContextUtil.getRoundedValue(
238: totalOverrideScore.replace(',', '.'), 2);
239: return Validator.check(newscore, "N/A").replace(',',
240: '.');
241: } catch (Exception e) {
242: // encountered some weird number format/locale
243: return Validator.check(totalOverrideScore, "0")
244: .replace(',', '.');
245: }
246: } else {
247: return Validator.check(totalOverrideScore, "0").replace(
248: ',', '.');
249: }
250: }
251:
252: public void setTotalOverrideScore(String totalOverrideScore) {
253: if (totalOverrideScore != null) {
254: this .totalOverrideScore = totalOverrideScore.replace(',',
255: '.');
256: } else {
257: this .totalOverrideScore = null;
258: }
259: }
260:
261: public String getFinalScore() {
262: return Validator.check(finalScore, "0").replace(',', '.');
263: }
264:
265: public String getRoundedFinalScore() {
266: if (finalScore != null) {
267: try {
268: String newscore = ContextUtil.getRoundedValue(
269: finalScore.replace(',', '.'), 2);
270: return Validator.check(newscore, "N/A").replace(',',
271: '.');
272: } catch (Exception e) {
273: // encountered some weird number format/locale
274: return Validator.check(finalScore, "0").replace(',',
275: '.');
276: }
277: } else {
278: return Validator.check(finalScore, "0").replace(',', '.');
279: }
280: }
281:
282: public void setFinalScore(String finalScore) {
283: if (finalScore != null) {
284: this .finalScore = finalScore.replace(',', '.');
285: } else {
286: this .finalScore = null;
287: }
288: }
289:
290: public String getAnswer() {
291: return Validator.check(answer, "N/A");
292: }
293:
294: public void setAnswer(String answer) {
295: this .answer = answer;
296: }
297:
298: public String getComments() {
299: return Validator.check(comments, "");
300: }
301:
302: public void setComments(String comments) {
303: this .comments = comments;
304: }
305:
306: public String getGradedBy() {
307: return Validator.check(gradedBy, "");
308: }
309:
310: public void setGradedBy(String gradedBy) {
311: this .gradedBy = gradedBy;
312: }
313:
314: public Date getGradedDate() {
315: return gradedDate;
316: }
317:
318: public void setGradedDate(Date gradedDate) {
319: this .gradedDate = gradedDate;
320: }
321:
322: /**
323: * In some cases, students are allowed to submit multiple assessment
324: * for grading. However, the grader has the choice to select one to
325: * represent how well the student does overall. status = 1 means
326: * this submitted assessment is selected.
327: */
328: public Integer getStatus() {
329: return status;
330: }
331:
332: public void setStatus(Integer status) {
333: this .status = status;
334: }
335:
336: public Set getItemGradingSet() {
337: return itemGradingSet;
338: }
339:
340: public void setItemGradingSet(Set itemGradingSet) {
341: this .itemGradingSet = itemGradingSet;
342: }
343:
344: // added by daisy to support to display answers to file upload question
345: public ArrayList getItemGradingArrayList() {
346: return itemGradingArrayList;
347: }
348:
349: public void setItemGradingArrayList(ArrayList itemGradingArrayList) {
350: this .itemGradingArrayList = itemGradingArrayList;
351: }
352:
353: public String getFullAnswer() {
354: //String unicodeFullAnswer = ContextUtil.getStringInUnicode(fullAnswer);
355: //System.out.println("UNICODEFULLANSWER "+unicodeFullAnswer);
356: // System.out.println("FULL ANSWER: "+fullAnswer);
357: return Validator.check(fullAnswer, "");
358: //return Validator.check(escFullAnswer, "");
359: }
360:
361: public void setFullAnswer(String answer) {
362: this .fullAnswer = answer;
363: }
364:
365: public String getRationale() {
366: // String unicodeRationale= ContextUtil.getStringInUnicode(rationale);
367: return Validator.check(rationale, "");
368: // return Validator.check(unicodeRationale, "");
369: }
370:
371: public void setRationale(String param) {
372: this .rationale = param;
373: }
374:
375: public boolean getRetakeAllowed() {
376: return this .retakeAllowed;
377: }
378:
379: public void setRetakeAllowed(boolean retakeAllowed) {
380: this.retakeAllowed = retakeAllowed;
381: }
382: }
|