com.zphinx.spine.utils
Class ActiveGroups

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.concurrent.ConcurrentHashMap
          extended by com.zphinx.spine.utils.ActiveGroups
All Implemented Interfaces:
DataTransferObject, Serializable, ConcurrentMap, Map

public class ActiveGroups
extends ConcurrentHashMap
implements DataTransferObject

An ActiveGroups object encapsulates the logic behind the persistent group system which is used by the spine framework to capture the properties of Groups registered within the system.

Version:
$Revision: 1.14 $ $Date: 2008/06/12 22:35:40 $

copyright © Zphinx Software Solutions

Author:
David Ladapo
See Also:
HashMap, Group, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ActiveGroups()
          Public Constructor, set ups up a default group of non logged in users
 
Method Summary
 void addGroup(Group group)
          Add a new Group object to this map
 boolean exitGroup(long id)
          The id of the member to remove from all groups
 int exitGroup(long groupId, UserListBean lvb)
          Method to call when user logs out of the system
 int getGroupSize(long groupId)
          Get the number of users currently logged into a group
 List getGroupsList()
          Gets the groups as a list of groups
 Locale getLocale()
          Gets the Locale where the creator of this DTO is using the system
 String getSessionId()
          Gets a unique ID for this transaction which is used to identify this object across multiple tiers
 ArrayList getUniqueList()
          Get a unique list of users of this system
 int joinGroup(long groupId, UserListBean lvb)
          Method to call when user joins a group i.e logs into a group.
 Group removeGroup(long groupId)
          remove a Group object from this map
 List subsidizedGroupsList()
          Gets the groups as a list of groups
 int updateGroup(long groupId, UserListBean lvb)
          Method to call when user updates his session within a group.
 
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, contains, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
 
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ActiveGroups

public ActiveGroups()
Public Constructor, set ups up a default group of non logged in users

Method Detail

getGroupsList

public List getGroupsList()
Gets the groups as a list of groups

Returns:
A list of groups

subsidizedGroupsList

public List subsidizedGroupsList()
Gets the groups as a list of groups

Returns:
A list of groups

joinGroup

public int joinGroup(long groupId,
                     UserListBean lvb)
Method to call when user joins a group i.e logs into a group.

Parameters:
groupId - The group whose id to join
lvb - The UserListBean representing this User
Returns:
int The total number of users currently logged into this group

updateGroup

public int updateGroup(long groupId,
                       UserListBean lvb)
Method to call when user updates his session within a group.

Parameters:
groupId - The group whose id to User belongs to
lvb - The UserListBean representing this User
Returns:
int The total number of users currently logged into this group

exitGroup

public int exitGroup(long groupId,
                     UserListBean lvb)
Method to call when user logs out of the system

Parameters:
groupId - The group whose id this user belongs
lvb - The LabelValueBean representing this User
Returns:
int The total number of users currently logged into this group

getGroupSize

public int getGroupSize(long groupId)
Get the number of users currently logged into a group

Parameters:
groupId - The group whose size we need
Returns:
int The total number of users currently logged into this group

addGroup

public void addGroup(Group group)
Add a new Group object to this map

Parameters:
group - The group to add to this HashMap

removeGroup

public Group removeGroup(long groupId)
remove a Group object from this map

Parameters:
groupId - The group id of the group to remove
Returns:
Group The group we are removing

getUniqueList

public ArrayList getUniqueList()
Get a unique list of users of this system

Returns:
ArrayList The unique list of user id's

exitGroup

public boolean exitGroup(long id)
The id of the member to remove from all groups

Parameters:
id - The id of member to remove from the group
Returns:
True if this operation is successfull

getSessionId

public String getSessionId()
Description copied from interface: DataTransferObject
Gets a unique ID for this transaction which is used to identify this object across multiple tiers

Specified by:
getSessionId in interface DataTransferObject
Returns:
A unique ID useful for identifying this object

getLocale

public Locale getLocale()
Description copied from interface: DataTransferObject
Gets the Locale where the creator of this DTO is using the system

Specified by:
getLocale in interface DataTransferObject
Returns:
The Locale of the user of this DTO