2.17.2: 2011-06-17

net.sf.basedb.core.data
Class JobData

java.lang.Object
  extended by net.sf.basedb.core.data.BasicData
      extended by net.sf.basedb.core.data.OwnedData
          extended by net.sf.basedb.core.data.JobData
All Implemented Interfaces:
IdentifiableData, NameableData, OwnableData, RemovableData

public class JobData
extends OwnedData
implements NameableData, RemovableData

This class holds information about a job.

Version:
2.0
Author:
Nicklas
See Also:
Job, Plugin/jobs overview
Last modified
$Date: 2010-09-13 12:36:49 +0200 (Mon, 13 Sep 2010) $
Hibernate: class
table="`Jobs`" lazy="false"

Field Summary
private  int activeProjectId
           
private  Integer contextItem
           
private  Integer contextType
           
private  Date created
           
private  String description
           
private  boolean dryRun
           
private  Date ended
           
private  int estimatedExecutionTime
           
private  String executeCommand
           
private  ExperimentData experiment
           
private  Integer jobAgentId
           
static int MAX_COMMAND_LENGTH
          The maximum allowed length of the execute command.
static int MAX_PLUGIN_VERSION_LENGTH
          The maximum allowed length of the plugin version.
static int MAX_SERVER_LENGTH
          The maximum allowed length of the server name.
static int MAX_SIGNAL_TRANSPORTER_LENGTH
          The maximum allowed length of the signal transporter string.
static int MAX_STACK_TRACE_LENGTH
          The maximum allowed length of the stack trace message.
static int MAX_STATUS_MESSAGE_LENGTH
          The maximum allowed length of the status message.
static int MAX_SUBCONTEXT_LENGTH
          The maximum allowed length of the subcontext name.
private  Set<MessageData> messages
           
private  String name
           
private  Map<String,ParameterValueData<?>> parameters
           
private  int parameterVersion
           
private  int percentComplete
           
private  PluginConfigurationData pluginConfiguration
           
private  PluginDefinitionData pluginDefinition
           
private  String pluginVersion
           
private  int priority
           
private  boolean removed
           
private  boolean removeJobWhenFinished
           
private  Date scheduled
           
private  boolean sendMessage
           
private  String server
           
private  String signalTransporter
           
private  String stackTrace
           
private  Date started
           
private  int status
           
private  String statusMessage
           
private  String subContext
           
private  int type
           
 
Fields inherited from interface net.sf.basedb.core.data.NameableData
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Constructor Summary
JobData()
           
 
Method Summary
 int getActiveProjectId()
          The ID of the project that should be made active when running this job.
 Integer getContextItem()
          The item type of the context that was active when configuring this job. null = no context was known
 Integer getContextType()
          The context type that was active when configuring this job. 0 = single item, 1 = list
 Date getCreated()
          Get the date and time the job was created.
 String getDescription()
          Get the description for the item.
 Date getEnded()
          Get the date and time the job was ended or null if the job hasn't ended.
 int getEstimatedExecutionTime()
          Get the estimated execution time of the job. 0 = < 1 minute, 1 = 1 - 10 minutes, 2 = < 1 hour, 3 = > 1 hour
 String getExecuteCommand()
          The command to send to the plug-in when starting to execute it.
 ExperimentData getExperiment()
          The experiment this job is a part of.
 Integer getJobAgentId()
          The ID of the job agent this job should run/is running/was running on.
(package private)  Set<MessageData> getMessages()
          This is the inverse end.
 String getName()
          Get the name of the item.
 Map<String,ParameterValueData<?>> getParameters()
          The parameters for this job.
 int getParameterVersion()
          Get the parameter version of the configuration used for this job.
 int getPercentComplete()
          If the job is running, how many percent has been completed.
 PluginConfigurationData getPluginConfiguration()
          The plugin configuration for the plugin.
 PluginDefinitionData getPluginDefinition()
          The plugin that executes the job.
 String getPluginVersion()
          Get the version of the plugin used to execute this job at the time the job was executed or registered.
 int getPriority()
          The jobs priority.
 boolean getRemoveJobWhenFinished()
          If the core should delete the job when it's finished successfully.
 Date getScheduled()
          Get the date and time the job was scheduled to the job queue, or null if it hasn't been scheduled yet.
 boolean getSendMessage()
          If the core should send a message to the owner when the job is finished or not.
 String getServer()
          The name of the server where the job is executing.
 String getSignalTransporter()
          Identifies the signal transporter to use.
 String getStackTrace()
          Get the stack trace in case of an error
 Date getStarted()
          Get the date and time the job was started or null if the job hasn't been started.
 int getStatus()
          Get the status of the job. 1 = waiting, 2 = running, 3 = completed ok, 4 = error
 String getStatusMessage()
          Get a status message.
 String getSubContext()
          The name of the subcontext that was active whjen configuring this job.
 int getType()
          The type of job: 1 = run plugin, 2 = other
 boolean isDryRun()
          If the job should be/was executed as a dry-run job.
 boolean isRemoved()
          Check if the removed flag is set for this item.
 void setActiveProjectId(int activeProjectId)
           
 void setContextItem(Integer contextItem)
           
 void setContextType(Integer contextType)
           
 void setCreated(Date created)
           
 void setDescription(String description)
          Set the description for the item.
 void setDryRun(boolean dryRun)
           
 void setEnded(Date ended)
           
 void setEstimatedExecutionTime(int estimatedExecutionTime)
           
 void setExecuteCommand(String command)
           
 void setExperiment(ExperimentData experiment)
           
 void setJobAgentId(Integer jobAgentId)
           
