com.echomine.jabber.msg
Class VacationIQMessage

java.lang.Object
  extended by com.echomine.jabber.JabberMessage
      extended by com.echomine.jabber.JabberJDOMMessage
          extended by com.echomine.jabber.AbstractJabberMessage
              extended by com.echomine.jabber.JabberIQMessage
                  extended by com.echomine.jabber.msg.VacationIQMessage
All Implemented Interfaces:
JabberCode, JabberMessageParsable

public class VacationIQMessage
extends JabberIQMessage
implements JabberCode

Works with vacation messages. This allow the user to specify and even schedule a time when the vacation message will be displayed. Normally, you must first check to see if the server supports vacation messages (it is a disco service, thus it cannot be retrieved through jabber:iq:agent or jabber:iq:browse). For now, vacation message have a defined disco namespace. Thus, it will be used for now until otherwise specified in the JEP.

Current Implementation: JEP-0109 Version 0.2

Since:
0.8a4

Field Summary
 
Fields inherited from class com.echomine.jabber.JabberIQMessage
TYPE_GET, TYPE_RESULT, TYPE_SET
 
Fields inherited from class com.echomine.jabber.AbstractJabberMessage
TYPE_ERROR
 
Fields inherited from class com.echomine.jabber.JabberMessage
messageID
 
Fields inherited from interface com.echomine.jabber.JabberCode
MSG_CHAT, MSG_INIT, MSG_IQ, MSG_IQ_AGENTS, MSG_IQ_AUTH, MSG_IQ_BROWSE, MSG_IQ_DISCO_INFO, MSG_IQ_DISCO_ITEMS, MSG_IQ_GATEWAY, MSG_IQ_LAST, MSG_IQ_OOB, MSG_IQ_PRIVATE, MSG_IQ_REGISTER, MSG_IQ_ROSTER, MSG_IQ_SEARCH, MSG_IQ_TIME, MSG_IQ_VACATION, MSG_IQ_VCARD, MSG_IQ_VERSION, MSG_IQ_XMLRPC, MSG_PRESENCE, MSG_UNKNOWN, MSG_X_DATA, MSG_X_DELAY, MSG_X_EVENT, MSG_X_EXPIRE, MSG_X_OOB, MSG_X_PGP_ENCRYPTED, MSG_X_PGP_SIGNED, MSG_X_ROSTER, PARSER_CHAT, PARSER_IQ, PARSER_IQ_AGENTS, PARSER_IQ_AUTH, PARSER_IQ_BROWSE, PARSER_IQ_DISCO_INFO, PARSER_IQ_DISCO_ITEMS, PARSER_IQ_GATEWAY, PARSER_IQ_LAST, PARSER_IQ_OOB, PARSER_IQ_PRIVATE, PARSER_IQ_REGISTER, PARSER_IQ_ROSTER, PARSER_IQ_SEARCH, PARSER_IQ_TIME, PARSER_IQ_VACATION, PARSER_IQ_VCARD, PARSER_IQ_VERSION, PARSER_IQ_XMLRPC, PARSER_PRESENCE, PARSER_X_DATA, PARSER_X_DELAY, PARSER_X_EVENT, PARSER_X_EXPIRE, PARSER_X_OOB, PARSER_X_PGP_ENCRYPTED, PARSER_X_PGP_SIGNED, PARSER_X_ROSTER, XMLNS_CHAT, XMLNS_ERROR_STANZA, XMLNS_ERROR_STREAM, XMLNS_IQ, XMLNS_IQ_AGENTS, XMLNS_IQ_AUTH, XMLNS_IQ_BROWSE, XMLNS_IQ_DISCO_INFO, XMLNS_IQ_DISCO_ITEMS, XMLNS_IQ_GATEWAY, XMLNS_IQ_LAST, XMLNS_IQ_OOB, XMLNS_IQ_PRIVATE, XMLNS_IQ_REGISTER, XMLNS_IQ_ROSTER, XMLNS_IQ_SEARCH, XMLNS_IQ_TIME, XMLNS_IQ_VACATION, XMLNS_IQ_VCARD, XMLNS_IQ_VERSION, XMLNS_IQ_XMLRPC, XMLNS_PRESENCE, XMLNS_STREAM, XMLNS_X_DATA, XMLNS_X_DELAY, XMLNS_X_EVENT, XMLNS_X_EXPIRE, XMLNS_X_OOB, XMLNS_X_PGP_ENCRYPTED, XMLNS_X_PGP_SIGNED, XMLNS_X_ROSTER
 
Constructor Summary
VacationIQMessage()
          sets the default to be of iq type "get"
VacationIQMessage(java.lang.String type)
          this constructor is for creating outgoing messages.
 
