Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.services.security.torque
Class TorqueGroup

    java.lang.Object
      org.apache.turbine.services.security.torque.TorqueObject
          org.apache.turbine.services.security.torque.TorqueGroup

All Implemented Interfaces:
  Serializable, Comparable, org.apache.torque.om.Persistent, Group, SecurityEntity

    public class TorqueGroup

extends TorqueObject
implements Group, Comparable

This class represents a Group of Users in the system that are associated with specific entity or resource. The users belonging to the Group may have various Roles. The Permissions to perform actions upon the resource depend on the Roles in the Group that they are assigned. It is separated from the actual Torque peer object to be able to replace the Peer with an user supplied Peer (and Object)

Certain Roles that the Users may have in the system are not related to any specific resource nor entity. They are assigned within a special group named 'global' that can be referenced in the code as `Group.GLOBAL_GROUP_NAME`.

Version:
  $Id: TorqueGroup.java 1096130 2011-04-23 10:37:19Z ludwig $
Author:
  Rafal Krzewski, Martin Poeschl, Henning P. Schmiedehausen
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.turbine.services.security.torque.TorqueObject
`obj`

Fields inherited from interface org.apache.turbine.om.security.Group
`GLOBAL_GROUP_NAME`

Constructor Summary
`TorqueGroup()` Constructs a new Group.
`TorqueGroup(org.apache.torque.om.Persistent obj)` The package private Constructor is used when the GroupPeerManager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueGroup Objects.
`TorqueGroup(String name)` Constructs a new Group with the specified name.

Method Summary
`static Group` | `create(String name)` Deprecated. Please use the createGroup method in TurbineSecurity now.
`static Group` | `getGlobalGroup()` Deprecated. Please use the method in TurbineSecurity now.
`int` | `getId()` Gets the Id of this object
`Integer` | `getIdAsObj()` Gets the Id of this object
`String` | `getName()` Returns the name of this object.
`org.apache.torque.om.Persistent` | `getPersistentObj()` Returns the underlying Object for the Peer Used in the GroupPeerManager when building a new Criteria.
`void` | `grant(User user, Role role)` Grants a Role in this Group to an User.
`void` | `grant(User user, RoleSet roleSet)` Grants Roles in this Group to an User.
`void` | `remove()` Removes a group from the system.
`void` | `rename(String name)` Renames the role.
`void` | `revoke(User user, Role role)` Revokes a Role in this Group from an User.
`void` | `revoke(User user, RoleSet roleSet)` Revokes Roles in this group from an User.
`void` | `save()` Makes changes made to the Group attributes permanent.
`void` | `setId(int id)` Sets the Id of this object
`void` | `setName(String name)` Sets the name of this object.

Methods inherited from class org.apache.turbine.services.security.torque.TorqueObject
`compareTo, equals, equals, getPrimaryKey, hashCode, isModified, isNew, save, save, setModified, setNew, setPrimaryKey, setPrimaryKey`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.lang.Comparable
`compareTo`

Constructor Detail

### TorqueGroup

    public TorqueGroup()

  Constructs a new Group.

### TorqueGroup

    public TorqueGroup(String name)

  Constructs a new Group with the specified name.

  Parameters:
    `name` - The name of the new object.

### TorqueGroup

    public TorqueGroup(org.apache.torque.om.Persistent obj)

  The package private Constructor is used when the GroupPeerManager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueGroup Objects. You should not use it directly!

  Parameters:
    `obj` - An Object from the peer

Method Detail

### getPersistentObj

    public org.apache.torque.om.Persistent getPersistentObj()

  Returns the underlying Object for the Peer Used in the GroupPeerManager when building a new Criteria.

  Specified by:
    `getPersistentObj` in class `TorqueObject`
  Returns:
    The underlying persistent object

### getName

    public String getName()

  Returns the name of this object.

  Specified by:
    `getName` in interface `SecurityEntity`
  Specified by:
    `getName` in class `TorqueObject`
  Returns:
    The name of the object.

### setName

    public void setName(String name)

  Sets the name of this object.

  Specified by:
    `setName` in interface `SecurityEntity`
  Specified by:
    `setName` in class `TorqueObject`
  Parameters:
    `name` - The name of the object.

### getId

    public int getId()

  Gets the Id of this object

  Specified by:
    `getId` in interface `SecurityEntity`
  Returns:
    The Id of the object

### getIdAsObj

    public Integer getIdAsObj()

  Gets the Id of this object

  Specified by:
    `getIdAsObj` in interface `SecurityEntity`
  Returns:
    The Id of the object

### setId

    public void setId(int id)

  Sets the Id of this object

  Specified by:
    `setId` in interface `SecurityEntity`
  Parameters:
    `id` - The new Id

### getGlobalGroup

    public static Group getGlobalGroup()

  Deprecated. Please use the method in TurbineSecurity now.

  Provides a reference to the Group object that represents the global group.

  Returns:
    a Group object that represents the global group.

### create

    public static Group create(String name)
                        throws TurbineSecurityException

  Deprecated. Please use the createGroup method in TurbineSecurity now.

  Creates a new Group in the system.

  Parameters:
    `name` - The name of the new Group.
  Returns:
    An object representing the new Group.
  Throws:
    `TurbineSecurityException` - if the Group could not be created.

### save

    public void save()
              throws TurbineSecurityException

  Makes changes made to the Group attributes permanent.

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Specified by:
    `save` in interface `Group`
  Specified by:
    `save` in class `TorqueObject`
  Throws:
    `TurbineSecurityException` - if there is a problem while saving data.

### remove

    public void remove()
                throws TurbineSecurityException

  Removes a group from the system.

  Specified by:
    `remove` in interface `Group`
  Throws:
    `TurbineSecurityException` - if the Group could not be removed.

### rename

    public void rename(String name)
                throws TurbineSecurityException

  Renames the role.

  Specified by:
    `rename` in interface `Group`
  Parameters:
    `name` - The new Group name.
  Throws:
    `TurbineSecurityException` - if the Group could not be renamed.

### grant

    public void grant(User user,
                      Role role)
               throws TurbineSecurityException

  Grants a Role in this Group to an User.

  Specified by:
    `grant` in interface `Group`
  Parameters:
    `user` - An User.
    `role` - A Role.
  Throws:
    `TurbineSecurityException` - if there is a problem while assigning the Role.

### grant

    public void grant(User user,
                      RoleSet roleSet)
               throws TurbineSecurityException

  Grants Roles in this Group to an User.

  Specified by:
    `grant` in interface `Group`
  Parameters:
    `user` - An User.
    `roleSet` - A RoleSet.
  Throws:
    `TurbineSecurityException` - if there is a problem while assigning the Roles.

### revoke

    public void revoke(User user,
                       Role role)
                throws TurbineSecurityException

  Revokes a Role in this Group from an User.

  Specified by:
    `revoke` in interface `Group`
  Parameters:
    `user` - An User.
    `role` - A Role.
  Throws:
    `TurbineSecurityException` - if there is a problem while unassigning the Role.

### revoke

    public void revoke(User user,
                       RoleSet roleSet)
                throws TurbineSecurityException

  Revokes Roles in this group from an User.

  Specified by:
    `revoke` in interface `Group`
  Parameters:
    `user` - An User.
    `roleSet` - a RoleSet.
  Throws:
    `TurbineSecurityException` - if there is a problem while unassigning the Roles.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.