servicenow.community.sql
Class JobModel

java.lang.Object
  extended by servicenow.community.sql.JobModel

public class JobModel
extends java.lang.Object

Contains the representation of a DataPump job. The job may be instantiated from string/command or from a u_datapump_job GlideRecord. If the job is a u_datapump_job in the ServiceNow instance, then this class will also update the status of the job.

Author:
LewisGF

Constructor Summary
JobModel(Instance instance, CommandParser buffer)
           
JobModel(Instance instance, GlideRecord jobrec)
           
 
Method Summary
 JobStatus finish()
           
 GlideFilter getBaseFilter()
           
 java.lang.Integer getFrequency()
          Returns the frequency of this polling job in seconds.
 GlideFilter getFullFilter()
           
 GlideDateTime getIntervalEnd()
           
 GlideFilter getIntervalFilter()
           
 GlideDateTime getIntervalStart()
           
 LoadMethod getMethod()
           
 java.lang.String getSortField()
           
 java.lang.String getSqlCommand()
           
 java.lang.String getSqlTableName()
           
 JobStatus getStatus()
           
 GlideTable getTable()
           
 GlideDateTime getTimestamp()
           
 JobOperation operation()
           
 boolean persistent()
           
 boolean polling()
           
 void postMetrics(Metrics metrics)
           
protected  GlideRecord readRecord()
          Get the pumper job record from ServiceNow.
 void readRefreshOptions(CommandParser buffer)
           
 void reset()
          Set the Status of this job to Pending.
 GlideDateTime resetInterval()
           
 void setFrequency(int seconds)
           
 void setStatus(JobStatus newstatus)
           
 GlideDateTime start(GlideDateTime runstart)
           
 boolean truncate()
           
 boolean useKeys()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobModel

public JobModel(Instance instance,
                GlideRecord jobrec)
         throws java.io.IOException,
                java.text.ParseException,
                PumperException
Throws:
java.io.IOException
java.text.ParseException
PumperException

JobModel

public JobModel(Instance instance,
                CommandParser buffer)
         throws java.io.IOException,
                PumperException
Throws:
java.io.IOException
PumperException
Method Detail

readRefreshOptions

public void readRefreshOptions(CommandParser buffer)
                        throws PumperException
Throws:
PumperException

operation

public JobOperation operation()

persistent

public boolean persistent()

polling

public boolean polling()

useKeys

public boolean useKeys()

truncate

public boolean truncate()

getTable

public GlideTable getTable()

getMethod

public LoadMethod getMethod()

getStatus

public JobStatus getStatus()

getSortField

public java.lang.String getSortField()

getFrequency

public java.lang.Integer getFrequency()
Returns the frequency of this polling job in seconds.


setFrequency

public void setFrequency(int seconds)

getSqlCommand

public java.lang.String getSqlCommand()

getBaseFilter

public GlideFilter getBaseFilter()

getIntervalStart

public GlideDateTime getIntervalStart()

getIntervalEnd

public GlideDateTime getIntervalEnd()

getIntervalFilter

public GlideFilter getIntervalFilter()

getFullFilter

public GlideFilter getFullFilter()

start

public GlideDateTime start(GlideDateTime runstart)
                    throws java.io.IOException,
                           java.text.ParseException
Throws:
java.io.IOException
java.text.ParseException

finish

public JobStatus finish()
                 throws java.io.IOException
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Set the Status of this job to Pending. Set all metrics to zero.

Throws:
java.io.IOException

resetInterval

public GlideDateTime resetInterval()
                            throws java.io.IOException,
                                   java.text.ParseException
Throws:
java.io.IOException
java.text.ParseException

setStatus

public void setStatus(JobStatus newstatus)
               throws java.io.IOException
Throws:
java.io.IOException

getTimestamp

public GlideDateTime getTimestamp()
                           throws java.io.IOException
Throws:
java.io.IOException

getSqlTableName

public java.lang.String getSqlTableName()

postMetrics

public void postMetrics(Metrics metrics)
                 throws java.io.IOException
Throws:
java.io.IOException

readRecord

protected GlideRecord readRecord()
                          throws java.io.IOException
Get the pumper job record from ServiceNow. Used for unit test scripts.

Throws:
java.io.IOException