ezvcard.property
Class ClientPidMap

java.lang.Object
  extended by ezvcard.property.VCardProperty
      extended by ezvcard.property.ClientPidMap
All Implemented Interfaces:
Comparable<VCardProperty>

public class ClientPidMap
extends VCardProperty

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

The CLIENTPIDMAP property 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.

Code sample

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

Property name: CLIENTPIDMAP

Supported versions: 4.0

Author:
Michael Angstadt

Field Summary
 
Fields inherited from class ezvcard.property.VCardProperty
group, parameters
 
Constructor Summary
ClientPidMap(Integer pid, String uri)
          Creates a client PID map property.
 
Method Summary
 Set<VCardVersion> _supportedVersions()
           Gets the vCard versions that support this property.
protected  void _validate(List<Warning> warnings, VCardVersion version, VCard vcard)
          Checks the property for data consistency problems or deviations from the spec.
 Integer getPid()
          Gets the value that is used to link the URI in this property to the property that the URI belongs to.
 String getUri()
          Gets the URI.
static ClientPidMap random(Integer 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.property.VCardProperty
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientPidMap

public ClientPidMap(Integer pid,
                    String uri)
Creates a client PID map property.

Parameters:
pid - the PID
uri - the globally unique URI
Method Detail

random

public static ClientPidMap random(Integer pid)
Generates a CLIENTPIDMAP type that contains a random UID URI.

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

_supportedVersions

public Set<VCardVersion> _supportedVersions()
Description copied from class: VCardProperty

Gets the vCard versions that support this property.

This method should be overridden by child classes if the property does not support all vCard versions. The default implementation of this method returns all vCard versions.

Overrides:
_supportedVersions in class VCardProperty
Returns:
the vCard versions that support this property.

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:
VCardParameters.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:
VCardParameters.getPids()

getUri

public String getUri()
Gets the URI.

Returns:
the URI

setUri

public void setUri(String uri)
Sets the URI.

Parameters:
uri - the URI

_validate

protected void _validate(List<Warning> warnings,
                         VCardVersion version,
                         VCard vcard)
Description copied from class: VCardProperty
Checks the property for data consistency problems or deviations from the spec. Meant to be overridden by child classes that wish to provide validation logic.

Overrides:
_validate in class VCardProperty
Parameters:
warnings - the list to add the warnings to
version - the version to check the property against
vcard - the vCard this property belongs to


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.