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.
This property, along with the PID parameter, is 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 = vcard.addEmail("johndoe@hotmail.com"); emai.addPid(1, 1); email = vcard.addEmail("jdoe@company.com"); email.addPid(2, 2); //specify the URI to use ClientPidMap clientpidmap = new ClientPidMap(1, "urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af"); vcard.addClientPidMap(clientpidmap); //or, generate a random URI clientpidmap = ClientPidMap.random(2); vcard.addClientPidMap(clientpidmap);
Property name: CLIENTPIDMAP
Supported versions: 4.0
group, parameters
Constructor and Description |
---|
ClientPidMap(java.lang.Integer pid,
java.lang.String uri)
Creates a client PID map property.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<VCardVersion> |
_supportedVersions()
Gets the vCard versions that support this property.
|
protected void |
_validate(java.util.List<Warning> warnings,
VCardVersion version,
VCard vcard)
Checks the property for data consistency problems or deviations from the
spec.
|
java.lang.Integer |
getPid()
Gets the value that is used to link the URI in this property to the
property that the URI belongs to.
|
java.lang.String |
getUri()
Gets the URI.
|
static ClientPidMap |
random(java.lang.Integer pid)
Generates a CLIENTPIDMAP type that contains a random UID URI.
|
void |
setPid(java.lang.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(java.lang.String uri)
Sets the URI.
|
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
public ClientPidMap(java.lang.Integer pid, java.lang.String uri)
pid
- the PIDuri
- the globally unique URIpublic static ClientPidMap random(java.lang.Integer pid)
pid
- the PIDpublic java.util.Set<VCardVersion> _supportedVersions()
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.
_supportedVersions
in class VCardProperty
public java.lang.Integer getPid()
VCardParameters.getPids()
public void setPid(java.lang.Integer pid)
pid
- the PIDVCardParameters.getPids()
public java.lang.String getUri()
public void setUri(java.lang.String uri)
uri
- the URIprotected void _validate(java.util.List<Warning> warnings, VCardVersion version, VCard vcard)
VCardProperty
_validate
in class VCardProperty
warnings
- the list to add the warnings toversion
- the version to check the property againstvcard
- the vCard this property belongs toThis software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.