(package private)  void setMessages(Set<MessageData> messages)
           
 void setName(String name)
          Set the name of the item.
(package private)  void setParameters(Map<String,ParameterValueData<?>> parameters)
           
 void setParameterVersion(int parameterVersion)
           
 void setPercentComplete(int percentComplete)
           
 void setPluginConfiguration(PluginConfigurationData pluginConfiguration)
           
 void setPluginDefinition(PluginDefinitionData pluginDefinition)
           
 void setPluginVersion(String pluginVersion)
           
 void setPriority(int priority)
           
 void setRemoved(boolean removed)
          Set the removed flag for this item.
 void setRemoveJobWhenFinished(boolean removeJobWhenFinished)
           
 void setScheduled(Date scheduled)
           
 void setSendMessage(boolean sendMessage)
           
 void setServer(String server)
           
 void setSignalTransporter(String signalTransporter)
           
 void setStackTrace(String stackTrace)
           
 void setStarted(Date started)
           
 void setStatus(int status)
           
 void setStatusMessage(String statusMessage)
           
 void setSubContext(String subContext)
           
 void setType(int type)
           
 
Methods inherited from class net.sf.basedb.core.data.OwnedData
getOwner, setOwner
 
Methods inherited from class net.sf.basedb.core.data.BasicData
equals, getId, getVersion, hashCode, setId, setVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
 

Field Detail

name

private String name

description

private String description

removed

private boolean removed

type

private int type

pluginDefinition

private PluginDefinitionData pluginDefinition

pluginConfiguration

private PluginConfigurationData pluginConfiguration

experiment

private ExperimentData experiment

MAX_PLUGIN_VERSION_LENGTH

public static final int MAX_PLUGIN_VERSION_LENGTH
The maximum allowed length of the plugin version.

Since:
2.8
See Also:
Constant Field Values

pluginVersion

private String pluginVersion

parameterVersion

private int parameterVersion

sendMessage

private boolean sendMessage

removeJobWhenFinished

private boolean removeJobWhenFinished

status

private int status

dryRun

private boolean dryRun

MAX_COMMAND_LENGTH

public static final int MAX_COMMAND_LENGTH
The maximum allowed length of the execute command.

Since:
2.16
See Also:
Constant Field Values

executeCommand

private String executeCommand

MAX_STATUS_MESSAGE_LENGTH

public static final int MAX_STATUS_MESSAGE_LENGTH
The maximum allowed length of the status message.

See Also:
Constant Field Values

statusMessage

private String statusMessage

MAX_STACK_TRACE_LENGTH

public static final int MAX_STACK_TRACE_LENGTH
The maximum allowed length of the stack trace message.

See Also:
Constant Field Values

stackTrace

private String stackTrace

estimatedExecutionTime

private int estimatedExecutionTime

percentComplete

private int percentComplete

priority

private int priority

activeProjectId

private int activeProjectId

created

private Date created

scheduled

private Date scheduled

started

private Date started

ended

private Date ended

MAX_SERVER_LENGTH

public static final int MAX_SERVER_LENGTH
The maximum allowed length of the server name.

See Also:
Constant Field Values

server

private String server

contextItem

private Integer contextItem

contextType

private Integer contextType

MAX_SUBCONTEXT_LENGTH

public static final int MAX_SUBCONTEXT_LENGTH
The maximum allowed length of the subcontext name.

Since:
2.8
See Also:
Constant Field Values

subContext

private String subContext

MAX_SIGNAL_TRANSPORTER_LENGTH

public static final int MAX_SIGNAL_TRANSPORTER_LENGTH
The maximum allowed length of the signal transporter string.

See Also:
Constant Field Values

signalTransporter

private String signalTransporter

jobAgentId

private Integer jobAgentId

parameters

private Map<String,ParameterValueData<?>> parameters

