001: package org.contineo.core.document;
002:
003: import java.util.Date;
004:
005: /**
006: *
007: * @author Michael Scholz
008: * @author Marco Meschieri
009: */
010: public class Article {
011: private static final long serialVersionUID = 1L;
012:
013: private int articleId = 0;
014:
015: private int docId = 0;
016:
017: private String subject = "";
018:
019: private String message = "";
020:
021: private String articleDate = "";
022:
023: private Date date = new Date();
024:
025: private String username = "";
026:
027: public Article() {
028: }
029:
030: public String getArticleDate() {
031: return articleDate;
032: }
033:
034: public void setArticleDate(String articleDate) {
035: this .articleDate = articleDate;
036: }
037:
038: public int getArticleId() {
039: return articleId;
040: }
041:
042: public void setArticleId(int articleId) {
043: this .articleId = articleId;
044: }
045:
046: public int getDocId() {
047: return docId;
048: }
049:
050: public void setDocId(int docId) {
051: this .docId = docId;
052: }
053:
054: public String getMessage() {
055: return message;
056: }
057:
058: public void setMessage(String message) {
059: this .message = message;
060: }
061:
062: public String getSubject() {
063: return subject;
064: }
065:
066: public void setSubject(String subject) {
067: this .subject = subject;
068: }
069:
070: public String getUsername() {
071: return username;
072: }
073:
074: public void setUsername(String username) {
075: this .username = username;
076: }
077:
078: public void reset() {
079: articleId = 0;
080: docId = 0;
081: subject = "";
082: message = "";
083: articleDate = "";
084: username = "";
085: date = new Date();
086: }
087:
088: public Date getDate() {
089: if (articleDate != "") {
090: try {
091: date.setTime(Long.parseLong(articleDate));
092: } catch (Exception e) {
093: date = new Date();
094: }
095: }
096:
097: return date;
098: }
099:
100: public void setDate(Date date) {
101: this .date = date;
102: }
103:
104: @Override
105: public boolean equals(Object obj) {
106: if (!(obj instanceof Article))
107: return false;
108:
109: Article other = (Article) obj;
110:
111: return other.getArticleId() == this .getArticleId();
112: }
113:
114: @Override
115: public int hashCode() {
116: return new Integer(articleId).hashCode();
117: }
118: }
|