pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.accesscontrol
Class Group

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.util.entity.AbstractNamedEntity
          extended by org.torweg.pulse.util.entity.AbstractNamableEntity
              extended by org.torweg.pulse.accesscontrol.AbstractAccessControlObject
                  extended by org.torweg.pulse.accesscontrol.Group
All Implemented Interfaces:
java.io.Serializable, JDOMable, INameable, INamed

@Entity
public class Group
extends AbstractAccessControlObject
implements INameable

A Group is an entity used to group Permissions and Users.

Version:
$Revision: 1479 $
Author:
Christian Schatt, Daniel Dietz
See Also:
Serialized Form

Constructor Summary
protected Group()
          Deprecated. 
  Group(java.lang.String newName)
          The Constructor that sets the name of the Group .
 
Method Summary
 boolean addPermission(Permission perm)
          Adds a Permission to the Group's Set of Permissions.
 boolean containsPermission(Permission perm)
          Determines if a Permission is part of the Group 's Set of Permissions.
 org.jdom.Element deserializeToJDOM()
          Serializes the state of the Group as a JDOM Element.
 java.lang.String getDescription()
          returns the description.
 java.util.Set<Permission> getPermissions()
          Returns a shallow copy of the Group's Collection of Permissions.
 java.util.List<Role> getRoles(org.hibernate.Session s)
          Returns the Roles associated with the Group ordered by name.
 java.util.List<User> getUsers(org.hibernate.Session s)
          Returns the Users associated with the Group ordered by name.
 boolean removePermission(Permission perm)
          Removes a Permission from the Group's Set of Permissions if it is part of it.
 void setDescription(java.lang.String d)
          sets the description.
 net.sf.json.JSONObject toJSON()
          Serializes the state of the Group as a JSONObject.
 net.sf.json.JSONObject toJSON(org.hibernate.Session s)
          Serializes the state of the Group as a JSONObject.
 
Methods inherited from class org.torweg.pulse.accesscontrol.AbstractAccessControlObject
getAssociatedAbstractAccessControlObjects, getLoadCriteriaForClassWithAlias
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractNamableEntity
setName
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractNamedEntity
getName
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.torweg.pulse.util.INameable
setName
 
Methods inherited from interface org.torweg.pulse.util.INamed
getName
 

Constructor Detail

Group

@Deprecated
protected Group()
Deprecated. 

used for HibernateTM.


Group

public Group(java.lang.String newName)
The Constructor that sets the name of the Group .

Parameters:
newName - the name of the Group
Method Detail

getDescription

public final java.lang.String getDescription()
returns the description.

Returns:
the description.

setDescription

public final void setDescription(java.lang.String d)
sets the description.

Parameters:
d - the description to set

getPermissions

public final java.util.Set<Permission> getPermissions()
Returns a shallow copy of the Group's Collection of Permissions.

Attention: Since the returned Set is not a reference to the Group's internal Collection, any modifications to its state will get lost. However, modifications to the state of the Set's elements will be consistent.

For example: Adding/Deleting a Permission to/from the Set will not have any effect, when the Group is saved. On the other hand, modifications to a Permission in the Set will be made persistent, when the Permission is saved.

Returns:
the Permissions associated with the Group

addPermission

public final boolean addPermission(Permission perm)
Adds a Permission to the Group's Set of Permissions. If it already is part of the Set, it will not be added.

Parameters:
perm - the Permission to be added
Returns:
true if the Set changed as a result of the call

containsPermission

public final boolean containsPermission(Permission perm)
Determines if a Permission is part of the Group 's Set of Permissions.

Parameters:
perm - the Permission to be sought-after
Returns:
true if the Permission is part of the Set

removePermission

public final boolean removePermission(Permission perm)
Removes a Permission from the Group's Set of Permissions if it is part of it.

Parameters:
perm - the Permission to be removed
Returns:
true if the Set changed as a result of the call

getRoles

public final java.util.List<Role> getRoles(org.hibernate.Session s)
Returns the Roles associated with the Group ordered by name.

Parameters:
s - the hibernateTM-Session
Returns:
the Roles associated with the Group

getUsers

public final java.util.List<User> getUsers(org.hibernate.Session s)
Returns the Users associated with the Group ordered by name.

Parameters:
s - the hibernateTM-Session
Returns:
the Users associated with the Group

deserializeToJDOM

public final org.jdom.Element deserializeToJDOM()
Serializes the state of the Group as a JDOM Element.

Specified by:
deserializeToJDOM in interface JDOMable
Returns:
the state of the Group as a JDOM Element

toJSON

public final net.sf.json.JSONObject toJSON()
Serializes the state of the Group as a JSONObject.

Overrides:
toJSON in class AbstractAccessControlObject
Returns:
the state of the Group as a JSONObject

toJSON

public final net.sf.json.JSONObject toJSON(org.hibernate.Session s)
Serializes the state of the Group as a JSONObject.

If a Session is given the number of Users and Roles associated with the Group will be added to the JSON.

Parameters:
s - the hibernateTM-Session
Returns:
the state of the Group as a JSONObject