messages

private Set<MessageData> messages
Constructor Detail

JobData

public JobData()
Method Detail

getName

public String getName()
Description copied from interface: NameableData
Get the name of the item.

Specified by:
getName in interface NameableData
Returns:
A String with the name of the item

setName

public void setName(String name)
Description copied from interface: NameableData
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by the MAX_NAME_LENGTH constant.

Specified by:
setName in interface NameableData
Parameters:
name - The new name for the item

getDescription

public String getDescription()
Description copied from interface: NameableData
Get the description for the item.

Specified by:
getDescription in interface NameableData
Returns:
A String with a description of the item

setDescription

public void setDescription(String description)
Description copied from interface: NameableData
Set the description for the item. The description can be null but mustn't be longer than the value specified by the MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface NameableData
Parameters:
description - The new description for the item

isRemoved

public boolean isRemoved()
Description copied from interface: RemovableData
Check if the removed flag is set for this item.

Specified by:
isRemoved in interface RemovableData
Returns:
TRUE if the item is flagged as removed, FALSE otherwise

setRemoved

public void setRemoved(boolean removed)
Description copied from interface: RemovableData
Set the removed flag for this item.

Specified by:
setRemoved in interface RemovableData
Parameters:
removed - TRUE if the item should be flagged as removed, FALSE otherwise

getType

public int getType()
The type of job: 1 = run plugin, 2 = other

Hibernate: property
column="`type`" type="int" not-null="true"

setType

public void setType(int type)

getPluginDefinition

public PluginDefinitionData getPluginDefinition()
The plugin that executes the job.

Hibernate: many-to-one
column="`plugindefinition_id`" not-null="false" outer-join="false" update="false"

setPluginDefinition

public void setPluginDefinition(PluginDefinitionData pluginDefinition)

getPluginConfiguration

public PluginConfigurationData getPluginConfiguration()
The plugin configuration for the plugin.

Hibernate: many-to-one
column="`pluginconfiguration_id`" not-null="false" outer-join="false" update="false"

setPluginConfiguration

public void setPluginConfiguration(PluginConfigurationData pluginConfiguration)

getExperiment

public ExperimentData getExperiment()
The experiment this job is a part of.

Since:
2.4
Hibernate: many-to-one
column="`experiment_id`" not-null="false" outer-join="false"

setExperiment

public void setExperiment(ExperimentData experiment)

getPluginVersion

public String getPluginVersion()
Get the version of the plugin used to execute this job at the time the job was executed or registered.

Returns:
A string with the version of the plugin, or null if not known or if the job is not executed by a plug-in
Since:
2.8
Hibernate: property
column="`version_string`" type="string" length="255" not-null="false"

setPluginVersion

public void setPluginVersion(String pluginVersion)
Since:
2.8

getParameterVersion

public int getParameterVersion()
Get the parameter version of the configuration used for this job.

Hibernate: property
column="`parameter_version`" type="int" not-null="true"

setParameterVersion

public void setParameterVersion(int parameterVersion)

getSendMessage

public boolean getSendMessage()
If the core should send a message to the owner when the job is finished or not.

Hibernate: property
column="`send_message`" type="boolean" not-null="true"

setSendMessage

public void setSendMessage(boolean sendMessage)

getRemoveJobWhenFinished

public boolean getRemoveJobWhenFinished()
If the core should delete the job when it's finished successfully.

Hibernate: property
column="`remove_job`" type="boolean" not-null="true"

setRemoveJobWhenFinished

public void setRemoveJobWhenFinished(boolean removeJobWhenFinished)

getStatus

public int getStatus()
Get the status of the job. 1 = waiting, 2 = running, 3 = completed ok, 4 = error

Hibernate: property
column="`status`" type="int" not-null="true"

setStatus

public void setStatus(int status)

isDryRun

public boolean isDryRun()
If the job should be/was executed as a dry-run job.

Hibernate: property
column="`dry_run`" type="boolean" not-null="true"

setDryRun

public void setDryRun(boolean dryRun)

getExecuteCommand

public String getExecuteCommand()
The command to send to the plug-in when starting to execute it. If null, a default values is used. See Request.COMMAND_EXECUTE. This is usually only used when automatically restarting a failed job.

Since:
2.16
Hibernate: property
column="`exec_command`" type="string" length="255" not-null="false"

setExecuteCommand

public void setExecuteCommand(String command)

getStatusMessage

public String getStatusMessage()
Get a status message.

Hibernate: property
column="`status_message`" type="text" not-null="false"

setStatusMessage

public void setStatusMessage(String statusMessage)

getStackTrace

public String getStackTrace()
Get the stack trace in case of an error

Hibernate: property
column="`stack_trace`" type="text" not-null="false"

