Created
March 2, 2011 15:14
-
-
Save anonymous/851075 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package entity; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.Id; | |
| import org.apache.commons.lang.ObjectUtils; | |
| import org.apache.openjpa.persistence.jdbc.Index; | |
| @Entity(name = "Questionnaires") | |
| public class Questionnaire { | |
| @Id | |
| private String id; | |
| @Column @Index | |
| private String eventId; | |
| @Column(length = 2048) | |
| private String question; | |
| @Column | |
| private int questionNo; | |
| @Column(length = 4096) | |
| private String answerTexts; | |
| public Questionnaire() { | |
| } | |
| public Questionnaire(String id, String eventId, String question, int questionNo, String answerTexts) { | |
| this.id = id; | |
| this.eventId = eventId; | |
| this.question = question; | |
| this.questionNo = questionNo; | |
| this.answerTexts = answerTexts; | |
| } | |
| public Questionnaire(Questionnaire q) { | |
| this(q.id, q.eventId, q.question, q.questionNo, q.answerTexts); | |
| } | |
| // ---------------------------------------------------------------------- | |
| @Override | |
| public int hashCode() { | |
| int code = 0; | |
| code = code * 37 + ObjectUtils.hashCode(id); | |
| code = code * 37 + ObjectUtils.hashCode(eventId); | |
| code = code * 37 + ObjectUtils.hashCode(question); | |
| code = code * 37 + ObjectUtils.hashCode(questionNo); | |
| code = code * 37 + ObjectUtils.hashCode(answerTexts); | |
| return code; | |
| } | |
| @Override | |
| public boolean equals(Object obj) { | |
| if (!(obj instanceof Questionnaire)) { return false; } | |
| Questionnaire lhs = this; | |
| Questionnaire rhs = (Questionnaire) obj; | |
| if (!ObjectUtils.equals(lhs.id, rhs.id)) { return false; } | |
| if (!ObjectUtils.equals(lhs.eventId, rhs.eventId)) { return false; } | |
| if (!ObjectUtils.equals(lhs.question, rhs.question)) { return false; } | |
| if (!ObjectUtils.equals(lhs.questionNo, rhs.questionNo)) { return false; } | |
| if (!ObjectUtils.equals(lhs.answerTexts, rhs.answerTexts)) { return false; } | |
| return true; | |
| } | |
| // ---------------------------------------------------------------------- | |
| public String getId() { | |
| return id; | |
| } | |
| public String getEventId() { | |
| return eventId; | |
| } | |
| public String getQuestion() { | |
| return question; | |
| } | |
| public int getQuestionNo() { | |
| return questionNo; | |
| } | |
| public String getAnswerTexts() { | |
| return answerTexts; | |
| } | |
| public void setId(String id) { | |
| this.id = id; | |
| } | |
| public void setEventId(String eventId) { | |
| this.eventId = eventId; | |
| } | |
| public void setQuestion(String question) { | |
| this.question = question; | |
| } | |
| public void setQuestionNo(int questionNo) { | |
| this.questionNo = questionNo; | |
| } | |
| public void setAnswerTexts(String answerTexts) { | |
| this.answerTexts = answerTexts; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment