com.objectxp.msg.smart
Class VCard

java.lang.Object
  extended by com.objectxp.msg.Message
      extended by com.objectxp.msg.SmsMessage
          extended by com.objectxp.msg.smart.SmartMessage
              extended by com.objectxp.msg.smart.VCard
All Implemented Interfaces:
MultiPartMessage, java.io.Serializable, java.lang.Cloneable

public class VCard
extends SmartMessage

This class represents a VCard for SmartMessaging enabled phones.

Example:

 ...
 SmsService service = new GsmSmsService();
 ...
 VCard card = new VCard();
 card.setItem(VCard.NAME, "Fredy Bean");
 card.setItem(VCard.ORG, "object XP");
 card.addItem(VCard.TEL, new String[]{VCard.TYPE_WORK, VCard.TYPE_VOICE}, "0012345678");
 card.addItem(VCard.TEL, new String[]{VCard.TYPE_WORK, VCard.TYPE_FAX}, "0023456789");
 card.addItem(VCard.TEL, new String[]{VCard.TYPE_HOME, VCard.TYPE_CELL}, "0034567890");
 card.addItem(VCard.ADR, new String[]{VCard.TYPE_WORK}, "Marktgasse 11, Winterthur, Switzerland");
 card.setRecipient("+41791234567"); 
 service.sendMessage(card);
 ...
 
For more information about VCard visit the web-site of the Internet Mail Consortium.

See Also:
Serialized Form

Field Summary
static java.lang.String ADR
          Delivery Address, may contain types DOM, INTL, POSTAL, PARCEL, HOME, WORK
static java.lang.String AGENT
          Specifies information about another person who will act on behalf
static java.lang.String BDAY
          Specifies the birth date
static int CELL
          Deprecated. use Strings parameters with addItem(String, String[], String) instead.
static int DOM
          Deprecated. use String parameters with addItem(String, String[], String)
static java.lang.String EMAIL
          Electronic Mail Address.
static int FAX
          Deprecated. use String parameters with addItem(String, String[], String)
static java.lang.String FORMATED_NAME
          Specifies the formatted text corresponding to the name of the object
static java.lang.String GEO
          Specifies information related to the global position
static int HOME
          Deprecated. use String parameters with addItem(String, String[], String)
static int INTL
          Deprecated. use String parameters with addItem(String, String[], String)
static java.lang.String LABEL
          Delivery Label, may contain types DOM, INTL, POSTAL, PARCEL, HOME, WORK
static java.lang.String MAILER
          Specifies the type of electronic mail software that is used
static java.lang.String NAME
          Specifies the Name
static java.lang.String NO_TYPE
          Indicates the default type if no type is set.
static java.lang.String NOTE
          Specifies supplemental information or a comment
static java.lang.String ORG
          Specifies the organizational name and unit
static int PAGER
          Deprecated. use String parameters with addItem(String, String[], String)
static java.lang.String REV
          Specifies the combination of the calendar date and time of day of the last update to the vCard object
static java.lang.String ROLE
          Specifies information concerning the role, occupation, or business category
static java.lang.String TEL
          Specifies the Phone Number, may contain types PREF, WORK, HOME, VOICE, FAX, MSG, CELL, PAGER, BBS, MODEM, CAR, ISDN, VIDEO
static java.lang.String TITLE
          Specifies the job title, functional position or function
static java.lang.String TYPE_BBS
          Indicates a bulletin board service number
static java.lang.String TYPE_CAR
          Indicates a car-phone number
static java.lang.String TYPE_CELL
          Type definition for Mobile Phone
static java.lang.String TYPE_DOM
          Place definition for domestic
static java.lang.String TYPE_FAX
          Type definition for a Fax
static java.lang.String TYPE_HOME
          Indicates a home number or place
static java.lang.String TYPE_INTL
          Place definition for international
static java.lang.String TYPE_ISDN
          Indicates an ISDN number
static java.lang.String TYPE_MODEM
          Indicates a MODEM number
static java.lang.String TYPE_MSG
          Indicates a messaging service on the number
static java.lang.String TYPE_PAGER
          Type definition for Pager
static java.lang.String TYPE_PARCEL
          Indicates a parcel delivery address
static java.lang.String TYPE_POSTAL
          Indicates a postal delivery address
static java.lang.String TYPE_PREF
          Indicates preferred number or place
static java.lang.String TYPE_VIDEO
          Indicates a video-phone number
static java.lang.String TYPE_VOICE
          type definition for Voice
static java.lang.String TYPE_WORK
          Indicates a work number or place
static java.lang.String TZ
          Specifies information related to the standard time
static java.lang.String UDI
          Specifies a persistent, globally unique identifier