setStackTrace

public void setStackTrace(String stackTrace)

getEstimatedExecutionTime

public int getEstimatedExecutionTime()
Get the estimated execution time of the job. 0 = < 1 minute, 1 = 1 - 10 minutes, 2 = < 1 hour, 3 = > 1 hour

Hibernate: property
column="`execution_time`" type="int" not-null="true"

setEstimatedExecutionTime

public void setEstimatedExecutionTime(int estimatedExecutionTime)

getPercentComplete

public int getPercentComplete()
If the job is running, how many percent has been completed.

Hibernate: property
column="`percent_complete`" type="int" not-null="true"

setPercentComplete

public void setPercentComplete(int percentComplete)

getPriority

public int getPriority()
The jobs priority. A lower value means a higher priority.

Hibernate: property
column="`priority`" type="int" not-null="true"

setPriority

public void setPriority(int priority)

getActiveProjectId

public int getActiveProjectId()
The ID of the project that should be made active when running this job.

Hibernate: property
column="`project_id`" type="int" not-null="true"

setActiveProjectId

public void setActiveProjectId(int activeProjectId)

getCreated

public Date getCreated()
Get the date and time the job was created.

Hibernate: property
column="`created`" type="timestamp" not-null="true" update="false"

setCreated

public void setCreated(Date created)

getScheduled

public Date getScheduled()
Get the date and time the job was scheduled to the job queue, or null if it hasn't been scheduled yet. This timestamp should be updated whenever the status is changed to WAITING.

Since:
2.16
Hibernate: property
column="`scheduled`" type="timestamp" not-null="false"

setScheduled

public void setScheduled(Date scheduled)

getStarted

public Date getStarted()
Get the date and time the job was started or null if the job hasn't been started.

Hibernate: property
column="`started`" type="timestamp" not-null="false"

setStarted

public void setStarted(Date started)

getEnded

public Date getEnded()
Get the date and time the job was ended or null if the job hasn't ended.

Hibernate: property
column="`ended`" type="timestamp" not-null="false"

setEnded

public void setEnded(Date ended)

getServer

public String getServer()
The name of the server where the job is executing.

Hibernate: property
column="`server`" type="string" length="255" not-null="false"

setServer

public void setServer(String server)

getContextItem

public Integer getContextItem()
The item type of the context that was active when configuring this job. null = no context was known

Since:
2.8
Hibernate: property
column="`context_item`" type="int"

setContextItem

public void setContextItem(Integer contextItem)
Since:
2.8

getContextType

public Integer getContextType()
The context type that was active when configuring this job. 0 = single item, 1 = list

Since:
2.8
Hibernate: property
column="`context_type`" type="int"

setContextType

public void setContextType(Integer contextType)
Since:
2.8

getSubContext

public String getSubContext()
The name of the subcontext that was active whjen configuring this job.

Since:
2.8
Hibernate: property
column="`subcontext`" type="string" length="255" not-null="false"

setSubContext

public void setSubContext(String subContext)
Since:
2.8

getSignalTransporter

public String getSignalTransporter()
Identifies the signal transporter to use. This is a string with two parts separated by colon (:). The first part is the class name of the signal transporter class, the second part is the initialisation string for the transporter.

Since:
2.6
Hibernate: property
column="`signal_transporter`" type="text" not-null="false"

setSignalTransporter

public void setSignalTransporter(String signalTransporter)

getJobAgentId

public Integer getJobAgentId()
The ID of the job agent this job should run/is running/was running on. We store this as an ID value only and not a reference to JobAgentData since it would then be impossible to delete a job agent without also deleting all jobs that has been running on it.

Since:
2.8
Hibernate: property
column="`jobagent_id`" type="int" not-null="false"

setJobAgentId

public void setJobAgentId(Integer jobAgentId)

getParameters

public Map<String,ParameterValueData<?>> getParameters()
The parameters for this job.

Hibernate: map
table="`JobParameters`" lazy="true" cascade="all"
Hibernate: collection-key
column="`job_id`"
Hibernate: collection-index
column="`name`" type="string" length="255"
Hibernate: collection-many-to-many
column="`value_id`" class="net.sf.basedb.core.data.ParameterValueData"

setParameters

void setParameters(Map<String,ParameterValueData<?>> parameters)

getMessages

Set<MessageData> getMessages()
This is the inverse end.

See Also:
MessageData.getJob()
Hibernate: set
lazy="true" inverse="true" cascade="delete"
Hibernate: collection-key
column="`job_id`"
Hibernate: collection-one-to-many
class="net.sf.basedb.core.data.MessageData"

setMessages

void setMessages(Set<MessageData> messages)

2.17.2: 2011-06-17