org.apache.lokahi.core.api.jobpool
Class JobPool

java.lang.Object
  extended by org.apache.lokahi.core.common.interfaces.RestObject
      extended by org.apache.lokahi.core.common.interfaces.TMCDao<JobPool>
          extended by org.apache.lokahi.core.api.jobpool.JobPool
All Implemented Interfaces:
Collectable, Dao<JobPool>, Datable, Pool, Restable

public class JobPool
extends TMCDao<JobPool>
implements Pool, Datable

Version:
$Id: JobPool.java,v 1.3 2006/03/07 22:05:21 drtobes Exp $
Author:
Stephen Toback

Constructor Summary
JobPool()
           
JobPool(int projectId, int userId, State state, java.lang.String options, int functionId)
           
JobPool(int jobPoolId, java.lang.String jobPoolName, int projectId, int userId, java.util.Date startTime, java.util.Date finishTime, int stateId, java.lang.String options, int functionId)
           
JobPool(Project p, User u, State s, java.lang.String options, Function f)
           
JobPool(Project p, User u, java.lang.String options, Function f)
           
JobPool(User u, State s, Function f)
           
 
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
static void complete(JobPool jp)
           
 JobPool correctStates()
           
 boolean equals(java.lang.Object o)
           
 JobPool fillObject(java.sql.ResultSet r)
          Creates the Dao from the passed resultset, internally calling the appriate constructor.
 JobPool get(int id)
           
 java.util.Date getFinishTime()
           
 Function getFunction()
           
 int getFunctionId()
           
static JobPool getJobPool(int id)
           
static java.util.Collection<JobPool> getJobPools()
           
static java.util.Collection<JobPool> getJobPools(Project p)
           
static java.util.Collection<JobPool> getJobPools(State s)
           
static java.util.Collection<JobPool> getJobPools(User u)
           
static TMCCollectionImpl<JobPool> getJobPools(User u, java.util.Date startDate, java.util.Date endDate, java.lang.String filter, Function... functions)
           
static java.util.Collection<JobPool> getJobPoolsLimited(State s)
           
 java.util.Collection<Job> getJobs()
           
 java.lang.String getName()
          Gets the name.
 java.lang.String getOptions()
           
 int getPk()
          Gets the primary key
 Project getProject()
           
 int getProjectId()
           
 java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.Integer,Job>> getSortedJobs()
           
 java.util.Date getSortOnDate()
           
 java.util.Date getStartTime()
           
 State getState()
           
 User getUser()
           
 int getUserId()
           
 int hashCode()
           
static JobPool reportCompleted(JobPool jp)
           
 boolean setCurrentState()
           
 void setFinishTime(java.util.Date finishTime)
           
 void setFunction(Function function)
           
 void setFunctionId(int functionId)
           
 void setJobs(java.util.Collection<Job> jobs)
           
 void setName(java.lang.String name)
           
 void setOptions(java.lang.String options)
           
 void setPk(int pk)
           
 void setProject(Project project)
           
 void setProjectId(int projectId)
           
 void setStartTime(java.util.Date startTime)
           
 void setState(State state)
           
 void setUser(User user)
           
 void setUserId(int userId)
           
static JobPool store(JobPool jp)
           
 java.lang.String toString()
           
static void update(JobPool jp)
           
 
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

JobPool

public JobPool()

JobPool

public JobPool(int projectId,
               int userId,
               State state,
               java.lang.String options,
               int functionId)

JobPool

public JobPool(Project p,
               User u,
               State s,
               java.lang.String options,
               Function f)

JobPool

public JobPool(User u,
               State s,
               Function f)

JobPool

public JobPool(Project p,
               User u,
               java.lang.String options,
               Function f)

JobPool

public JobPool(int jobPoolId,
               java.lang.String jobPoolName,
               int projectId,
               int userId,
               java.util.Date startTime,
               java.util.Date finishTime,
               int stateId,
               java.lang.String options,
               int functionId)
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)

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)

getProjectId

public int getProjectId()

setProjectId

public void setProjectId(int projectId)

getUserId

public int getUserId()

setUserId

public void setUserId(int userId)

getStartTime

public java.util.Date getStartTime()

setStartTime

public void setStartTime(java.util.Date startTime)

getFinishTime

public java.util.Date getFinishTime()

setFinishTime

public void setFinishTime(java.util.Date finishTime)

getOptions

public java.lang.String getOptions()

setOptions

public void setOptions(java.lang.String options)

getFunctionId

public int getFunctionId()

setFunctionId

public void setFunctionId(int functionId)

getFunction

public Function getFunction()

setFunction

public void setFunction(Function function)

getState

public State getState()

setState

public void setState(State state)

getUser

public User getUser()

setUser

public void setUser(User user)

getProject

public Project getProject()

setProject

public void setProject(Project project)

getJobs

public java.util.Collection<Job> getJobs()
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getSortedJobs

public java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.Integer,Job>> getSortedJobs()

setJobs

public void setJobs(java.util.Collection<Job> jobs)

update

public static void update(JobPool jp)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

correctStates

public JobPool correctStates()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

store

public static JobPool store(JobPool jp)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

reportCompleted

public static JobPool reportCompleted(JobPool jp)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

complete

public static void complete(JobPool jp)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

get

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

getJobPool

public static JobPool getJobPool(int id)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPools

public static java.util.Collection<JobPool> getJobPools(Project p)
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPools

public static java.util.Collection<JobPool> getJobPools(User u)
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPools

public static TMCCollectionImpl<JobPool> getJobPools(User u,
                                                     java.util.Date startDate,
                                                     java.util.Date endDate,
                                                     java.lang.String filter,
                                                     Function... functions)
                                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPools

public static java.util.Collection<JobPool> getJobPools(State s)
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPoolsLimited

public static java.util.Collection<JobPool> getJobPoolsLimited(State s)
                                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

setCurrentState

public boolean setCurrentState()
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getJobPools

public static java.util.Collection<JobPool> getJobPools()
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

fillObject

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

getSortOnDate

public java.util.Date getSortOnDate()
Specified by:
getSortOnDate in interface Datable