com.echomine.jabber.msg
Class JabberVCardMessage

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.JabberVCardMessage
All Implemented Interfaces:
JabberMessageParsable

public class JabberVCardMessage
extends JabberIQMessage

A type of IQ message which contains extended information about a user.

These information include the user's full name, home and work address, email address, and a lot of other more or less useful data.

This class can be used both for requesting and for retrieving or sending a vCard message.

Current Implementation: JEP-0054 Version 1.1 (vcard-temp)

Author:
Matthias A. Benkard (kirby-2@users.sourceforge.net)

Nested Class Summary
 class JabberVCardMessage.LocalStruct
          Contains data about a location.
 
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
 
Constructor Summary
JabberVCardMessage()
          Creates a JabberVCardMessage of type "set".
JabberVCardMessage(java.lang.String type)
          Normally used for creating a new outgoing message.
 
Method Summary
protected  void add(Element e, java.lang.String elname, java.lang.String eltext)
          A convenience method to add a pair of strings to a DOM element.
 java.lang.String encode()
          Encodes the message into XML.
 java.lang.String getAge()
          Gets the user's age.
 java.lang.String getBackground()
          Gets the user's background.
 java.lang.String getBirthday()
          Gets the user's birthday.
 java.lang.String getDesc()
          Gets the user's advanced description.
 java.lang.String getFamily()
          Gets the user's family name.
 java.lang.String getForeground()
          Gets the user's foreground.
 java.lang.String getFullName()
          Gets the user's full name.
 java.lang.String getGender()
          Gets the user's gender.
 java.lang.String getGiven()
          Gets the user's first name.
 JabberVCardMessage.LocalStruct getHome()
          Gets the home struct.
 JID getJID()
          Gets the user's Jabber ID.
 java.lang.String getMail()
          Gets the user's email address.
 int getMessageType()
          Gets the message type.
 java.lang.String getMiddle()
          Gets the user's middle name.
 java.lang.String getNickname()
          Gets the user's nickname.
 java.lang.String getOrgName()
          Gets the organization name.
 java.lang.String getOrgUnit()
          Gets the organization unit.
 java.lang.String getPhoto()
          Gets the user's photo.
 java.lang.String getPhotoType()
          Get the MIME type of the photo if the photo data is Base64.
 java.lang.String getRole()
          Gets the user's role.
 java.lang.String getTitle()
          Gets the user's title.
 java.lang.String getURL()
          Gets the user's homepage URL.
 JabberVCardMessage.LocalStruct getWork()
          Gets the work struct.
 JabberMessage parse(JabberMessageParser parser, Element msgTree)
          Parses element/incoming message into a message object.
 void setAge(java.lang.String pAge)
          Sets the user's age.
 void setBackground(java.lang.String pBackground)
          Sets the user's background.
 void setBirthday(java.lang.String pBirthday)
          Sets the user's birthday.
 void setDesc(java.lang.String pDesc)
          Sets the user's advanced description.
 void setFamily(java.lang.String pFamilyName)
          Sets the user's family name.
 void setForeground(java.lang.String pForeground)
          Sets the user's foreground.
 void setFullName(java.lang.String pFullName)
          Sets the full name.
 void setGender(java.lang.String pGender)
          Sets the user's gender.
 void setGiven(java.lang.String pGivenName)
          Sets the user's first name.
 void setJID(JID pJID)
          Sets the user's Jabber ID.
 void setMail(java.lang.String pMail)
          Sets the user's email address.
 void setMiddle(java.lang.String pMiddleName)
          Sets the user's middle name.
 void setNickname(java.lang.String pNickname)
          Sets the user's nickname.
 void setOrgName(java.lang.String pOrgName)
          Sets the organization name.
 void setOrgUnit(java.lang.String pOrgUnit)
          Sets the organization unit.
 void setPhoto(java.lang.String pPhoto)
          Sets the user's ephoto.
 void setPhotoType(java.lang.String photoType)
          Set MIME type of a photo, if it's base64-encoded.
 void setRole(java.lang.String pRole)
          Sets the user's role.
 void setTitle(java.lang.String pTitle)
          Sets the user's title.
 void setURL(java.lang.String pURL)
          Sets the user's homepage URL.
 
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