static java.lang.String URL
          Specifies a Internet location
static int VOICE
          Deprecated. use String parameters with addItem(String, String[], String)
static int WORK
          Deprecated. use String parameters with addItem(String, String[], String)
 
Fields inherited from class com.objectxp.msg.SmsMessage
CLASS_0, CLASS_1, CLASS_2, CLASS_3, DC_8BIT, DC_DEFAULT, DC_GROUP_DATA, DC_GROUP_GENERAL, DC_GROUP_MSG_WAITING_DISCARD, DC_GROUP_MSG_WAITING_STORE, DC_UCS2, INDICATION_ACTIVE, INDICATION_INACTIVE, INDICATION_TYPE_EMAIL, INDICATION_TYPE_FAX, INDICATION_TYPE_OTHER, INDICATION_TYPE_VOICEMAIL, NO_CLASS
 
Fields inherited from class com.objectxp.msg.Message
ACK_TIME, MT_BINARY, MT_STATUS, MT_TEXT, SENDER_TYPE_ALPHA, SENDER_TYPE_GUESS, SENDER_TYPE_NUMBER
 
Constructor Summary
VCard()
          Creates a new, empty VCard.
VCard(SmsService service)
          Deprecated. since jSMS 1.7, use VCard()
 
Method Summary
 void addAddress(int place, java.lang.String addr)
          Deprecated. since jSMS 1.8, because the VCard specification allows to add several types for a address. Use addItem(String, String[], String) instead.
 void addItem(java.lang.String item, java.lang.String[] types, java.lang.String value)
          Adds the given value to the internal properties.
 void addTel(int place, int type, java.lang.String tel)
          Deprecated. since jSMS 1.8, because the VCard specification allows to add more the two types for a phone. Use addItem(String, String[], String) instead.
 java.lang.String getItem(java.lang.String item)
          Gets the value associated with a specific item or null if the item is not set.
 java.util.Iterator getItems()
          Returns all items which are set in this VCard.
 java.util.Properties getItems(java.lang.String item)
          Returns the types and values associated with a specific item.
 java.lang.String getMessage()
          Get the Message (User Data) as String.
 java.lang.String getName()
          Deprecated. since jSMS 1.8, use getItem(String) instead.
 byte[] getUserData()
          Get the User Data of this message.
 void setAddress(java.lang.String addr)
          Deprecated. since jSMS 1.8, use setItem(String, String) instead.
 void setBirthday(java.lang.String b)
          Deprecated. since jSMS 1.8, use setItem(String, String) instead.
 void setItem(java.lang.String item, java.lang.String value)
          Sets a Item without a type.
 void setName(java.lang.String n)
          Deprecated. since jSMS 1.8, use setItem(String, String) instead.
 void setOrganisation(java.lang.String org)
          Deprecated. since jSMS 1.8, use setItem(String, String) instead.
 void setTel(java.lang.String tel)
          Deprecated. since jSMS 1.8, use setItem(String, String) instead.
 
Methods inherited from class com.objectxp.msg.smart.SmartMessage
buildParts, buildParts, getParts
 
Methods inherited from class com.objectxp.msg.SmsMessage
containsUserDataHeader, copyFields, getAlphabet, getBytes, getCodingGroup, getDeferredDeliveryAsDate, getDeferredDeliveryInMinutes, getID, getIndicationState, getIndicationType, getMessageClass, getParent, getPID, getRecipient, getRecipientAddress, getSender, getSenderAddress, getType, getUserDataHeader, getValidityPeriodAsDate, getValidityPeriodInMinutes, hasDeferredDelivery, hasMessageClass, hasValidityPeriod, isCompressed, isMMS, isRejectDuplicates, isRelativeDeferredDelivery, isRelativeValidityPeriod, isReplyPath, requestStatusReport, requestStatusReport, setAlphabet, setCodingGroup, setCompression, setDeferredDelivery, setDeferredDelivery, setIndicationState, setIndicationType, setMessage, setMessage, setMessageClass, setMMS, setParent, setPID, setRecipient, setRecipientAddress, setRejectDuplicates, setReplyPath, setSender, setSenderAddress, setType, setUserData, setUserDataHeader, setUserDataHeader, setValidityPeriod, setValidityPeriod, toString
 
Methods inherited from class com.objectxp.msg.Message
clone, getProperty, getSenderType, getTimestamp, setID, setProperty, setSenderType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEL

public static final java.lang.String TEL
Specifies the Phone Number, may contain types PREF, WORK, HOME, VOICE, FAX, MSG, CELL, PAGER, BBS, MODEM, CAR, ISDN, VIDEO

See Also:
Constant Field Values

ADR

public static final java.lang.String ADR
Delivery Address, may contain types DOM, INTL, POSTAL, PARCEL, HOME, WORK

