public class RosterItem extends Object implements Cacheable, Externalizable
Represents a single roster item for a User's Roster.
The server doesn't need to know anything about roster groups so they are not stored with easy retrieval or manipulation in mind. The important data elements of a roster item (beyond the jid adddress of the roster entry) includes:
Modifier and Type | Class and Description |
---|---|
static class |
RosterItem.AskType |
static class |
RosterItem.RecvType |
static class |
RosterItem.SubType |
Modifier and Type | Field and Description |
---|---|
static RosterItem.AskType |
ASK_NONE
The roster item has no pending subscription requests.
|
static RosterItem.AskType |
ASK_SUBSCRIBE
The roster item has been asked for permission to subscribe to their presence
but no response has been received.
|
static RosterItem.AskType |
ASK_UNSUBSCRIBE
The roster owner has asked to the roster item to unsubscribe from it's
presence but has not received confirmation.
|
protected RosterItem.AskType |
askStatus |
protected List<String> |
groups |
protected Set<String> |
invisibleSharedGroups |
protected org.xmpp.packet.JID |
jid |
protected String |
nickname |
static RosterItem.RecvType |
RECV_NONE
There are no subscriptions that have been received but not presented to the user.
|
static RosterItem.RecvType |
RECV_SUBSCRIBE
The server has received a subscribe request, but has not forwarded it to the user.
|
static RosterItem.RecvType |
RECV_UNSUBSCRIBE
The server has received an unsubscribe request, but has not forwarded it to the user.
|
protected RosterItem.RecvType |
recvStatus |
protected Set<String> |
sharedGroups |
static RosterItem.SubType |
SUB_BOTH
The roster item and owner have a mutual subscription.
|
static RosterItem.SubType |
SUB_FROM
The roster item has a subscription to the roster owner's presence.
|
static RosterItem.SubType |
SUB_NONE
No subscription is established.
|
static RosterItem.SubType |
SUB_REMOVE
Indicates the roster item should be removed.
|
static RosterItem.SubType |
SUB_TO
The roster owner has a subscription to the roster item's presence.
|
protected RosterItem.SubType |
subStatus |
Constructor and Description |
---|
RosterItem()
Constructor added for Externalizable.
|
RosterItem(org.xmpp.packet.JID jid,
RosterItem.SubType subStatus,
RosterItem.AskType askStatus,
RosterItem.RecvType recvStatus,
String nickname,
List<String> groups) |
RosterItem(long id,
org.xmpp.packet.JID jid,
RosterItem.SubType subStatus,
RosterItem.AskType askStatus,
RosterItem.RecvType recvStatus,
String nickname,
List<String> groups) |
RosterItem(org.xmpp.packet.Roster.Item item)
Create a roster item from the data in another one.
|
Modifier and Type | Method and Description |
---|---|
void |
addInvisibleSharedGroup(Group sharedGroup)
Adds a new group to the list shared groups that won't be sent to the user.
|
void |
addSharedGroup(Group sharedGroup)
Adds a new group to the shared groups list.
|
RosterItem.AskType |
getAskStatus()
Obtain the current ask status of the item.
|
int |
getCachedSize()
Returns the approximate size of the Object in bytes.
|
List<String> |
getGroups()
Returns the groups for the item.
|
long |
getID()
Returns the roster ID associated with this particular roster item.
|
Collection<Group> |
getInvisibleSharedGroups()
Returns the invisible shared groups for the item.
|
org.xmpp.packet.JID |
getJid()
Obtain the address of the item.
|
String |
getNickname()
Obtain the current nickname for the item.
|
RosterItem.RecvType |
getRecvStatus()
Obtain the current recv status of the item.
|
Collection<Group> |
getSharedGroups()
Returns the shared groups for the item.
|
RosterItem.SubType |
getSubStatus()
Obtain the current subscription status of the item.
|
boolean |
isOnlyShared()
Returns true if this item belongs ONLY to shared groups.
|
boolean |
isShared()
Returns true if this item belongs to a shared group.
|
void |
readExternal(ObjectInput in) |
void |
removeSharedGroup(Group sharedGroup)
Removes a group from the shared groups list.
|
void |
setAsCopyOf(org.xmpp.packet.Roster.Item item)
Update the cached item as a copy of the given item.
|
void |
setAskStatus(RosterItem.AskType askStatus)
Set the current ask status of the item.
|
void |
setGroups(List<String> groups)
Set the current groups for the item.
|
void |
setID(long rosterID)
Sets the roster ID associated with this particular roster item.
|
void |
setNickname(String nickname)
Set the current nickname for the item.
|
void |
setRecvStatus(RosterItem.RecvType recvStatus)
Set the current recv status of the item.
|
void |
setSubStatus(RosterItem.SubType subStatus)
Set the current subscription status of the item.
|
void |
writeExternal(ObjectOutput out) |
public static final RosterItem.SubType SUB_REMOVE
Indicates the roster item should be removed.
public static final RosterItem.SubType SUB_NONE
No subscription is established.
public static final RosterItem.SubType SUB_TO
The roster owner has a subscription to the roster item's presence.
public static final RosterItem.SubType SUB_FROM
The roster item has a subscription to the roster owner's presence.
public static final RosterItem.SubType SUB_BOTH
The roster item and owner have a mutual subscription.
public static final RosterItem.AskType ASK_NONE
The roster item has no pending subscription requests.
public static final RosterItem.AskType ASK_SUBSCRIBE
The roster item has been asked for permission to subscribe to their presence but no response has been received.
public static final RosterItem.AskType ASK_UNSUBSCRIBE
The roster owner has asked to the roster item to unsubscribe from it's presence but has not received confirmation.
public static final RosterItem.RecvType RECV_NONE
There are no subscriptions that have been received but not presented to the user.
public static final RosterItem.RecvType RECV_SUBSCRIBE
The server has received a subscribe request, but has not forwarded it to the user.
public static final RosterItem.RecvType RECV_UNSUBSCRIBE
The server has received an unsubscribe request, but has not forwarded it to the user.
protected RosterItem.RecvType recvStatus
protected org.xmpp.packet.JID jid
protected String nickname
protected RosterItem.SubType subStatus
protected RosterItem.AskType askStatus
public RosterItem()
public RosterItem(long id, org.xmpp.packet.JID jid, RosterItem.SubType subStatus, RosterItem.AskType askStatus, RosterItem.RecvType recvStatus, String nickname, List<String> groups)
public RosterItem(org.xmpp.packet.JID jid, RosterItem.SubType subStatus, RosterItem.AskType askStatus, RosterItem.RecvType recvStatus, String nickname, List<String> groups)
public RosterItem(org.xmpp.packet.Roster.Item item)
item
- Item that contains the info of the roster item.public RosterItem.SubType getSubStatus()
Obtain the current subscription status of the item.
public void setSubStatus(RosterItem.SubType subStatus)
Set the current subscription status of the item.
subStatus
- The subscription status of the itempublic RosterItem.AskType getAskStatus()
Obtain the current ask status of the item.
public void setAskStatus(RosterItem.AskType askStatus)
Set the current ask status of the item.
askStatus
- The ask status of the itempublic RosterItem.RecvType getRecvStatus()
Obtain the current recv status of the item.
public void setRecvStatus(RosterItem.RecvType recvStatus)
Set the current recv status of the item.
recvStatus
- The recv status of the itempublic org.xmpp.packet.JID getJid()
Obtain the address of the item.
public String getNickname()
Obtain the current nickname for the item.
public void setNickname(String nickname)
Set the current nickname for the item.
nickname
- The subscription status of the itempublic List<String> getGroups()
public void setGroups(List<String> groups) throws SharedGroupException
groups
- The new lists of groups the item belongs to.SharedGroupException
- if trying to remove shared group.public Collection<Group> getSharedGroups()
public Collection<Group> getInvisibleSharedGroups()
public void addSharedGroup(Group sharedGroup)
sharedGroup
- The shared group to add to the list of shared groups.public void addInvisibleSharedGroup(Group sharedGroup)
sharedGroup
- The shared group to add to the list of shared groups.public void removeSharedGroup(Group sharedGroup)
sharedGroup
- The shared group to remove from the list of shared groups.public boolean isShared()
public boolean isOnlyShared()
public long getID()
Databases can use the roster ID as the key in locating roster items.
public void setID(long rosterID)
Databases can use the roster ID as the key in locating roster items.
rosterID
- The roster ID.public void setAsCopyOf(org.xmpp.packet.Roster.Item item) throws SharedGroupException
Update the cached item as a copy of the given item.
A convenience for getting the item and setting each attribute.
item
- The item who's settings will be copied into the cached copySharedGroupException
- if trying to remove shared group.public int getCachedSize() throws CannotCalculateSizeException
Cacheable
getCachedSize
in interface Cacheable
CannotCalculateSizeException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © 2003-2008 Jive Software.