001: /*
002: * MessageQueueClient: The message queue client library
003: * Copyright (C) 2006 Rift IT Contracting
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
018: *
019: * TextMessageImpl.java
020: */
021:
022: // package path
023: package com.rift.coad.daemon.messageservice.message;
024:
025: // java imports
026: import java.util.Date;
027: import java.util.List;
028:
029: // coadunation imports
030: import com.rift.coad.daemon.messageservice.MessageServiceException;
031: import com.rift.coad.daemon.messageservice.TextMessage;
032:
033: /**
034: * The implementation of the text message object.
035: *
036: * @author Brett Chaldecott
037: */
038: public class TextMessageImpl extends MessageImpl implements TextMessage {
039:
040: // private member variables
041: private String txtMessage = null;
042:
043: /**
044: * Creates a new instance of TextMessageImpl
045: *
046: * @param messageId The unique identifier for this message.
047: * @param user The user of this message.
048: * @param sessionId The id of this user session.
049: * @param principals The list of principals assigned to this message.
050: * @param status The status of this message.
051: */
052: public TextMessageImpl(String messageId, String user,
053: String sessionId, List principals, int status) {
054: super (messageId, user, sessionId, principals, status);
055: }
056:
057: /**
058: * Creates a new instance of MessageImpl.
059: *
060: * @param messageId The id of the message that was created.
061: * @param create The created time stamp.
062: * @param retries The number of retries of this message.
063: * @param processedDate The last time this message was processed.
064: * @param user The name of the user.
065: * @param sessionId The id of this user session.
066: * @param principals The list of principals.
067: * @param from The from address of the message.
068: * @param messageType The type of message being used.
069: * @param status The status of this message.
070: */
071: public TextMessageImpl(String messageId, Date created, int retries,
072: Date processedDate, String user, String sessionId,
073: List principals, String from, int messageType, int status) {
074: super (messageId, created, retries, processedDate, user,
075: sessionId, principals, from, messageType, status);
076: }
077:
078: /**
079: * This clears the body of the message.
080: *
081: * @exception MessageServiceException
082: */
083: public void clearBody() throws MessageServiceException {
084: txtMessage = null;
085: }
086:
087: /**
088: * This method sets the text body of a text message.
089: *
090: * @param text The text to set as the body of this message.
091: * @exception MessageServiceException
092: */
093: public void setTextBody(String text) throws MessageServiceException {
094: this .txtMessage = text;
095: }
096:
097: /**
098: * This method returns the text body of this message.
099: *
100: * @return The string containing the text body.
101: * @exception MessageServiceException
102: */
103: public String getTextBody() throws MessageServiceException {
104: return txtMessage;
105: }
106:
107: }
|