ezvcard.types
Class ClientPidMapType

java.lang.Object
  extended by ezvcard.types.VCardType
      extended by ezvcard.types.ClientPidMapType
All Implemented Interfaces:
Comparable<VCardType>

public class ClientPidMapType
extends VCardType

Maps a globally-unique URI to a PID parameter value. The PID parameter can be set on any type where multiple instances are allowed (such as EMAIL or ADR, but not N because only 1 instance of N is allowed). It allows an individual type instance to be uniquely identifiable.

The CLIENTPIDMAP type and the PID parameter are used during the synchronization (merging) process of two versions of the same vCard. For example, if the user has a copy of her vCard on her desktop computer and her smart phone, and she makes different modifications to each copy, then the two copies could be synchronized in order to merge all the changes into a single, new vCard.

 VCard vcard = new VCard();
 
 AddressType adr = new AddressType();
 adr.addPid(1, 1);
 vcard.addAddress(adr);
 
 EmailType email = new EmailType("my-email@hotmail.com");
 emai.addPid(1, 1);
 vcard.addEmail(email);
 email = new EmailType("my-other-email@yahoo.com");
 emai.addPid(2, 2);
 vcard.addEmail(email);
 
 //specify the URI to use
 ClientPidMapType clientpidmap = new ClientPidMapType(1, "urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af");
 vcard.addClientPidMap(clientpidmap);
 
 //generate a random URI
 clientpidmap = ClientPidMapType.random(2);
 vcard.addClientPidMap(clientpidmap);
 

vCard property name: CLIENTPIDMAP

vCard versions: 4.0

Author:
Michael Angstadt

Field Summary
static String NAME
           
 
Fields inherited from class ezvcard.types.VCardType
group, subTypes, typeName
 
Constructor Summary
ClientPidMapType()
           
ClientPidMapType(int pid, String uri)
           
 
Method Summary
protected  void doMarshalText(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
          Converts this type object to a string for sending over the wire.
protected  void doMarshalXml(XCardElement parent, List<String> warnings, CompatibilityMode compatibilityMode)
          Marshals this type for inclusion in an xCard (XML document).
protected  void doUnmarshalText(String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
          Unmarshals the type value from off the wire.
protected  void doUnmarshalXml(XCardElement element, List<String> warnings, CompatibilityMode compatibilityMode)
          Unmarshals the type from an xCard (XML document).
 Integer getPid()
          Gets the value that is used to link the URI in this property to the property that the URI belongs to.
 VCardVersion[] getSupportedVersions()
          Gets the vCard versions that support this type.
 String getUri()
          Gets the URI.
static ClientPidMapType random(int pid)
          Generates a CLIENTPIDMAP type that contains a random UID URI.
 void setPid(Integer pid)
          Gets the value that is used to link the URI in this property to the property that the URI belongs to.
 void setUri(String uri)
          Sets the URI.
 
Methods inherited from class ezvcard.types.VCardType
compareTo, doMarshalSubTypes, doUnmarshalHtml, getGroup, getQName, getSubTypes, getTypeName, marshalSubTypes, marshalText, marshalXml, setGroup, unmarshalHtml, unmarshalText, unmarshalXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

ClientPidMapType

public ClientPidMapType()

ClientPidMapType

public ClientPidMapType(int pid,
                        String uri)
Parameters:
pid - the PID
uri - the globally unique URI
Method Detail

random

public static ClientPidMapType random(int pid)
Generates a CLIENTPIDMAP type that contains a random UID URI.

Parameters:
pid - the PID
Returns:
a CLIENTPIDMAP type with a random UID URI

getPid

public Integer getPid()
Gets the value that is used to link the URI in this property to the property that the URI belongs to.

Returns:
the PID
See Also:
VCardSubTypes.getPids()

setPid

public void setPid(Integer pid)
Gets the value that is used to link the URI in this property to the property that the URI belongs to.

Parameters:
pid - the PID
See Also:
VCardSubTypes.getPids()

getUri

public String getUri()
Gets the URI.

Returns:
the URI

setUri

public void setUri(String uri)
Sets the URI.

Parameters:
uri - the URI

getSupportedVersions

public VCardVersion[] getSupportedVersions()
Description copied from class: VCardType
Gets the vCard versions that support this type.

Overrides:
getSupportedVersions in class VCardType
Returns:
the vCard versions that support this type.

doMarshalText

protected void doMarshalText(StringBuilder sb,
                             VCardVersion version,
                             List<String> warnings,
                             CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Converts this type object to a string for sending over the wire. It is NOT responsible for folding.

Specified by:
doMarshalText in class VCardType
Parameters:
sb - the buffer to add the marshalled value to
version - the version vCard that is being generated
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the marshalling process
compatibilityMode - allows the programmer to customize the marshalling process depending on the expected consumer of the vCard

doUnmarshalText

protected void doUnmarshalText(String value,
                               VCardVersion version,
                               List<String> warnings,
                               CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Unmarshals the type value from off the wire.

Specified by:
doUnmarshalText in class VCardType
Parameters:
value - the unfolded value from off the wire. If the wire value is in the "quoted-printable" encoding, it will be decoded.
version - the version of the vCard that is being read or null if the VERSION type has not been parsed yet (v3.0 and v4.0 require that the VERSION type be at the top of the vCard, but v2.1 has no such requirement)
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the unmarshalling process
compatibilityMode - allows you to customize the unmarshalling process depending on where the vCard came from

doMarshalXml

protected void doMarshalXml(XCardElement parent,
                            List<String> warnings,
                            CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Marshals this type for inclusion in an xCard (XML document). All child classes SHOULD override this, but are not required to.

Overrides:
doMarshalXml in class VCardType
Parameters:
parent - the XML element that the type's value will be inserted into. For example, this would be the "<fn>" element for the "FN" type.
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the marshalling process
compatibilityMode - allows the programmer to customize the marshalling process depending on the expected consumer of the vCard

doUnmarshalXml

protected void doUnmarshalXml(XCardElement element,
                              List<String> warnings,
                              CompatibilityMode compatibilityMode)
Description copied from class: VCardType
Unmarshals the type from an xCard (XML document).

Overrides:
doUnmarshalXml in class VCardType
Parameters:
element - the XML element that contains the type data. For example, this would be the "<fn>" element for the "FN" type. This object will NOT include the "<parameters>" child element (it is removed after being unmarshalled into a VCardSubTypes object).
warnings - allows the programmer to alert the user to any note-worthy (but non-critical) issues that occurred during the unmarshalling process
compatibilityMode - allows the programmer to customize the unmarshalling process depending on where the vCard came from


Copyright © 2012-2013. All Rights Reserved.