001: /*******************************************************************************
002: * Copyright (c) 2006 The Regents of the University of California, The MIT Corporation
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: ******************************************************************************/package org.sakaiproject.tool.gradebook;
016:
017: import org.apache.commons.lang.builder.ToStringBuilder;
018: import org.apache.commons.lang.builder.EqualsBuilder;
019: import org.apache.commons.lang.builder.HashCodeBuilder;
020:
021: import java.util.Date;
022: import java.io.Serializable;
023:
024: /**
025: * Comment Object
026: *
027: *
028: * Author:Louis Majanja <louis@media.berkeley.edu>
029: * Date: Oct 20, 2006
030: * Time: 10:56:34 AM
031: */
032: public class Comment implements Serializable {
033:
034: private Long id;
035: private String studentId;
036: private String graderId;
037: private int version;
038: private Date dateRecorded;
039: private String commentText;
040: private GradableObject gradableObject;
041:
042: public Comment(String studentId, String comment,
043: GradableObject gradableObject) {
044: this .gradableObject = gradableObject;
045: this .studentId = studentId;
046: this .commentText = comment;
047: }
048:
049: public Comment() {
050: }
051:
052: public Long getId() {
053: return id;
054: }
055:
056: public void setId(Long id) {
057: this .id = id;
058: }
059:
060: public String getStudentId() {
061: return studentId;
062: }
063:
064: public void setStudentId(String studentId) {
065: this .studentId = studentId;
066: }
067:
068: public String getGraderId() {
069: return graderId;
070: }
071:
072: public void setGraderId(String graderId) {
073: this .graderId = graderId;
074: }
075:
076: public int getVersion() {
077: return version;
078: }
079:
080: public void setVersion(int version) {
081: this .version = version;
082: }
083:
084: public Date getDateRecorded() {
085: return dateRecorded;
086: }
087:
088: public void setDateRecorded(Date dateRecorded) {
089: this .dateRecorded = dateRecorded;
090: }
091:
092: public String getCommentText() {
093: return commentText;
094: }
095:
096: public void setCommentText(String commentText) {
097: this .commentText = commentText;
098: }
099:
100: public GradableObject getGradableObject() {
101: return gradableObject;
102: }
103:
104: public void setGradableObject(GradableObject gradableObject) {
105: this .gradableObject = gradableObject;
106: }
107:
108: public String toString() {
109: return new ToStringBuilder(this ).append("id", id).append(
110: "grader", graderId).append("comment", commentText)
111: .append("studentid", studentId).toString();
112:
113: }
114:
115: public boolean equals(Object other) {
116: if (!(other instanceof Comment)) {
117: return false;
118: }
119: Comment comment = (Comment) other;
120: return new EqualsBuilder().append(gradableObject,
121: comment.getGradableObject())
122: .append(id, comment.getId()).append(commentText,
123: comment.getCommentText()).isEquals();
124: }
125:
126: public int hashCode() {
127: return new HashCodeBuilder().append(gradableObject).append(id)
128: .append(commentText).toHashCode();
129: }
130:
131: }
|