See Also:
Constant Field Values

LABEL

public static final java.lang.String LABEL
Delivery Label, may contain types DOM, INTL, POSTAL, PARCEL, HOME, WORK

See Also:
Constant Field Values

EMAIL

public static final java.lang.String EMAIL
Electronic Mail Address. The default email type is "internet". A non-standard value can also be specified

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
Specifies the Name

See Also:
Constant Field Values

BDAY

public static final java.lang.String BDAY
Specifies the birth date

See Also:
Constant Field Values

ORG

public static final java.lang.String ORG
Specifies the organizational name and unit

See Also:
Constant Field Values

FORMATED_NAME

public static final java.lang.String FORMATED_NAME
Specifies the formatted text corresponding to the name of the object

See Also:
Constant Field Values

TITLE

public static final java.lang.String TITLE
Specifies the job title, functional position or function

See Also:
Constant Field Values

ROLE

public static final java.lang.String ROLE
Specifies information concerning the role, occupation, or business category

See Also:
Constant Field Values

NOTE

public static final java.lang.String NOTE
Specifies supplemental information or a comment

See Also:
Constant Field Values

REV

public static final java.lang.String REV
Specifies the combination of the calendar date and time of day of the last update to the vCard object

See Also:
Constant Field Values

URL

public static final java.lang.String URL
Specifies a Internet location

See Also:
Constant Field Values

UDI

public static final java.lang.String UDI
Specifies a persistent, globally unique identifier

See Also:
Constant Field Values

TZ

public static final java.lang.String TZ
Specifies information related to the standard time

See Also:
Constant Field Values

GEO

public static final java.lang.String GEO
Specifies information related to the global position

See Also:
Constant Field Values

MAILER

public static final java.lang.String MAILER
Specifies the type of electronic mail software that is used

See Also:
Constant Field Values

AGENT

public static final java.lang.String AGENT
Specifies information about another person who will act on behalf

See Also:
Constant Field Values

TYPE_CELL

public static final java.lang.String TYPE_CELL
Type definition for Mobile Phone

See Also:
Constant Field Values

TYPE_PAGER

public static final java.lang.String TYPE_PAGER
Type definition for Pager

See Also:
Constant Field Values

TYPE_FAX

public static final java.lang.String TYPE_FAX
Type definition for a Fax

See Also:
Constant Field Values

TYPE_VOICE

public static final java.lang.String TYPE_VOICE
type definition for Voice

See Also:
Constant Field Values

TYPE_PREF

public static final java.lang.String TYPE_PREF
Indicates preferred number or place

See Also:
Constant Field Values

TYPE_WORK

public static final java.lang.String TYPE_WORK
Indicates a work number or place

See Also:
Constant Field Values

TYPE_HOME

public static final java.lang.String TYPE_HOME
Indicates a home number or place

See Also:
Constant Field Values

TYPE_MSG

public static final java.lang.String TYPE_MSG
Indicates a messaging service on the number

See Also:
Constant Field Values

TYPE_BBS

public static final java.lang.String TYPE_BBS
Indicates a bulletin board service number

See Also:
Constant Field Values

TYPE_MODEM

public static final java.lang.String TYPE_MODEM
Indicates a MODEM number

See Also:
Constant Field Values

TYPE_CAR

public static final java.lang.String TYPE_CAR
Indicates a car-phone number

See Also:
Constant Field Values

TYPE_ISDN

public static final java.lang.String TYPE_ISDN
Indicates an ISDN number

See Also:
Constant Field Values

TYPE_VIDEO

public static final java.lang.String TYPE_VIDEO
Indicates a video-phone number

See Also:
Constant Field Values

TYPE_DOM

public static final java.lang.String TYPE_DOM
Place definition for domestic

See Also:
Constant Field Values

TYPE_INTL

public static final java.lang.String TYPE_INTL
Place definition for international

See Also:
Constant Field Values

TYPE_PARCEL

public static final java.lang.String TYPE_PARCEL
Indicates a parcel delivery address

See Also:
Constant Field Values

TYPE_POSTAL

public static final java.lang.String TYPE_POSTAL
Indicates a postal delivery address

See Also:
Constant Field Values

NO_TYPE

public static final java.lang.String NO_TYPE
Indicates the default type if no type is set.

See Also:
Constant Field Values

CELL

public static final int CELL
Deprecated. use Strings parameters with addItem(String, String[], String) instead.
See Also:
Constant Field Values

PAGER

public static final int PAGER
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

FAX

public static final int FAX
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

VOICE

public static final int VOICE
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

WORK

public static final int WORK
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

HOME

public static final int HOME
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

DOM

public static final int DOM
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values

