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 TorqueObject

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

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

Direct Known Subclasses:
  TorqueGroup, TorquePermission, TorqueRole, TorqueUser

    public abstract class TorqueObject

extends Object
implements SecurityEntity, Comparable, org.apache.torque.om.Persistent, Serializable

All the Torque Security objects (User, Group, Role, Permission) are derived from this class which contains the base compare and management methods for all security objects.

Version:
  $Id: TorqueObject.java 1096130 2011-04-23 10:37:19Z ludwig $
Author:
  Henning P. Schmiedehausen
See Also:
  Serialized Form

Field Summary
`protected org.apache.torque.om.Persistent` | `obj` The underlying database Object which is proxied

Constructor Summary
`TorqueObject()` Constructs a new TorqueObject
`TorqueObject(org.apache.torque.om.Persistent obj)` This Constructor is used when a Manager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueObjects.
`TorqueObject(String name)` Constructs a new Object with the specified name.

Method Summary
`int` | `compareTo(Object obj)` Used for ordering TorqueObjects.
`boolean` | `equals(Object obj)` Compares this with another `BaseObject` instance.
`boolean` | `equals(TorqueObject torqueObject)` Compares the primary key of this instance with the key of another.
`abstract String` | `getName()` Returns the name of this object
`abstract org.apache.torque.om.Persistent` | `getPersistentObj()` Returns the underlying Object for the Peer
`org.apache.torque.om.ObjectKey` | `getPrimaryKey()` getter for the object primaryKey.
`int` | `hashCode()` If the primary key is not `null`, return the hashcode of the primary key.
`boolean` | `isModified()` Returns whether the object has been modified, since it was last retrieved from storage.
`boolean` | `isNew()` Returns whether the object has ever been saved.
`abstract void` | `save()` Makes changes made to the TorqueObject permanent.
`void` | `save(Connection con)` Stores the object in the database.
`void` | `save(String torqueName)` Stores the object in the database.
`void` | `setModified(boolean m)` Sets the modified state for the object.
`abstract void` | `setName(String name)` Sets the name of this object
`void` | `setNew(boolean b)` Setter for the isNew attribute.
`void` | `setPrimaryKey(org.apache.torque.om.ObjectKey primaryKey)` Sets the PrimaryKey for the object.
`void` | `setPrimaryKey(String primaryKey)` Sets the PrimaryKey for the object.

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

Methods inherited from interface org.apache.turbine.om.security.SecurityEntity
`getId, getIdAsObj, setId`

Field Detail

### obj

    protected org.apache.torque.om.Persistent obj

  The underlying database Object which is proxied

Constructor Detail

### TorqueObject

    public TorqueObject()

  Constructs a new TorqueObject

### TorqueObject

    public TorqueObject(String name)

  Constructs a new Object with the specified name.

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

### TorqueObject

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

  This Constructor is used when a Manager has retrieved a list of Database Objects from the peer and must 'wrap' them into TorqueObjects.

  Parameters:
    `obj` - An Object from the peer

Method Detail

### getPersistentObj

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

  Returns the underlying Object for the Peer

  Returns:
    The underlying persistent object

### getName

    public abstract String getName()

  Returns the name of this object

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

### setName

    public abstract void setName(String name)

  Sets the name of this object

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

### getPrimaryKey

    public org.apache.torque.om.ObjectKey getPrimaryKey()

  getter for the object primaryKey.

  Specified by:
    `getPrimaryKey` in interface `org.apache.torque.om.Persistent`
  Returns:
    the object primaryKey as an Object

### setPrimaryKey

    public void setPrimaryKey(org.apache.torque.om.ObjectKey primaryKey)
                       throws Exception

  Sets the PrimaryKey for the object.

  Specified by:
    `setPrimaryKey` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `primaryKey` - The new PrimaryKey for the object.
  Throws:
    `Exception` - This method might throw an exceptions

### setPrimaryKey

    public void setPrimaryKey(String primaryKey)
                       throws Exception

  Sets the PrimaryKey for the object.

  Specified by:
    `setPrimaryKey` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `primaryKey` - the String should be of the form produced by ObjectKey.toString().
  Throws:
    `Exception` - This method might throw an exceptions

### isModified

    public boolean isModified()

  Returns whether the object has been modified, since it was last retrieved from storage.

  Specified by:
    `isModified` in interface `org.apache.torque.om.Persistent`
  Returns:
    True if the object has been modified.

### isNew

    public boolean isNew()

  Returns whether the object has ever been saved. This will be false, if the object was retrieved from storage or was created and then saved.

  Specified by:
    `isNew` in interface `org.apache.torque.om.Persistent`
  Returns:
    true, if the object has never been persisted.

### setNew

    public void setNew(boolean b)

  Setter for the isNew attribute. This method will be called by Torque-generated children and Peers.

  Specified by:
    `setNew` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `b` - the state of the object.

### setModified

    public void setModified(boolean m)

  Sets the modified state for the object.

  Specified by:
    `setModified` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `m` - The new modified state for the object.

### save

    public void save(String torqueName)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed.

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `torqueName` - The name under which the object should be stored.
  Throws:
    `Exception` - This method might throw an exceptions

### save

    public void save(Connection con)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. This method is meant to be used as part of a transaction, otherwise use the save() method and the connection details will be handled internally

  Specified by:
    `save` in interface `org.apache.torque.om.Persistent`
  Parameters:
    `con` - A Connection object to save the object
  Throws:
    `Exception` - This method might throw an exceptions

### save

    public abstract void save()
                       throws TurbineSecurityException

  Makes changes made to the TorqueObject permanent.

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

### compareTo

    public int compareTo(Object obj)

  Used for ordering TorqueObjects.

  Specified by:
    `compareTo` in interface `Comparable`
  Parameters:
    `obj` - The Object to compare to.
  Returns:
    -1 if the name of the other object is lexically greater than this group, 1 if it is lexically lesser, 0 if they are equal.

### equals

    public boolean equals(Object obj)

  Compares this with another `BaseObject` instance. If `obj` is an instance of `BaseObject`, delegates to `equals(BaseObject)`. Otherwise, returns `false`.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `obj` - The object to compare to.
  Returns:
    Whether equal to the object specified.

### equals

    public boolean equals(TorqueObject torqueObject)

  Compares the primary key of this instance with the key of another.

  Parameters:
    `torqueObject` - The TorqueObject to compare to.
  Returns:
    Whether the primary keys are equal.

### hashCode

    public int hashCode()

  If the primary key is not `null`, return the hashcode of the primary key. Otherwise calls `Object.hashCode()`.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    an `int` value

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.