JabberVCardMessage

public JabberVCardMessage(java.lang.String type)
Normally used for creating a new outgoing message.


JabberVCardMessage

public JabberVCardMessage()
Creates a JabberVCardMessage of type "set".

Method Detail

getFullName

public java.lang.String getFullName()
Gets the user's full name.

Returns:
The full name of the user, or an empty string if not set.

setFullName

public void setFullName(java.lang.String pFullName)
Sets the full name.

Parameters:
pFullName - The full name of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getMail

public java.lang.String getMail()
Gets the user's email address.

Returns:
The email address of the user, or an empty string if not set.

getPhoto

public java.lang.String getPhoto()
Gets the user's photo. Can be either URL or photo in Base64

Returns:
The photo of the user, or an empty string if not set.

setPhoto

public void setPhoto(java.lang.String pPhoto)
Sets the user's ephoto.

Parameters:
pPhoto - The photo of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getPhotoType

public java.lang.String getPhotoType()
Get the MIME type of the photo if the photo data is Base64. If the photo value is an URL, returns null.

Returns:
the Photo type value, or null if photo value is an URL

setPhotoType

public void setPhotoType(java.lang.String photoType)
Set MIME type of a photo, if it's base64-encoded. Set to null if the value of photo is a URL.

Parameters:
photoType - The new Photo type value.

getForeground

public java.lang.String getForeground()
Gets the user's foreground.

Returns:
The foreground of the user, or an empty string if not set.

setForeground

public void setForeground(java.lang.String pForeground)
Sets the user's foreground.

Parameters:
pForeground - The foreground of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getBackground

public java.lang.String getBackground()
Gets the user's background.

Returns:
The background of the user, or an empty string if not set.

setBackground

public void setBackground(java.lang.String pBackground)
Sets the user's background.

Parameters:
pBackground - The background of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

setMail

public void setMail(java.lang.String pMail)
Sets the user's email address.

Parameters:
pMail - The email address of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getBirthday

public java.lang.String getBirthday()
Gets the user's birthday.

Returns:
The birthday of the user, or an empty string if not set.

setBirthday

public void setBirthday(java.lang.String pBirthday)
Sets the user's birthday.

Parameters:
pBirthday - The birthday of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getGender

public java.lang.String getGender()
Gets the user's gender.

Returns:
The gender of the user, or an empty string if not set.

setGender

public void setGender(java.lang.String pGender)
Sets the user's gender.

Parameters:
pGender - The gender of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getAge

public java.lang.String getAge()
Gets the user's age.

Returns:
The age of the user, or an empty string if not set.

setAge

public void setAge(java.lang.String pAge)
Sets the user's age.

Parameters:
pAge - The age of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getURL

public java.lang.String getURL()
Gets the user's homepage URL.

Returns:
The URL of the user's homepage, or an empty string if not set.

setURL

public void setURL(java.lang.String pURL)
Sets the user's homepage URL.

Parameters:
pURL - The URL of the user's homepage. Set this to an empty string or null to have the field be skipped when creating the vCard.

getOrgName

public java.lang.String getOrgName()
Gets the organization name.

Returns:
The name of the user's organization, or an empty string if not set.

setOrgName

public void setOrgName(java.lang.String pOrgName)
Sets the organization name.

Parameters:
pOrgName - The name of the user's organization. Set this to an empty string or null to have the field be skipped when creating the vCard.

getOrgUnit

public java.lang.String getOrgUnit()
Gets the organization unit.

Returns:
The user's unit in the organization (?), or an empty string if not set.

setOrgUnit

public void setOrgUnit(java.lang.String pOrgUnit)
Sets the organization unit.

