org.apache.lokahi.core.api.server
Class Hardware

java.lang.Object
  extended by org.apache.lokahi.core.common.interfaces.RestObject
      extended by org.apache.lokahi.core.common.interfaces.TMCDao<Hardware>
          extended by org.apache.lokahi.core.api.server.Hardware
All Implemented Interfaces:
Collectable, Dao<Hardware>, Restable, Server

public class Hardware
extends TMCDao<Hardware>
implements Server

Version:
$Id: Hardware.java,v 1.4 2006/03/07 20:18:49 drtobes Exp $
Author:
Stephen Toback

Constructor Summary
Hardware()
           
Hardware(int id, java.lang.String name, java.lang.String physicalLocation, java.lang.String comments, int instanceId, int envId, int statusId, int defaultIpId)
           
Hardware(java.lang.String name, java.lang.String physicalLocation, java.lang.String comments, Instance instance, Environment env, State status, Ip defaultIp)
           
Hardware(java.lang.String name, java.lang.String physicalLocation, java.lang.String comments, int instanceId, int envId, int statusId, int defaultIpId)
           
 
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)
           
 Hardware fillObject(java.sql.ResultSet r)
          Creates the Dao from the passed resultset, internally calling the appriate constructor.
 Hardware get(int id)
           
 java.lang.String getComments()
           
 Ip getDefaultIp()
           
 int getDefaultIpId()
           
 Environment getEnv()
           
 int getEnvId()
           
static java.util.Collection<Hardware> getHardware(Environment env, boolean fromCache)
           
static Hardware getHardware(int id, boolean fromCache)
           
static Hardware getHardware(java.lang.String name, Instance i, boolean fromCache)
           
static java.util.Collection<Hardware> getHardwares()
           
static java.util.Collection<Hardware> getHardwares(java.lang.String name, boolean fromCache)
           
 Instance getInstance()
           
 int getInstanceId()
           
 java.util.Collection<Ip> getIpAddresses()
           
 TMCCollectionImpl<Ip> getIpCollection()
           
 java.util.Collection<Ip> getIps()
           
 java.lang.String getName()
          Gets the name.
 java.lang.String getPhysicalLocation()
           
 int getPk()
          Gets the primary key
 java.lang.String getServerName()
           
 State getStatus()
           
 int getStatusId()
           
 int hashCode()
           
 boolean hasIp(Ip ip)
           
 boolean isActive()
           
 void setComments(java.lang.String comments)
           
 void setDefaultIp(Ip defaultIp)
           
 void setDefaultIpId(int defaultIpId)
           
 void setEnv(Environment env)
           
 void setEnvId(int envId)
           
 void setInstance(Instance instance)
           
 void setInstanceId(int instanceId)
           
 void setIpAddresses(java.util.Collection<Ip> ipAddresses)
           
 void setName(java.lang.String name)
           
 void setPhysicalLocation(java.lang.String physicalLocation)
           
 void setPk(int pk)
           
 void setStatus(State status)
           
 void setStatusId(int statusId)
           
 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

Hardware

public Hardware()

Hardware

public Hardware(java.lang.String name,
                java.lang.String physicalLocation,
                java.lang.String comments,
                int instanceId,
                int envId,
                int statusId,
                int defaultIpId)

Hardware

public Hardware(java.lang.String name,
                java.lang.String physicalLocation,
                java.lang.String comments,
                Instance instance,
                Environment env,
                State status,
                Ip defaultIp)

Hardware

public Hardware(int id,
                java.lang.String name,
                java.lang.String physicalLocation,
                java.lang.String comments,
                int instanceId,
                int envId,
                int statusId,
                int defaultIpId)
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)

getServerName

public java.lang.String getServerName()

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)

getInstanceId

public int getInstanceId()

setInstanceId

public void setInstanceId(int instanceId)

getEnvId

public int getEnvId()

setEnvId

public void setEnvId(int envId)

getIpAddresses

public java.util.Collection<Ip> getIpAddresses()

getIps

public java.util.Collection<Ip> getIps()

getIpCollection

public TMCCollectionImpl<Ip> getIpCollection()

isActive

public boolean isActive()

setIpAddresses

public void setIpAddresses(java.util.Collection<Ip> ipAddresses)

getPhysicalLocation

public java.lang.String getPhysicalLocation()

setPhysicalLocation

public void setPhysicalLocation(java.lang.String physicalLocation)

getStatusId

public int getStatusId()

setStatusId

public void setStatusId(int statusId)

getDefaultIpId

public int getDefaultIpId()

setDefaultIpId

public void setDefaultIpId(int defaultIpId)

getComments

public java.lang.String getComments()

setComments

public void setComments(java.lang.String comments)

getStatus

public State getStatus()

setStatus

public void setStatus(State status)

getEnv

public Environment getEnv()

setEnv

public void setEnv(Environment env)

getInstance

public Instance getInstance()

setInstance

public void setInstance(Instance instance)

getDefaultIp

public Ip getDefaultIp()

setDefaultIp

public void setDefaultIp(Ip defaultIp)

hasIp

public boolean hasIp(Ip ip)

get

public Hardware get(int id)
             throws java.sql.SQLException
Specified by:
get in class TMCDao<Hardware>
Throws:
java.sql.SQLException

getHardware

public static Hardware getHardware(int id,
                                   boolean fromCache)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getHardware

public static Hardware getHardware(java.lang.String name,
                                   Instance i,
                                   boolean fromCache)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getHardware

public static java.util.Collection<Hardware> getHardware(Environment env,
                                                         boolean fromCache)
                                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getHardwares

public static java.util.Collection<Hardware> getHardwares(java.lang.String name,
                                                          boolean fromCache)
                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getHardwares

public static java.util.Collection<Hardware> getHardwares()
                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

fillObject

public Hardware 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<Hardware>
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

toString

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

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