org.apache.lokahi.core.api.function
Class Function

java.lang.Object
  extended by org.apache.lokahi.core.common.interfaces.RestObject
      extended by org.apache.lokahi.core.common.interfaces.TMCDao<T>
          extended by org.apache.lokahi.core.common.interfaces.XMLDao<Function>
              extended by org.apache.lokahi.core.api.function.Function
All Implemented Interfaces:
java.io.Serializable, Collectable, Dao<Function>, Restable

public class Function
extends XMLDao<Function>
implements java.io.Serializable

Represents the actions that a user can perform on configurable items that lokahi maintains and controls.

Version:
$Id: Function.java,v 1.4 2006/03/13 21:56:59 drtobes Exp $
Author:
Stephen Toback
See Also:
Serialized Form

Constructor Summary
Function()
          Default constructor, public for the sake of reflection
Function(int pk, java.lang.String name, java.lang.String command)
          Full Constructor, mainly for use when creating objects from the datastore.
Function(java.lang.String name, java.lang.String command)
          Prefered constructor for creation of new functions
 
Method Summary
 java.lang.StringBuilder buildShortXMLRepresentation()
          Builds a short xml representation of this object containing name, and primary key.
 java.lang.StringBuilder buildXMLRepresention()
          Builds a xml representation of this object
 boolean equals(java.lang.Object o)
           
 Function fillObject(org.jdom.Element el)
           
 Function fillObject(java.sql.ResultSet r)
          Creates the Dao from the passed resultset, internally calling the appriate constructor.
 Function get(int id)
          Gets the function object by the primary key.
 java.lang.String getCommand()
           
static Function getFunction(int id)
          Gets the function object by the primary key.
static Function getFunction(java.lang.String command)
          Gets the function object by the commad.
static java.util.Collection<Function> getFunctions()
          Gets all function objects.
 java.lang.String getName()
          Gets the name.
 int getPk()
          Gets the primary key
 int hashCode()
           
 void setCommand(java.lang.String command)
          Sets the command
 void setName(java.lang.String name)
          Sets the name
 void setPk(int pk)
          Sets the primary key
 java.lang.String toString()
           
 
Methods inherited from class org.apache.lokahi.core.common.interfaces.RestObject
elementBuilder, elementBuilder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Function

public Function()
Default constructor, public for the sake of reflection


Function

public Function(java.lang.String name,
                java.lang.String command)
Prefered constructor for creation of new functions

Parameters:
name -
command -

Function

public Function(int pk,
                java.lang.String name,
                java.lang.String command)
Full Constructor, mainly for use when creating objects from the datastore.

Parameters:
pk -
name -
command -
Method Detail

getPk

public int getPk()
Description copied from interface: Collectable
Gets the primary key

Specified by:
getPk in interface Collectable
Returns:
the int primary key

setPk

public void setPk(int pk)
Sets the primary key

Parameters:
pk -

getName

public java.lang.String getName()
Description copied from interface: Collectable
Gets the name.

Specified by:
getName in interface Collectable
Returns:
the String name.

setName

public void setName(java.lang.String name)
Sets the name

Parameters:
name -

getCommand

public java.lang.String getCommand()
Returns:
the Command

setCommand

public void setCommand(java.lang.String command)
Sets the command

Parameters:
command -

get

public Function get(int id)
Gets the function object by the primary key.

Specified by:
get in class TMCDao<Function>
Parameters:
id - primary key of the Function to find.
Returns:
Function object or null.

getFunction

public static Function getFunction(int id)
Gets the function object by the primary key.

Parameters:
id - primary key of the Function to find.
Returns:
Function object or null.

getFunction

public static Function getFunction(java.lang.String command)
Gets the function object by the commad.

Parameters:
command - command of the Function to find.
Returns:
Function object or null.

getFunctions

public static java.util.Collection<Function> getFunctions()
                                                   throws java.sql.SQLException
Gets all function objects.

Returns:
Function object or null.
Throws:
java.sql.SQLException

fillObject

public Function fillObject(java.sql.ResultSet r)
                    throws java.sql.SQLException
Description copied from interface: Dao
Creates the Dao from the passed resultset, internally calling the appriate constructor.

Specified by:
fillObject in interface Dao<Function>
Parameters:
r - the resultset from a database call, should include the entire object
Returns:
Object populated from the resultset
Throws:
java.sql.SQLException

buildShortXMLRepresentation

public java.lang.StringBuilder buildShortXMLRepresentation()
Description copied from interface: Restable
Builds a short xml representation of this object containing name, and primary key.

Specified by:
buildShortXMLRepresentation in interface Restable
Returns:
the xml representation

buildXMLRepresention

public java.lang.StringBuilder buildXMLRepresention()
Description copied from interface: Restable
Builds a xml representation of this object

Specified by:
buildXMLRepresention in interface Restable
Returns:
the xml representation

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fillObject

public Function fillObject(org.jdom.Element el)
Specified by:
fillObject in class XMLDao<Function>