Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.contactsource
Class ContactDetail

java.lang.Object
  extended by net.java.sip.communicator.service.contactsource.ContactDetail

public class ContactDetail
extends Object

The ContactDetail is a detail of a SourceContact corresponding to a specific address (phone number, email, identifier, etc.), which defines the different possible types of communication and the preferred ProtocolProviderServices to go through.

Example: A ContactDetail could define two types of communication, by declaring two supported operation sets OperationSetBasicInstantMessaging to indicate the support of instant messages and OperationSetBasicTelephony to indicate the support of telephony. It may then specify a certain ProtocolProviderService to go through only for instant messages. This would mean that for sending an instant message to this ContactDetail one should obtain an instance of the OperationSetBasicInstantMessaging from the specific ProtocolProviderService and send a message through it. However when no provider is specified for telephony operations, then one should try to obtain all currently available telephony providers and let the user make their choice.

Author:
Yana Stamcheva, Lyubomir Marinov

Field Summary
static String CATEGORY_EMAIL
          The standard/well-known category of a ContactDetail representing an e-mail address.
static String CATEGORY_INSTANT_MESSAGING
          The standard/well-known category of a ContactDetail representing a contact address for instant messaging.
static String CATEGORY_PHONE
          The standard/well-known category of a ContactDetail representing a phone number.
static String LABEL_HOME
          The standard/well-known label of a ContactDetail representing an address of a contact at their home.
