|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.contactlist.MetaContactImpl
public class MetaContactImpl
A default implementation of the MetaContact interface.
| Constructor Summary | |
|---|---|
MetaContactImpl()
Creates new meta contact with a newly generated meta contact UID. |
|
MetaContactImpl(String metaUID,
Map<String,List<String>> details)
Creates a new meta contact with the specified UID. |
|
| Method Summary | |
|---|---|
void |
addDetail(String name,
String value)
Adds a custom detail to this contact. |
(package private) void |
addProtoContact(Contact contact)
Adds the specified protocol specific contact to the list of contacts merged in this meta contact. |
void |
cacheAvatar(Contact protoContact,
byte[] avatarBytes)
Stores avatar bytes in the given Contact. |
void |
changeDetail(String name,
String oldValue,
String newValue)
Change the detail. |
int |
compareTo(MetaContact o)
Compares this meta contact with the specified object for order. |
boolean |
containsContact(Contact protocolContact)
Returns true if the given protocolContact is contained in this MetaContact, otherwise - returns false. |
byte[] |
getAvatar()
Returns an avatar that can be used when presenting this MetaContact in user interface. |
byte[] |
getAvatar(boolean isLazy)
Returns the avatar of this contact, that can be used when including this MetaContact in user interface. |
Contact |
getContact(String contactAddress,
ProtocolProviderService ownerProvider)
Returns a contact encapsulated by this meta contact, having the specified contactAddress and coming from the indicated ownerProvider. |
Contact |
getContact(String contactAddress,
String accountID)
Returns a contact encapsulated by this meta contact, having the specified contactAddress and coming from a provider with a mathing accountID. |
int |
getContactCount()
Returns the number of protocol specific Contacts that this MetaContact contains. |
Iterator<Contact> |
getContacts()
Returns a java.util.Iterator over all protocol specific Contacts encapsulated by this MetaContact. |
Iterator<Contact> |
getContactsForContactGroup(ContactGroup parentProtoGroup)
Returns contacts, encapsulated by this MetaContact and belonging to the specified protocol ContactGroup. |
List<Contact> |
getContactsForOperationSet(Class<? extends OperationSet> opSetClass)
Returns all protocol specific Contacts, encapsulated by this MetaContact and supporting the given opSetClass. |
Iterator<Contact> |
getContactsForProvider(ProtocolProviderService provider)
Returns a Contact, encapsulated by this MetaContact and coming from the specified ProtocolProviderService. |
Object |
getData(Object key)
Implements MetaContact.getData(Object). |
Contact |
getDefaultContact()
Currently simply returns the most connected protocol contact. |
Contact |
getDefaultContact(Class<? extends OperationSet> operationSet)
Returns a default contact for a specific operation (call, file transfer, IM ...) |
List<String> |
getDetails(String name)
Gets all details with a given name. |
String |
getDisplayName()
Returns a characteristic display name that can be used when including this MetaContact in user interface. |
String |
getMetaUID()
Returns a String identifier (the actual contents is left to implementations) that uniquely represents this MetaContact in the containing MetaContactList |
(package private) MetaContactGroupImpl |
getParentGroup()
Returns the group that is currently holding this meta contact. |
MetaContactGroup |
getParentMetaContactGroup()
Returns the MetaContactGroup currently containing this meta contact |
(package private) boolean |
isDisplayNameUserDefined()
Determines if display name was changed for this MetaContact in user interface. |
(package private) int |
reevalContact()
Called by MetaContactListServiceImpl after a contact has changed its status, so that ordering in the parent group is updated. |
(package private) boolean |
removeContactsForGroup(ContactGroup protoGroup)
Removes all proto contacts that belong to the specified protocol group. |
(package private) boolean |
removeContactsForProvider(ProtocolProviderService provider)
Removes all proto contacts that belong to the specified provider. |
void |
removeDetail(String name,
String value)
Remove the given detail. |
void |
removeDetails(String name)
Remove all details with given name. |
(package private) void |
removeProtoContact(Contact contact)
Removes the specified protocol specific contact from the contacts encapsulated in this MetaContact. |
void |
setData(Object key,
Object value)
Implements MetaContact.setData(Object, Object). |
(package private) void |
setDisplayName(String displayName)
Sets a name that can be used when displaying this contact in user interface components. |
(package private) void |
setDisplayNameUserDefined(boolean value)
Changes that display name was changed for this MetaContact in user interface. |
(package private) void |
setParentGroup(MetaContactGroupImpl parentGroup)
Sets parentGroup as a parent of this meta contact. |
String |
toString()
Returns a string representation of this contact, containing most of its representative details. |
(package private) void |
unsetParentGroup(MetaContactGroupImpl parentGrp)
If parentGroup was the parent of this meta contact then it sets it to null. |
void |
updateCapabilities(Contact contact,
Map<String,? extends OperationSet> opSets)
Updates the capabilities for the given contact. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
MetaContactImpl()
MetaContactImpl(String metaUID,
Map<String,List<String>> details)
metaUID - the meta uid that this meta contact should have.details - the already stored details for the contact.| Method Detail |
|---|
public int getContactCount()
getContactCount in interface MetaContactpublic Iterator<Contact> getContactsForProvider(ProtocolProviderService provider)
In order to prevent problems with concurrency, the Iterator returned by this method is not be over the actual list of contacts but over a copy of that list.
getContactsForProvider in interface MetaContactprovider - a reference to the ProtocolProviderService
that we'd like to get a Contact for.
public List<Contact> getContactsForOperationSet(Class<? extends OperationSet> opSetClass)
getContactsForOperationSet in interface MetaContactopSetClass - the operation for which the default contact is needed
public Iterator<Contact> getContactsForContactGroup(ContactGroup parentProtoGroup)
In order to prevent problems with concurrency, the Iterator returned by this method is not be over the actual list of contacts but over a copy of that list.
parentProtoGroup - a reference to the ContactGroup
whose children we'd like removed..
public Contact getContact(String contactAddress,
ProtocolProviderService ownerProvider)
getContact in interface MetaContactcontactAddress - the address of the contact who we're looking for.ownerProvider - a reference to the ProtocolProviderService that
the contact we're looking for belongs to.
public Contact getContact(String contactAddress,
String accountID)
contactAddress - the address of the contact who we're looking for.accountID - the identifier of the provider that the contact we're
looking for must belong to.
public boolean containsContact(Contact protocolContact)
containsContact in interface MetaContactprotocolContact - the Contact we're looking for
public Iterator<Contact> getContacts()
In order to prevent problems with concurrency, the Iterator returned by this method is not over the actual list of contacts but over a copy of that list.
getContacts in interface MetaContactpublic Contact getDefaultContact()
getDefaultContact in interface MetaContactpublic Contact getDefaultContact(Class<? extends OperationSet> operationSet)
getDefaultContact in interface MetaContactoperationSet - the operation for which the default contact is needed
public String getMetaUID()
getMetaUID in interface MetaContactpublic int compareTo(MetaContact o)
The result of this method is calculated the following way:
(contactsOnline - o.contactsOnline) * 1 000 000
+ getDisplayName().compareTo(o.getDisplayName()) * 100 000
+ getMetaUID().compareTo(o.getMetaUID())
Or in other words ordering of meta accounts would be first done by presence status, then display name, and finally (in order to avoid equalities) be the fairly random meta contact metaUID.
compareTo in interface Comparable<MetaContact>o - the MetaContact to be compared.
ClassCastException - if the specified object is not
a MetaContactListImplpublic String toString()
toString in interface MetaContacttoString in class Objectpublic String getDisplayName()
getDisplayName in interface MetaContactboolean isDisplayNameUserDefined()
void setDisplayNameUserDefined(boolean value)
value - control whether display name is user definedpublic byte[] getAvatar(boolean isLazy)
getAvatar in interface MetaContactisLazy - Indicates if this method should return the locally stored
avatar or it should obtain the avatar right from the server.
public byte[] getAvatar()
getAvatar in interface MetaContactvoid setDisplayName(String displayName)
displayName - a human readable String representing this
MetaContactvoid addProtoContact(Contact contact)
contact - the protocol specific Contact to add.int reevalContact()
void removeProtoContact(Contact contact)
MetaContact. The method also updates
the total status field accordingly. And updates its ordered position
in its parent group. If the display name of this MetaContact
was the one of the removed contact, we update it.
contact - the contact to removeboolean removeContactsForProvider(ProtocolProviderService provider)
provider - the provider whose contacts we want removed.
boolean removeContactsForGroup(ContactGroup protoGroup)
protoGroup - the group whose children we want removed.
void setParentGroup(MetaContactGroupImpl parentGroup)
parentGroup - the MetaContactGroupImpl that is currently a
parent of this meta contact.
NullPointerException - if parentGroup is null.void unsetParentGroup(MetaContactGroupImpl parentGrp)
parentGrp - the MetaContactGroupImpl that we don't want
considered as a parent of this contact any more.MetaContactGroupImpl getParentGroup()
public MetaContactGroup getParentMetaContactGroup()
getParentMetaContactGroup in interface MetaContact
public void addDetail(String name,
String value)
addDetail in interface MetaContactname - name of the detail.value - the value of the detail.
public void removeDetail(String name,
String value)
removeDetail in interface MetaContactname - of the detail to be removed.value - value of the detail to be removed.public void removeDetails(String name)
removeDetails in interface MetaContactname - of the details to be removed.
public void changeDetail(String name,
String oldValue,
String newValue)
changeDetail in interface MetaContactname - of the detail to be changed.oldValue - the old value of the detail.newValue - the new value of the detail.public List<String> getDetails(String name)
getDetails in interface MetaContactname - the name of the details we are searching for
public void cacheAvatar(Contact protoContact,
byte[] avatarBytes)
protoContact - The contact in which we store the avatar.avatarBytes - The avatar image bytes.public Object getData(Object key)
MetaContact.getData(Object). Gets the user data
associated with this instance and a specific key.
getData in interface MetaContactkey - the key of the user data associated with this instance to be
retrieved
MetaContact.getData(Object)
public void setData(Object key,
Object value)
MetaContact.setData(Object, Object). Sets a
user-specific association in this instance in the form of a key-value
pair. If the specified key is already associated in this
instance with a value, the existing value is overwritten with the
specified value.
The user-defined association created by this method and stored in this instance is not serialized by this instance and is thus only meant for runtime use.
The storage of the user data is implementation-specific and is thus not guaranteed to be optimized for execution time and memory use.
setData in interface MetaContactkey - the key to associate in this instance with the specified valuevalue - the value to be associated in this instance with the
specified keyMetaContact.setData(Object, Object)
public void updateCapabilities(Contact contact,
Map<String,? extends OperationSet> opSets)
contact - the Contact, which capabilities have changedopSets - the new updated set of operation sets
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||