com.vodafone360.people.datatypes
Class VCardHelper

java.lang.Object
  extended by com.vodafone360.people.datatypes.VCardHelper

public class VCardHelper
extends java.lang.Object

Helper class for handling VCard information associated with Contacts either from People server/client or from Native database. Also used to help with handling of Call log/Message log events displayed in Timeline.


Nested Class Summary
private static class VCardHelper.Item
          Item class representing vCard item.
static class VCardHelper.Name
          Handle VCard name fields.
static class VCardHelper.Organisation
          Handle VCard organisation fields.
static class VCardHelper.PostalAddress
          Handle VCard postal address
 
Field Summary
static char LIST_SEPARATOR
           
static char SUB_LIST_SEPARATOR
           
 
Constructor Summary
VCardHelper()
           
 
Method Summary
private static java.lang.String createVCardList(java.util.List<VCardHelper.Item> itemList)
          Create String from array of VCard items.
protected static Time getDate(java.lang.String val)
          Get Time item from supplied String.
protected static java.lang.String getEmail(java.lang.String val)
          Create simple String representation of email address from supplied VCard email String.
static VCardHelper.Name getName(java.lang.String val)
          Get Name object from supplied String.
static VCardHelper.Organisation getOrg(java.lang.String val)
          s Create Organisation item from String containing VCArd organisation representation.
static VCardHelper.PostalAddress getPostalAddress(java.lang.String val)
          Get PostalAddress from supplied string.
protected static java.lang.String getSingleTextValue(java.lang.String val)
          Fetch a single string value from a VCard string Suitable for Url, Internet Address, IM Address, Role, Title and Note
protected static void getStringList(java.util.List<java.lang.String> list, java.lang.String val)
          Generate List array of items (as Strings) from single String using ListIterator.
protected static java.lang.String getTel(java.lang.String val)
          Get telephone number as String from VCard representation.
private static void getVCardList(java.lang.String val, java.util.List<VCardHelper.Item> itemList)
          Create array of VCard items from supplied String.
static boolean isEmptyVCardValue(java.lang.String value)
          Tells whether or not the provided VCard value is empty.
protected static java.lang.String makeDate(Time time)
          Create VCard date String from supplied Time item.
static java.lang.String makeEmail(java.lang.String emailAddress)
          Generate VCard email address from simple String representation.
static java.lang.String makeName(VCardHelper.Name name)
          Return VCard name string from supplied Name.
static java.lang.String makeOrg(VCardHelper.Organisation org)
          Create VCard Organisation item.
static java.lang.String makePostalAddress(VCardHelper.PostalAddress address)
          Create VCard representation of postal address.
protected static java.lang.String makeSingleTextValue(java.lang.String textValue)
          Create a VCard string from a single value Suitable for Url, Internet Address, IM Address, Role, Title and Note
protected static java.lang.String makeTel(java.lang.String telNumber)
          Create VCard telephone number String.
private static java.lang.String nextFullItem(java.util.ListIterator<VCardHelper.Item> it)
          Return next complete Item from item ListIterator as String.
private static java.util.List<java.lang.String> nextFullItemArray(java.util.ListIterator<VCardHelper.Item> it)
          Return List of Strings made up of next full item and sub-items retrieved from ListIterator.
static java.lang.String parseCompanyFromOrganization(java.lang.String value)
          Parses the Company name from a VCard Organization String.
static java.lang.String splitDepartmentsFromOrganization(java.lang.String value)
          Splits the VCard Organization value to return only the departments Note: it will return the ';' separated departments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST_SEPARATOR

public static final char LIST_SEPARATOR
See Also:
Constant Field Values

SUB_LIST_SEPARATOR

public static final char SUB_LIST_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

VCardHelper

public VCardHelper()
Method Detail

createVCardList

private static java.lang.String createVCardList(java.util.List<VCardHelper.Item> itemList)
Create String from array of VCard items.

Parameters:
itemList - List array of VCard items.
Returns:
String constructed from array of Items.

getVCardList

private static void getVCardList(java.lang.String val,
                                 java.util.List<VCardHelper.Item> itemList)
Create array of VCard items from supplied String.

Parameters:
val - String containing VCard items.
itemList - List of VCard items to populate.

nextFullItem

private static java.lang.String nextFullItem(java.util.ListIterator<VCardHelper.Item> it)
Return next complete Item from item ListIterator as String. Sub-items are appended to the String.

