public class MetaContactGroupImpl extends java.lang.Object implements MetaContactGroup
Constructor and Description |
---|
MetaContactGroupImpl(MetaContactListServiceImpl mclServiceImpl,
java.lang.String groupName)
Creates an instance of the root meta contact group.
|
MetaContactGroupImpl(MetaContactListServiceImpl mclServiceImpl,
java.lang.String groupName,
java.lang.String metaUID)
Creates an instance of the root meta contact group assigning it the
specified meta contact uid.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addMetaContact(MetaContactImpl metaContact)
Adds the specified metaContact to ths local list of child
contacts.
|
(package private) void |
addProtoGroup(ContactGroup protoGroup)
Adds the specified group to the list of protocol specific groups
that we're encapsulating in this meta contact group.
|
(package private) void |
addSubgroup(MetaContactGroup subgroup)
Adds the specified meta group to the subgroups of this one.
|
boolean |
canContainSubgroups()
Determines whether or not this group can contain subgroups.
|
int |
compareTo(MetaContactGroup target)
Compares this meta contact group with the specified object for order.
|
boolean |
contains(MetaContact contact)
Returns true if and only if contact is a direct child of this
group.
|
boolean |
contains(MetaContactGroup group)
Returns true if and only if group is a direct subgroup of this
MetaContactGroup.
|
int |
countChildContacts()
Returns the number of MetaContacts that this group contains.
|
int |
countContactGroups()
Returns the number of ContactGroupss that this group
encapsulates
|
int |
countOnlineChildContacts()
Returns the number of online MetaContacts that this group
contains.
|
int |
countSubgroups()
Returns the number of subgroups that this MetaContactGroup
contains.
|
MetaContact |
findMetaContactByContact(Contact protoContact)
Returns a meta contact, a child of this group or its subgroups, that
has the specified protocol specific contact.
|
MetaContact |
findMetaContactByContact(java.lang.String contactAddress,
java.lang.String accountID)
Returns a meta contact, a child of this group or its subgroups, with
address equald to contactAddress and a source protocol provider
with the matching accountID.
|
MetaContact |
findMetaContactByMetaUID(java.lang.String metaUID)
Returns a meta contact, a child of this group or its subgroups, that
has the specified metaUID.
|
MetaContactGroupImpl |
findMetaContactGroupByContactGroup(ContactGroup protoContactGroup)
Returns a meta contact group, encapsulated by this group or its
subgroups, that has the specified protocol specific contact.
|
MetaContactGroup |
findMetaContactGroupByMetaUID(java.lang.String metaUID)
Returns a meta contact group this group or some of its subgroups,
that has the specified metaUID.
|
java.util.Iterator<MetaContact> |
getChildContacts()
Returns a java.util.Iterator over the MetaContacts
contained in this MetaContactGroup.
|
ContactGroup |
getContactGroup(java.lang.String grpName,
ProtocolProviderService ownerProvider)
Returns a contact group encapsulated by this meta contact group, having
the specified groupName and coming from the indicated ownerProvider.
|
java.util.Iterator<ContactGroup> |
getContactGroups()
Returns an iterator over all the protocol specific groups that this
contact group represents.
|
java.util.Iterator<ContactGroup> |
getContactGroupsForAccountID(java.lang.String accountID)
Returns all protocol specific ContactGroups, encapsulated by this
MetaContactGroup and coming from the provider matching the
accountID param.
|
java.util.Iterator<ContactGroup> |
getContactGroupsForProvider(ProtocolProviderService provider)
Returns all protocol specific ContactGroups, encapsulated by this
MetaContactGroup and coming from the indicated ProtocolProviderService.
|
java.lang.Object |
getData(java.lang.Object key)
Implements
MetaContactGroup.getData(Object) . |
java.lang.String |
getGroupName()
Returns the name of this group.
|
(package private) MetaContactListServiceImpl |
getMclServiceImpl()
Returns the implementation of the MetaContactListService, to
which this group belongs.
|
MetaContact |
getMetaContact(int index)
Returns the meta contact on the specified index.
|
MetaContact |
getMetaContact(ProtocolProviderService provider,
java.lang.String contactID)
Returns the meta contact encapsulating a contact belonging to the
specified provider with the specified identifier.
|
MetaContact |
getMetaContact(java.lang.String metaContactID)
Returns the contact with the specified identifier
|
MetaContactGroup |
getMetaContactSubgroup(int index)
Returns the MetaContactGroup with the specified index.
|
MetaContactGroup |
getMetaContactSubgroup(java.lang.String grpName)
Returns the MetaContactGroup with the specified name.
|
MetaContactGroup |
getMetaContactSubgroupByUID(java.lang.String grpUID)
Returns the MetaContactGroup with the specified groupUID.
|
java.lang.String |
getMetaUID()
Returns a String identifier (the actual contents is left to
implementations) that uniquely represents this MetaContact in
the containing MetaContactList
|
MetaContactGroup |
getParentMetaContactGroup()
Returns the MetaContactGroup currently containing this group or null if
this is the root group
|
java.util.Iterator<MetaContactGroup> |
getSubgroups()
Returns an java.util.Iterator over the sub groups that this
MetaContactGroup contains.
|
int |
indexOf(MetaContact metaContact)
Returns the index of metaContact according to other contacts in this or
-1 if metaContact does not belong to this group.
|
int |
indexOf(MetaContactGroup metaContactGroup)
Returns the index of metaContactGroup in relation to other subgroups in
this group or -1 if metaContact does not belong to this group.
|
boolean |
isPersistent()
Determines whether or not this meta group contains only groups that are
being stored by a server.
|
(package private) int |
lightAddMetaContact(MetaContactImpl metaContact)
Adds the metaContact to the local list of child
contacts without setting its parent contact and without any
synchronization.
|
(package private) void |
lightRemoveMetaContact(MetaContactImpl metaContact)
Removes the metaContact from the local list of child
contacts without unsetting its parent contact and without any
synchronization.
|
(package private) void |
removeMetaContact(MetaContactImpl metaContact)
Removes the specified metaContact from the local list of
contacts.
|
(package private) void |
removeProtoGroup(ContactGroup protoGroup)
Removes the specified group from the list of protocol specific groups
that we're encapsulating in this meta contact group.
|
(package private) MetaContactGroupImpl |
removeSubgroup(int index)
Removes the meta contact group with the specified index.
|
(package private) boolean |
removeSubgroup(MetaContactGroup group)
Removes the specified group from the list of groups in this list.
|
void |
setData(java.lang.Object key,
java.lang.Object value)
Implements
MetaContactGroup.setData(Object, Object) . |
(package private) void |
setGroupName(java.lang.String newGroupName)
Sets the name of this group.
|
java.lang.String |
toString()
Returns a String representation of this group and the contacts it
contains (may turn out to be a relatively long string).
|
MetaContactGroupImpl(MetaContactListServiceImpl mclServiceImpl, java.lang.String groupName)
mclServiceImpl
- the MetaContactListService implementation
which is to use the new MetaContactGroup instance as its rootgroupName
- the name of the group to createMetaContactGroupImpl(MetaContactListServiceImpl mclServiceImpl, java.lang.String groupName, java.lang.String metaUID)
mclServiceImpl
- the implementation of the
MetaContactListService, to which this group belongsgroupName
- the name of the group to createmetaUID
- a UID that has been stored earlier or null when a new
UID needs to be created.public java.lang.String getMetaUID()
getMetaUID
in interface MetaContactGroup
public MetaContactGroup getParentMetaContactGroup()
getParentMetaContactGroup
in interface MetaContactGroup
public boolean canContainSubgroups()
canContainSubgroups
in interface MetaContactGroup
public int countChildContacts()
countChildContacts
in interface MetaContactGroup
public int countOnlineChildContacts()
countOnlineChildContacts
in interface MetaContactGroup
public int countContactGroups()
countContactGroups
in interface MetaContactGroup
public int countSubgroups()
countSubgroups
in interface MetaContactGroup
public java.util.Iterator<MetaContact> getChildContacts()
In order to prevent problems with concurrency, the Iterator returned by this method is not over the actual list of groups but over a copy of that list.
getChildContacts
in interface MetaContactGroup
public MetaContact getMetaContact(java.lang.String metaContactID)
getMetaContact
in interface MetaContactGroup
metaContactID
- a String identifier obtained through the
MetaContact.getMetaUID() method. public int indexOf(MetaContact metaContact)
indexOf
in interface MetaContactGroup
metaContact
- the MetaContact whose index we're looking
for.public int indexOf(MetaContactGroup metaContactGroup)
indexOf
in interface MetaContactGroup
metaContactGroup
- the MetaContactGroup whose index we're
looking for.public MetaContact getMetaContact(ProtocolProviderService provider, java.lang.String contactID)
getMetaContact
in interface MetaContactGroup
provider
- the ProtocolProviderService that the specified
contactID is pertaining to.contactID
- a String identifier of the protocol specific contact
whose container meta contact we're looking for.public MetaContact findMetaContactByMetaUID(java.lang.String metaUID)
metaUID
- the Meta UID of the contact we're looking for.public MetaContactGroup findMetaContactGroupByMetaUID(java.lang.String metaUID)
metaUID
- the Meta UID of the contact group we're looking for.public java.util.Iterator<ContactGroup> getContactGroups()
In order to prevent problems with concurrency, the Iterator returned by this method is not over the actual list of groups but over a copy of that list.
getContactGroups
in interface MetaContactGroup
public ContactGroup getContactGroup(java.lang.String grpName, ProtocolProviderService ownerProvider)
getContactGroup
in interface MetaContactGroup
grpName
- the name of the contact group who we're looking for.ownerProvider
- a reference to the ProtocolProviderService that
the contact we're looking for belongs to.public java.util.Iterator<ContactGroup> getContactGroupsForProvider(ProtocolProviderService provider)
getContactGroupsForProvider
in interface MetaContactGroup
provider
- a reference to the ProtocolProviderService
whose ContactGroups we'd like to get.public java.util.Iterator<ContactGroup> getContactGroupsForAccountID(java.lang.String accountID)
Note to implementers: In order to prevent problems with concurrency, the Iterator returned by this method should not be over the actual list of groups but rather over a copy of that list.
getContactGroupsForAccountID
in interface MetaContactGroup
accountID
- the id of the account whose contact groups we'd like to
retrieve.public MetaContact findMetaContactByContact(Contact protoContact)
protoContact
- the protocol specific contact whos meta contact we're
looking for.public MetaContact findMetaContactByContact(java.lang.String contactAddress, java.lang.String accountID)
contactAddress
- the address of the protocol specific contact whose
meta contact we're looking for.accountID
- the ID of the account that the contact we are looking
for must belong to.public MetaContactGroupImpl findMetaContactGroupByContactGroup(ContactGroup protoContactGroup)
protoContactGroup
- the protocol specific contact group whose meta
contact group we're looking for.public MetaContact getMetaContact(int index) throws java.lang.IndexOutOfBoundsException
getMetaContact
in interface MetaContactGroup
index
- the index of the meta contact to return.java.lang.IndexOutOfBoundsException
- in case index is not a
valid index for this group.void addMetaContact(MetaContactImpl metaContact)
metaContact
- the MetaContact to add in the local vector.int lightAddMetaContact(MetaContactImpl metaContact)
metaContact
- the MetaContact to add in the local vector.void lightRemoveMetaContact(MetaContactImpl metaContact)
metaContact
- the MetaContact to remove from the local
vector.void removeMetaContact(MetaContactImpl metaContact)
metaContact
- the MetaContactpublic MetaContactGroup getMetaContactSubgroup(int index) throws java.lang.IndexOutOfBoundsException
getMetaContactSubgroup
in interface MetaContactGroup
index
- the index of the group to return.java.lang.IndexOutOfBoundsException
- if index is not a valid
index.public MetaContactGroup getMetaContactSubgroup(java.lang.String grpName)
getMetaContactSubgroup
in interface MetaContactGroup
grpName
- the name of the group to return.public MetaContactGroup getMetaContactSubgroupByUID(java.lang.String grpUID)
grpUID
- the uid of the group to return.public boolean contains(MetaContact contact)
contains
in interface MetaContactGroup
contact
- the MetaContact whose relation to this group
we'd like to determine.public boolean contains(MetaContactGroup group)
contains
in interface MetaContactGroup
group
- the MetaContactGroup whose relation to this group
we'd like to determine.public java.util.Iterator<MetaContactGroup> getSubgroups()
In order to prevent problems with concurrency, the Iterator returned by this method is not over the actual list of groups but over a copy of that list.
getSubgroups
in interface MetaContactGroup
public java.lang.String getGroupName()
getGroupName
in interface MetaContactGroup
void setGroupName(java.lang.String newGroupName)
newGroupName
- a String containing the new name of this group.public java.lang.String toString()
toString
in interface MetaContactGroup
toString
in class java.lang.Object
void addProtoGroup(ContactGroup protoGroup)
protoGroup
- the root to add to the groups merged in this meta contact
group.void removeProtoGroup(ContactGroup protoGroup)
protoGroup
- the group to remove from the groups merged in this meta
contact group.void addSubgroup(MetaContactGroup subgroup)
subgroup
- the MetaContactGroup to register as a subgroup to this
root meta contact group.MetaContactGroupImpl removeSubgroup(int index)
index
- the index of the group to remove.boolean removeSubgroup(MetaContactGroup group)
group
- the MetaContactGroup to remove.final MetaContactListServiceImpl getMclServiceImpl()
public java.lang.Object getData(java.lang.Object key)
MetaContactGroup.getData(Object)
.getData
in interface MetaContactGroup
key
- the key of the user data associated with this instance to be
retrievedpublic void setData(java.lang.Object key, java.lang.Object value)
MetaContactGroup.setData(Object, Object)
.setData
in interface MetaContactGroup
key
- the of the datavalue
- the value of the datapublic boolean isPersistent()
isPersistent
in interface MetaContactGroup
public int compareTo(MetaContactGroup target)
The result of this method is calculated the following way:
+ getGroupName().compareTo(o.getGroupName()) * 10 000
+ getMetaUID().compareTo(o.getMetaUID())
Or in other words ordering of meta groups would be first done by display name, and finally (in order to avoid equalities) be the fairly random meta contact group metaUID.
compareTo
in interface java.lang.Comparable<MetaContactGroup>
target
- the MetaContactGroup
to be compared.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.