001: package org.contineo.core.communication;
002:
003: import java.util.Date;
004:
005: /**
006: * This is the parent class for email and systemmessage.
007: *
008: * @author Michael Scholz
009: * @author Marco Meschieri
010: * @version 1.0
011: */
012: public abstract class Message {
013:
014: private int messageId = 0;
015:
016: private String messageText = "";
017:
018: private String author = "";
019:
020: private String subject = "";
021:
022: private String sentDate = "";
023:
024: private int read = 0; // 0 - false; 1 - true
025:
026: public int getMessageId() {
027: return messageId;
028: }
029:
030: public String getMessageText() {
031: return messageText;
032: }
033:
034: public String getAuthor() {
035: return author;
036: }
037:
038: public String getSubject() {
039: return subject;
040: }
041:
042: public String getSentDate() {
043: return sentDate;
044: }
045:
046: public int getRead() {
047: return read;
048: }
049:
050: public void setMessageId(int id) {
051: messageId = id;
052: }
053:
054: public void setMessageText(String mess) {
055: messageText = mess;
056: }
057:
058: public void setAuthor(String auth) {
059: author = auth;
060: }
061:
062: public void setSubject(String subj) {
063: subject = subj;
064: }
065:
066: public void setSentDate(String dat) {
067: sentDate = dat;
068: }
069:
070: public void setRead(int rd) {
071: read = rd;
072: }
073:
074: public Date getSentDateAsDate() {
075: Date date = new Date();
076: try {
077: date.setTime(Long.parseLong(getSentDate()));
078: } catch (Exception e) {
079: }
080: return date;
081:
082: }
083:
084: @Override
085: public boolean equals(Object obj) {
086: if (!(obj instanceof Message))
087: return false;
088:
089: Message other = (Message) obj;
090: return other.getMessageId() == this .getMessageId();
091: }
092:
093: @Override
094: public int hashCode() {
095: return new Integer(messageId).hashCode();
096: }
097:
098: @Override
099: public String toString() {
100: return messageText;
101: }
102: }
|