Method Summary
static VacationIQMessage createRemoveVacationMessage()
          Convenience method to create a vacation message that allows you to remove your vacation message.
static VacationIQMessage createRequestVacationMessage()
          Convenience method to instantiate a vacation message that allows you to request for your own vacation settings.
static VacationIQMessage createSetVacationMessage(java.util.Calendar startDate, java.util.Calendar endDate, java.lang.String vacationMessage)
          Convenience method to create a vacation message that allows you to set your vacation message.
 java.lang.String encode()
          encodes the data in this object into XML string
 java.util.Calendar getEndDate()
          the ending date for the vacation message.
 int getMessageType()
          the default message type is unknown.
 java.util.Calendar getStartDate()
          the ending date for the vacation message.
 java.lang.String getVacationMessage()
           
 JabberMessage parse(JabberMessageParser parser, Element msgTree)
          parses the incoming XML DOM object for the data that we need
 void setEndDate(java.util.Calendar endDate)
          sets the end date for the vacation message
 void setStartDate(java.util.Calendar startDate)
          sets the start date for the vacation message
 void setVacationMessage(java.lang.String vacationMessage)
          sets the vacation message.
 
Methods inherited from class com.echomine.jabber.AbstractJabberMessage
getErrorMessage, getFrom, getTo, getType, isError, setErrorMessage, setFrom, setTo, setType
 
Methods inherited from class com.echomine.jabber.JabberJDOMMessage
getDOM, getXMLOutputter, setMessageID, toString
 
Methods inherited from class com.echomine.jabber.JabberMessage
getMessageID, getReplyMessage, getTimeout, getXMessage, getXMessages, interrupt, isReplyRequired, isSendXMessages, isSynchronized, replyReceived, setReplyRequired, setSendXMessages, setSynchronized, setTimeout, setXMessage, setXMessages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VacationIQMessage

public VacationIQMessage(java.lang.String type)
this constructor is for creating outgoing messages. It is here to be used by subclasses. The constructor simply creates a default element tree with the as the top top level tag and as its child, and then sets the message to use that tree.


VacationIQMessage

public VacationIQMessage()
sets the default to be of iq type "get"

Method Detail

createRequestVacationMessage

public static VacationIQMessage createRequestVacationMessage()
Convenience method to instantiate a vacation message that allows you to request for your own vacation settings.


createSetVacationMessage

public static VacationIQMessage createSetVacationMessage(java.util.Calendar startDate,
                                                         java.util.Calendar endDate,
                                                         java.lang.String vacationMessage)
Convenience method to create a vacation message that allows you to set your vacation message.

Parameters:
startDate - the starting date, can be null
endDate - the ending date, can be null
vacationMessage - the vacation message, or null or empty if none

createRemoveVacationMessage

public static VacationIQMessage createRemoveVacationMessage()
Convenience method to create a vacation message that allows you to remove your vacation message.


getStartDate

public java.util.Calendar getStartDate()
the ending date for the vacation message. The returned datetime is in the timezone that is contained inside the calendar. If you need to show it in your own current timezone, you must convert the date returned by this method.

Returns:
the starting date of the vacation, or null if it has not been set

getEndDate

public java.util.Calendar getEndDate()
the ending date for the vacation message. The returned datetime is in the timezone that is contained inside the calendar. If you need to show it in your own current timezone, you must convert the date returned by this method.

Returns:
the ending date of the vacation, or null if it has not been set

getVacationMessage

public java.lang.String getVacationMessage()
Returns:
the vacation message, or empty if there is no vacation message

setVacationMessage

public void setVacationMessage(java.lang.String vacationMessage)
sets the vacation message. If null is passed in, the vacation message will be set to an empty string.


setStartDate

public void setStartDate(java.util.Calendar startDate)
sets the start date for the vacation message


setEndDate

public void setEndDate(java.util.Calendar endDate)
sets the end date for the vacation message


parse

public JabberMessage parse(JabberMessageParser parser,
                           Element msgTree)
                    throws ParseException
parses the incoming XML DOM object for the data that we need

Specified by:
parse in interface JabberMessageParsable
Overrides:
parse in class AbstractJabberMessage
Throws:
ParseException

encode

public java.lang.String encode()
                        throws ParseException
encodes the data in this object into XML string

Overrides:
encode in class JabberJDOMMessage
Returns:
the xml string
Throws:
ParseException - if something went wrong during encoding

getMessageType

public int getMessageType()
Description copied from class: JabberJDOMMessage
the default message type is unknown. It doesn't mean that there is no type. It just means that there is no known message parser for this particular object.

Overrides:
getMessageType in class JabberIQMessage
Returns:
the message type
See Also:
JabberCode


Copyright © 2001-2005 Echomine. All Rights Reserved.