edu.ou.kmi.buddyspace.core
Class BSIndividualPresences

java.lang.Object
  |
  +--edu.ou.kmi.buddyspace.core.BSIndividualPresences

public class BSIndividualPresences
extends java.lang.Object

BSIndividualPresences stores individually set presences different from overall presence. A different presence can be set for each JID. There are two policies for overriding the presence when set several times: (i) use better presence or (ii) use worse presence.


Nested Class Summary
static class BSIndividualPresences.BSIndividualPresenceItem
          Represents individual presence and its receiver JID
 
Field Summary
static int BETTER_TAKES_POLICY
           
static int WORSE_TAKES_POLICY
           
 
Constructor Summary
BSIndividualPresences(BSPresenceBean presenceBean)
          Constructor
 
Method Summary
 void clearAll()
          Resets all individual presences - no special presences will be sent
 void clearPresence(JID jid)
          Resets individual presence for JID - no special presence will be sent
 void combineWithGroupPresences()
          Combines resultant presences according to settings for groups
 void combineWithJIDPresences()
          Combines resultant presences according to settings for JIDs
protected  void combineWithOverallPresence(BSPresenceInfo overallPresence)
          Combines the resultant presences with overall presence.
protected  void combineWithPreviousOfflineFix(BSPresenceInfo overallPresence)
          Combines resultant presences with presences needed to be sent because of previous offline for the JID
 java.util.Enumeration getItems()
          Returns Enumeration of result individual presences for JIDs
 int getPolicy()
          Returnss the policy of overriding
 BSPresenceInfo getPresenceSettingFor(JID jid)
          Returns individually set presence for JID - not combined with group settings
 BSPresenceInfo getResultPresenceFor(JID jid)
          Returns individual presence for JID after combining all
protected  boolean isStrongerPresence(BSPresenceInfo first, BSPresenceInfo second)
          Returns if the first presence is stronger accoring to current policy - if equal returns false.
protected  void maybeUpdateResultPresence(java.lang.String groupName, BSPresenceInfo pi)
          If given presence is stronger, updates the resultant presence for jid
 void refreshPresences()
          Recounts the resultant presences for all JIDs
 void setPolicy(int policy)
          Sets the policy of overriding
 void setPresence(JID jid, BSPresenceInfo pi)
          Sets presence for JID
 void setRosterBean(BSRosterBean rosterBean)
          Sets roster bean for getting groups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BETTER_TAKES_POLICY

public static final int BETTER_TAKES_POLICY
See Also:
Constant Field Values

WORSE_TAKES_POLICY

public static final int WORSE_TAKES_POLICY
See Also:
Constant Field Values
Constructor Detail

BSIndividualPresences

public BSIndividualPresences(BSPresenceBean presenceBean)
Constructor

Method Detail

setRosterBean

public void setRosterBean(BSRosterBean rosterBean)
Sets roster bean for getting groups


setPolicy

public void setPolicy(int policy)
Sets the policy of overriding


getPolicy

public int getPolicy()
Returnss the policy of overriding


setPresence

public void setPresence(JID jid,
                        BSPresenceInfo pi)
Sets presence for JID


clearPresence

public void clearPresence(JID jid)
Resets individual presence for JID - no special presence will be sent


clearAll

public void clearAll()
Resets all individual presences - no special presences will be sent


getItems

public java.util.Enumeration getItems()
Returns Enumeration of result individual presences for JIDs


getResultPresenceFor

public BSPresenceInfo getResultPresenceFor(JID jid)
Returns individual presence for JID after combining all


getPresenceSettingFor

public BSPresenceInfo getPresenceSettingFor(JID jid)
Returns individually set presence for JID - not combined with group settings


refreshPresences

public void refreshPresences()
Recounts the resultant presences for all JIDs


combineWithGroupPresences

public void combineWithGroupPresences()
Combines resultant presences according to settings for groups


combineWithOverallPresence

protected void combineWithOverallPresence(BSPresenceInfo overallPresence)
Combines the resultant presences with overall presence. This changes presence for people who are in more groups and some of the groups don't have the individual presence set.


combineWithJIDPresences

public void combineWithJIDPresences()
Combines resultant presences according to settings for JIDs


combineWithPreviousOfflineFix

protected void combineWithPreviousOfflineFix(BSPresenceInfo overallPresence)
Combines resultant presences with presences needed to be sent because of previous offline for the JID


maybeUpdateResultPresence

protected void maybeUpdateResultPresence(java.lang.String groupName,
                                         BSPresenceInfo pi)
If given presence is stronger, updates the resultant presence for jid


isStrongerPresence

protected boolean isStrongerPresence(BSPresenceInfo first,
                                     BSPresenceInfo second)
Returns if the first presence is stronger accoring to current policy - if equal returns false.