INTL

public static final int INTL
Deprecated. use String parameters with addItem(String, String[], String)
See Also:
Constant Field Values
Constructor Detail

VCard

public VCard()
      throws java.lang.IllegalArgumentException
Creates a new, empty VCard.

Throws:
java.lang.IllegalArgumentException

VCard

public VCard(SmsService service)
      throws java.lang.IllegalArgumentException
Deprecated. since jSMS 1.7, use VCard()

Creates a new VCard.

Parameters:
service - the initialized SmsService used for sending the message
Throws:
java.lang.IllegalArgumentException - if the SmsService is null or has not yet been initialized
Method Detail

setName

public void setName(java.lang.String n)
Deprecated. since jSMS 1.8, use setItem(String, String) instead.

Set the name of this card.

Parameters:
n - String representing the name

getName

public java.lang.String getName()
Deprecated. since jSMS 1.8, use getItem(String) instead.

Get the name of this card.


setOrganisation

public void setOrganisation(java.lang.String org)
Deprecated. since jSMS 1.8, use setItem(String, String) instead.

Sets organisation.

Parameters:
org - organisation name

setBirthday

public void setBirthday(java.lang.String b)
Deprecated. since jSMS 1.8, use setItem(String, String) instead.

Sets birthday of the current card.

Parameters:
b -

setTel

public void setTel(java.lang.String tel)
Deprecated. since jSMS 1.8, use setItem(String, String) instead.

Simple way to set a telephon number to the card. To set specific attributes like place and type of phone.

Parameters:
tel - the phone number

addTel

public void addTel(int place,
                   int type,
                   java.lang.String tel)
            throws java.lang.IllegalArgumentException
Deprecated. since jSMS 1.8, because the VCard specification allows to add more the two types for a phone. Use addItem(String, String[], String) instead.

Sets the telephone number with a given place (WORK, HOME) and type (VOICE, CELL, FAX). You can add more then one telephone number if you need.

Parameters:
place - int value representing a place
type - int value representing a type
tel - the phone number
Throws:
java.lang.IllegalArgumentException

setAddress

public void setAddress(java.lang.String addr)
Deprecated. since jSMS 1.8, use setItem(String, String) instead.

Simple way to set an address. If you need more specific attributes about the place, use addAddress.

Parameters:
addr - String representing the address.

addAddress

public void addAddress(int place,
                       java.lang.String addr)
Deprecated. since jSMS 1.8, because the VCard specification allows to add several types for a address. Use addItem(String, String[], String) instead.

Adds an address to the current card wit given place (WORK, HOME, DOM, INTL).

Parameters:
place - int value representing a place.
addr -
Throws:
java.lang.IllegalArgumentException

setItem

public void setItem(java.lang.String item,
                    java.lang.String value)
Sets a Item without a type. If the given Item is already set, it will be overwritten. Possible Items are: ADR, AGENT, BDAY, ...


addItem

public void addItem(java.lang.String item,
                    java.lang.String[] types,
                    java.lang.String value)
             throws java.lang.IllegalArgumentException
Adds the given value to the internal properties. If the given Item with the given types already existe, it will be overwritten.
The types may be none, one or several of TYPE_HOME, TYPE_CAR,... or any other types according to the VCard specification.

Throws:
java.lang.IllegalArgumentException

getItem

public java.lang.String getItem(java.lang.String item)
Gets the value associated with a specific item or null if the item is not set. Note:if the Item contains type definitions (eg. TEL;HOME:+41525556644) this method returns null, use getItems(String) instead.


getItems

public java.util.Properties getItems(java.lang.String item)
Returns the types and values associated with a specific item. E.g. for item TEL:
keyvalue
[HOME][+41525008844]
[HOME;FAX][+4152508848]
[CELL][+41785001122]
[][+41785001122](default)
Note:if no type definition is set, the property key is NO_TYPE

Parameters:
item - may be ADR, AGENT, BDAY, ...

getItems

public java.util.Iterator getItems()
Returns all items which are set in this VCard. You may use the items returned to invoke getItem(String)
eg: [TEL;HOME], [TEL;HOME;FAX], [TEL;CELL], [N], [ADR], ...

Returns:
an Iterator of Strings

getMessage

public java.lang.String getMessage()
Description copied from class: SmsMessage
Get the Message (User Data) as String.

Overrides:
getMessage in class SmsMessage
Returns:
the User Data converted to a String object.
See Also:
SmsMessage.getUserData()

getUserData

public byte[] getUserData()
Description copied from class: SmsMessage
Get the User Data of this message.

Overrides:
getUserData in class SmsMessage
Returns:
the user data or null if the message contains no user data


object XP, Inc. © 2000-2008. All rights reserved object XP