static String LABEL_MOBILE
          The standard/well-known label of a ContactDetail representing a mobile contact address (e.g.
static String LABEL_WORK
          The standard/well-known label of a ContactDetail representing an address of a contact at their work.
 
Constructor Summary
ContactDetail(String contactAddress)
          Creates a ContactDetail by specifying the contact address, corresponding to this detail.
ContactDetail(String contactAddress, String[] labels)
          Initializes a new ContactDetail instance which is to represent a specific contact address and which is to be optionally labeled with a specific set of labels.
ContactDetail(String contactAddress, String category, String[] labels)
          Initializes a new ContactDetail instance which is to represent a specific contact address and which is to be optionally labeled with a specific category and a specific set of labels.
 
Method Summary
 boolean containsLabel(String label)
          Determines whether the set of labels of this ContactDetail contains a specific label.
 String getCategory()
          Gets the category, if any, of this ContactQuery.
 String getContactAddress()
          Returns the contact address corresponding to this detail.
 Collection<String> getLabels()
          Gets the set of labels of this ContactDetail.
 String getPreferredProtocol(Class<? extends OperationSet> opSetClass)
          Returns the name of the preferred protocol for the operation given by the opSetClass.
 ProtocolProviderService getPreferredProtocolProvider(Class<? extends OperationSet> opSetClass)
          Returns the preferred ProtocolProviderService when using the given opSetClass.
 List<Class<? extends OperationSet>> getSupportedOperationSets()
          Returns a list of all supported OperationSet classes, which would indicate what are the supported actions by this contact (e.g.
 void setPreferredProtocols(Map<Class<? extends OperationSet>,String> preferredProtocols)
          Sets a mapping of a preferred preferredProtocol for a specific OperationSet.
 void setPreferredProviders(Map<Class<? extends OperationSet>,ProtocolProviderService> preferredProviders)
          Sets a mapping of preferred ProtocolProviderServices for a specific OperationSet.
 void setSupportedOpSets(List<Class<? extends OperationSet>> supportedOpSets)
          Creates a ContactDetail by specifying the corresponding contact address and a list of all supportedOpSets, indicating what are the supporting actions with this contact detail (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_EMAIL

public static final String CATEGORY_EMAIL
The standard/well-known category of a ContactDetail representing an e-mail address.

See Also:
Constant Field Values

CATEGORY_INSTANT_MESSAGING

public static final String CATEGORY_INSTANT_MESSAGING
The standard/well-known category of a ContactDetail representing a contact address for instant messaging.

See Also:
Constant Field Values

CATEGORY_PHONE

public static final String CATEGORY_PHONE
The standard/well-known category of a ContactDetail representing a phone number.

See Also:
Constant Field Values

LABEL_HOME

public static final String LABEL_HOME
The standard/well-known label of a ContactDetail representing an address of a contact at their home.

See Also:
Constant Field Values

LABEL_MOBILE

public static final String LABEL_MOBILE
The standard/well-known label of a ContactDetail representing a mobile contact address (e.g. a cell phone number).

See Also:
Constant Field Values

LABEL_WORK

public static final String LABEL_WORK
The standard/well-known label of a ContactDetail representing an address of a contact at their work.

See Also:
Constant Field Values
Constructor Detail

ContactDetail

public ContactDetail(String contactAddress)
Creates a ContactDetail by specifying the contact address, corresponding to this detail.

Parameters:
contactAddress - the contact address corresponding to this detail

ContactDetail

public ContactDetail(String contactAddress,
                     String[] labels)
Initializes a new ContactDetail instance which is to represent a specific contact address and which is to be optionally labeled with a specific set of labels.

Parameters:
contactAddress - the contact address to be represented by the new ContactDetail instance
labels - the set of labels with which the new ContactDetail instance is to be labeled. The labels may be arbitrary and may include any of the standard/well-known labels defined by the LABEL_XXX constants of the ContactDetail class. For the sake of convenience, null and duplicate values in the specified String[] labels will be ignored i.e. will not appear in the set of labels reported by the new ContactDetail instance later on. Additionally, the category of the new ContactDetail instance will be implied from the specified labels by looking for the standard/well-known categories defined by the CATEGORY_XXX constants of the ContactDetail class

ContactDetail

public ContactDetail(String contactAddress,
                     String category,
                     String[] labels)
Initializes a new ContactDetail instance which is to represent a specific contact address and which is to be optionally labeled with a specific category and a specific set of labels.

Parameters:
contactAddress - the contact address to be represented by the new ContactDetail instance
category - the category (such as one of the CATEGORY_XXX constants defined by the ContactDetail class, for example) to be assigned to the new ContactDetail instance
labels - the set of labels with which the new ContactDetail instance is to be labeled. The labels may be arbitrary and may include any of the standard/well-known labels defined by the LABEL_XXX constants of the ContactDetail class. For the sake of convenience, null and duplicate values in the specified String[] labels will be ignored i.e. will not appear in the set of labels reported by the new ContactDetail instance later on.
Method Detail

setPreferredProviders

public void setPreferredProviders(Map<Class<? extends OperationSet>,ProtocolProviderService> preferredProviders)
Sets a mapping of preferred ProtocolProviderServices for a specific OperationSet.

Parameters:
preferredProviders - a mapping of preferred ProtocolProviderServices for specific OperationSet classes

setPreferredProtocols

public void setPreferredProtocols(Map<Class<? extends OperationSet>,String> preferredProtocols)
Sets a mapping of a preferred preferredProtocol for a specific OperationSet. The preferred protocols are meant to be set by contact source implementations that don't have a specific protocol providers to suggest, but are able to propose just the name of the protocol to be used for a specific operation. If both - preferred provider and preferred protocol are set, then the preferred protocol provider should be prioritized.

Parameters:
preferredProtocols - a mapping of preferred ProtocolProviderServices for specific OperationSet classes

setSupportedOpSets

public void setSupportedOpSets(List<Class<? extends OperationSet>> supportedOpSets)
Creates a ContactDetail by specifying the corresponding contact address and a list of all supportedOpSets, indicating what are the supporting actions with this contact detail (e.g. sending a message, making a call, etc.)

Parameters:
supportedOpSets - a list of all supportedOpSets, indicating what are the supporting actions with this contact detail (e.g. sending a message, making a call, etc.)

getCategory

public String getCategory()
Gets the category, if any, of this ContactQuery. For example, CATEGORY_PHONE or CATEGORY_EMAIL.

Returns:
the category of this ContactQuery if it has any; otherwise, null

getContactAddress

public String getContactAddress()
Returns the contact address corresponding to this detail.

Returns:
the contact address corresponding to this detail

getPreferredProtocolProvider

public ProtocolProviderService getPreferredProtocolProvider(Class<? extends OperationSet> opSetClass)
Returns the preferred ProtocolProviderService when using the given opSetClass.

Parameters:
opSetClass - the OperationSet class corresponding to a certain action (e.g. sending an instant message, making a call, etc.).
Returns:
the preferred ProtocolProviderService corresponding to the given opSetClass

getPreferredProtocol

public String getPreferredProtocol(Class<? extends OperationSet> opSetClass)
Returns the name of the preferred protocol for the operation given by the opSetClass. The preferred protocols are meant to be set by contact source implementations that don't have a specific protocol providers to suggest, but are able to propose just the name of the protocol to be used for a specific operation. If both - preferred provider and preferred protocol are set, then the preferred protocol provider should be prioritized.

Parameters:
opSetClass - the OperationSet class corresponding to a certain action (e.g. sending an instant message, making a call, etc.).
Returns:
the name of the preferred protocol for the operation given by the opSetClass

getSupportedOperationSets

public List<Class<? extends OperationSet>> getSupportedOperationSets()
Returns a list of all supported OperationSet classes, which would indicate what are the supported actions by this contact (e.g. write a message, make a call, etc.)

Returns:
a list of all supported OperationSet classes

containsLabel

public boolean containsLabel(String label)
Determines whether the set of labels of this ContactDetail contains a specific label. The labels may be arbitrary and may include any of the standard/well-known labels defined by the LABEL_XXX constants of the ContactDetail class.

Parameters:
label - the label to be determined whether it is contained in the set of labels of this ContactDetail
Returns:
true if the specified label is contained in the set of labels of this ContactDetail

getLabels

public Collection<String> getLabels()
Gets the set of labels of this ContactDetail. The labels may be arbitrary and may include any of the standard/well-known labels defined by the LABEL_XXX constants of the ContactDetail class.

Returns:
the set of labels of this ContactDetail. If this ContactDetail has no labels, the returned Collection is empty.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.