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 TorqueRole

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

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

    public class TorqueRole

extends TorqueObject
implements Role, Comparable

This class represents a role played by the User associated with the current Session. It is separated from the actual Torque peer object to be able to replace the Peer with an user supplied Peer (and Object)

Version:
  $Id: TorqueRole.java 534527 2007-05-02 16:10:59Z tv $
Author:
  Frank Y. Kim, John D. McNally, Brett McLaughlin, Martin Poeschl, Henning P. Schmiedehausen
See Also:
  Serialized Form

Field Summary

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

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

Method Summary
`Role` | `create(String name)` Creates a new Role in the system.
`int` | `getId()` Gets the Id of this object
`Integer` | `getIdAsObj()` Gets the Id of this object
`String` | `getName()` Returns the name of this role.
`PermissionSet` | `getPermissions()` Returns the set of Permissions associated with this Role.
`org.apache.torque.om.Persistent` | `getPersistentObj()` Returns the underlying Object for the Peer Used in the RolePeerManager when building a new Criteria.
`void` | `grant(Permission permission)` Grants a Permission to this Role.
`void` | `grant(PermissionSet permissionSet)` Grants Permissions from a PermissionSet to this Role.
`void` | `remove()` Removes a role from the system.
`void` | `rename(String name)` Renames the role.
`void` | `revoke(Permission permission)` Revokes a Permission from this Role.
`void` | `revoke(PermissionSet permissionSet)` Revokes Permissions from a PermissionSet from this Role.
`void` | `save()` Makes changes made to the Role attributes permanent.
`void` | `setId(int id)` Sets the Id of this object
`void` | `setName(String name)` Sets the name of this Role
`void` | `setPermissions(PermissionSet permissionSet)` Sets the Permissions associated with this Role.

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

### TorqueRole

    public TorqueRole()

  Constructs a new Role

### TorqueRole

    public TorqueRole(String name)

  Constructs a new Role with the specified name.

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

### TorqueRole

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

  The package private Constructor is used when the RolePeerManager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueRole 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 RolePeerManager 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 role.

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

### setName

    public void setName(String name)

  Sets the name of this Role

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

### 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

### getPermissions

    public PermissionSet getPermissions()
                                 throws Exception

  Returns the set of Permissions associated with this Role.

  Specified by:
    `getPermissions` in interface `Role`
  Returns:
    A PermissionSet.
  Throws:
    `Exception` - a generic exception.

### setPermissions

    public void setPermissions(PermissionSet permissionSet)

  Sets the Permissions associated with this Role.

  Specified by:
    `setPermissions` in interface `Role`
  Parameters:
    `permissionSet` - A PermissionSet.

### create

    public Role create(String name)
                throws TurbineSecurityException

  Creates a new Role in the system.

  Specified by:
    `create` in interface `Role`
  Parameters:
    `name` - The name of the new Role.
  Returns:
    An object representing the new Role.
  Throws:
    `TurbineSecurityException` - if the Role could not be created.

### save

    public void save()
              throws TurbineSecurityException

  Makes changes made to the Role attributes permanent.

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

### remove

    public void remove()
                throws TurbineSecurityException

  Removes a role from the system.

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

### rename

    public void rename(String name)
                throws TurbineSecurityException

  Renames the role.

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

### grant

    public void grant(Permission permission)
               throws TurbineSecurityException

  Grants a Permission to this Role.

  Specified by:
    `grant` in interface `Role`
  Parameters:
    `permission` - A Permission.
  Throws:
    `TurbineSecurityException` - if there is a problem while assigning the Permission.

### grant

    public void grant(PermissionSet permissionSet)
               throws TurbineSecurityException

  Grants Permissions from a PermissionSet to this Role.

  Specified by:
    `grant` in interface `Role`
  Parameters:
    `permissionSet` - A PermissionSet.
  Throws:
    `TurbineSecurityException` - if there is a problem while assigning the Permissions.

### revoke

    public void revoke(Permission permission)
                throws TurbineSecurityException

  Revokes a Permission from this Role.

  Specified by:
    `revoke` in interface `Role`
  Parameters:
    `permission` - A Permission.
  Throws:
    `TurbineSecurityException` - if there is a problem while unassigning the Permission.

### revoke

    public void revoke(PermissionSet permissionSet)
                throws TurbineSecurityException

  Revokes Permissions from a PermissionSet from this Role.

  Specified by:
    `revoke` in interface `Role`
  Parameters:
    `permissionSet` - A PermissionSet.
  Throws:
    `TurbineSecurityException` - if there is a problem while unassigning the Permissions.

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.