Parameters:
pOrgUnit - The user's unit in the organization (?). Set this to an empty string or null to have the field be skipped when creating the vCard.

getTitle

public java.lang.String getTitle()
Gets the user's title.

Returns:
The title of the user, or an empty string if not set.

setTitle

public void setTitle(java.lang.String pTitle)
Sets the user's title.

Parameters:
pTitle - The title of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getRole

public java.lang.String getRole()
Gets the user's role.

Returns:
The role of the user, or an empty string if not set.

setRole

public void setRole(java.lang.String pRole)
Sets the user's role.

Parameters:
pRole - The role of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getDesc

public java.lang.String getDesc()
Gets the user's advanced description.

Returns:
The description of the user, or an empty string if not set.

setDesc

public void setDesc(java.lang.String pDesc)
Sets the user's advanced description.

Parameters:
pDesc - The description of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getJID

public JID getJID()
Gets the user's Jabber ID.

Returns:
The Jabber ID of the user, or null if not set.

setJID

public void setJID(JID pJID)
Sets the user's Jabber ID.

Parameters:
pJID - The Jabber ID of the user. Set this to null to have the field be skipped when creating the vCard.

getMiddle

public java.lang.String getMiddle()
Gets the user's middle name.

Returns:
The middle name of the user, or an empty string if not set.

setMiddle

public void setMiddle(java.lang.String pMiddleName)
Sets the user's middle name.

Parameters:
pMiddleName - The middle name of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getGiven

public java.lang.String getGiven()
Gets the user's first name.

Returns:
The first name of the user, or an empty string if not set.

setGiven

public void setGiven(java.lang.String pGivenName)
Sets the user's first name.

Parameters:
pGivenName - The first name of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getFamily

public java.lang.String getFamily()
Gets the user's family name.

Returns:
The family name of the user, or an empty string if not set.

setFamily

public void setFamily(java.lang.String pFamilyName)
Sets the user's family name.

Parameters:
pFamilyName - The family name of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getNickname

public java.lang.String getNickname()
Gets the user's nickname.

Returns:
The nickname of the user, or an empty string if not set.

setNickname

public void setNickname(java.lang.String pNickname)
Sets the user's nickname.

Parameters:
pNickname - The nickname of the user. Set this to an empty string or null to have the field be skipped when creating the vCard.

getHome

public JabberVCardMessage.LocalStruct getHome()
Gets the home struct.

Returns:
A reference to the message's JabberVCardMessage.LocalStruct that contains information about the user's home.

getWork

public JabberVCardMessage.LocalStruct getWork()
Gets the work struct.

Returns:
A reference to the message's JabberVCardMessage.LocalStruct that contains information about the user's working place.

getMessageType

public int getMessageType()
Gets the message type.

Overrides:
getMessageType in class JabberIQMessage
Returns:
This message's type.
See Also:
JabberCode

parse

public JabberMessage parse(JabberMessageParser parser,
                           Element msgTree)
                    throws ParseException
Parses element/incoming message into a message object.

Specified by:
parse in interface JabberMessageParsable
Overrides:
parse in class AbstractJabberMessage
Parameters:
parser - the messageg parser
msgTree - The element which the message object will be constructed from.
Returns:
The message object created by parsing the Element msgTree.
Throws:
ParseException - if parsing the message failed.

encode

public java.lang.String encode()
                        throws ParseException
Encodes the message into XML.

Overrides:
encode in class JabberJDOMMessage
Returns:
The XML string.
Throws:
ParseException - if something wicked happened while encoding the message.

add

protected void add(Element e,
                   java.lang.String elname,
                   java.lang.String eltext)
A convenience method to add a pair of strings to a DOM element.

This method adds to the Element e a new element with the name given by the elname parameter and sets the new element's content to the eltext string. If eltext is empty, nothing happens (no Element will be added to e in this case).

Parameters:
e - The org.jdom.Element to add the new element to.
elname - The name of the new element.
eltext - The content of the new element.


Copyright © 2001-2005 Echomine. All Rights Reserved.