Parameters:
it - ListIterator to iterate through Items.
Returns:
next Item.

nextFullItemArray

private static java.util.List<java.lang.String> nextFullItemArray(java.util.ListIterator<VCardHelper.Item> it)
Return List of Strings made up of next full item and sub-items retrieved from ListIterator.

Parameters:
it - ListIterator to iterate through Items.
Returns:
List of Strings generated from Item.

makeSingleTextValue

protected static java.lang.String makeSingleTextValue(java.lang.String textValue)
Create a VCard string from a single value Suitable for Url, Internet Address, IM Address, Role, Title and Note

Parameters:
textValue - The string value to use
Returns:
A string in VCard format (does not include types)

getSingleTextValue

protected static java.lang.String getSingleTextValue(java.lang.String val)
Fetch a single string value from a VCard string Suitable for Url, Internet Address, IM Address, Role, Title and Note

Parameters:
val - A string in VCard format.
Returns:
the single text value.

makeName

public static java.lang.String makeName(VCardHelper.Name name)
Return VCard name string from supplied Name.

Parameters:
name - Name item.
Returns:
String generated from supplied Name.

getName

public static VCardHelper.Name getName(java.lang.String val)
Get Name object from supplied String.

Parameters:
val - String containing name information.
Returns:
Name item generated from supplied string.

makeDate

protected static java.lang.String makeDate(Time time)
Create VCard date String from supplied Time item.

Parameters:
time - Time item.
Returns:
String generated from supplied Time item.

getDate

protected static Time getDate(java.lang.String val)
Get Time item from supplied String.

Parameters:
val - String containing time information.
Returns:
Time item generated from supplied String.

makeEmail

public static java.lang.String makeEmail(java.lang.String emailAddress)
Generate VCard email address from simple String representation.

Parameters:
emailAddress - simple email address.
Returns:
email address in VCard style String.

getEmail

protected static java.lang.String getEmail(java.lang.String val)
Create simple String representation of email address from supplied VCard email String.

Parameters:
val - VCard email String.
Returns:
email address as simple String.

makeTel

protected static java.lang.String makeTel(java.lang.String telNumber)
Create VCard telephone number String.

Parameters:
telNumber - String containing telephone number
Returns:
VCatrd representation of telephone number.

getTel

protected static java.lang.String getTel(java.lang.String val)
Get telephone number as String from VCard representation.

Parameters:
val - VCard representation of telephone number.
Returns:
String containing telephone number.

makePostalAddress

public static java.lang.String makePostalAddress(VCardHelper.PostalAddress address)
Create VCard representation of postal address.

Parameters:
address - PostalAddress item.
Returns:
VCard representation of postal address.

getPostalAddress

public static VCardHelper.PostalAddress getPostalAddress(java.lang.String val)
Get PostalAddress from supplied string.

Parameters:
val - String containing address.
Returns:
Postal address generated from supplied String.

makeOrg

public static java.lang.String makeOrg(VCardHelper.Organisation org)
Create VCard Organisation item.

Parameters:
org - Organisation item.
Returns:
VCard organisation representation.

getOrg

public static VCardHelper.Organisation getOrg(java.lang.String val)
s Create Organisation item from String containing VCArd organisation representation.

Parameters:
val - String containing VCard organisation.
Returns:
Organisation item generated.

parseCompanyFromOrganization

public static java.lang.String parseCompanyFromOrganization(java.lang.String value)
Parses the Company name from a VCard Organization String.

Parameters:
value - the VCard Organization String to parse
Returns:
the company name or null if not found

splitDepartmentsFromOrganization

public static java.lang.String splitDepartmentsFromOrganization(java.lang.String value)
Splits the VCard Organization value to return only the departments Note: it will return the ';' separated departments

Parameters:
value - the value to split
Returns:
the VCard departments or empty String if none

isEmptyVCardValue

public static boolean isEmptyVCardValue(java.lang.String value)
Tells whether or not the provided VCard value is empty. Note: a VCard value is empty if - null - "" empty String - ";;;" contains only ';'

Returns:
true if empty, false if not

getStringList

protected static void getStringList(java.util.List<java.lang.String> list,
                                    java.lang.String val)
Generate List array of items (as Strings) from single String using ListIterator.

Parameters:
list - List array to be populated
val - Single String containing items.


JavaDoc