Class Result

  • All Implemented Interfaces:
    Cloneable

    public class Result
    extends Object
    implements Cloneable
    Describes the result of the execution of a Transformation or a Job. The information available includes the following:

    • Number of errors the job or transformation encountered
    • Number of lines input
    • Number of lines output
    • Number of lines updated
    • Number of lines read
    • Number of lines written
    • Number of lines deleted
    • Number of lines rejected
    • Number of files retrieved
    • Boolean result of the execution
    • Exit status value
    • Whether the transformation was stopped
    • Logging information (channel ID and text)
    • After execution of a job or transformation, the Result can be evaluated.
    Since:
    05-11-2003
    Author:
    Matt
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean stopped
      Whether the job or transformation was stopped.
      static String XML_FILE_TAG
      A constant specifying the tag value for the XML node for the result file entry
      static String XML_FILES_TAG
      A constant specifying the tag value for the XML node for result files entry
      static String XML_ROWS_TAG
      A constant specifying the tag value for the XML node for the result rows entry
      static String XML_TAG
      A constant specifying the tag value for the XML node of the result object
    • Constructor Summary

      Constructors 
      Constructor Description
      Result()
      Instantiates a new Result object, setting default values for all members
      Result​(int nr)
      Instantiates a new Result object, setting default values for all members and the entry number
      Result​(Node node)
      Instantiates a new Result object from a DOM node
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Result res)
      Add the numbers of lines from a different result to this result
      void clear()
      Clears the numbers in this result, setting them all to zero.
      Result clone()
      Clones the Result, including rows and files.
      String getBasicXml()  
      long getElapsedTimeMillis()
      Returns the elapsed time of the ETL execution in milliseconds
      long getEntryNr()
      Returns the entry number
      String getExecutionId()
      Returns the unique identifier of an ETL execution, should one ever care to declare one such
      int getExitStatus()
      Returns the exit status value.
      String getLogChannelId()
      Returns the log channel id of the object that was executed (trans, job, job entry, etc)
      String getLogText()
      Returns all the text from any logging performed by the transformation or job
      long getNrErrors()
      Returns the number of errors that occurred during this transformation or job
      long getNrFilesRetrieved()
      Returns the number of files retrieved during execution of this transformation or job
      long getNrLinesDeleted()
      Returns the number of lines deleted during execution of this transformation or job
      long getNrLinesInput()
      Returns the number of lines input during execution of this transformation or job
      long getNrLinesOutput()
      Returns the number of lines output during execution of this transformation or job
      long getNrLinesRead()
      Returns the number of lines read during execution of this transformation or job
      long getNrLinesRejected()
      Returns the number of lines rejected during execution of this transformation or job
      long getNrLinesUpdated()
      Returns the number of lines updated during execution of this transformation or job
      long getNrLinesWritten()
      Returns the number of lines written during execution of this transformation or job
      String getReadWriteThroughput​(int seconds)
      Creates a string containing the read/write throughput.
      boolean getResult()
      Returns the boolean result of this transformation or job
      Map<String,​ResultFile> getResultFiles()
      Returns the result files as a Map with the filename as key and the ResultFile object as value
      List<ResultFile> getResultFilesList()
      Returns the result files as a List of type ResultFile
      List<RowMetaAndData> getRows()
      Returns the resulting rowset from the job or transformation.
      String getXML()
      Returns a String object with the Result object serialized as XML
      void increaseErrors​(long incr)
      Increases the number of errors by the specified value
      void increaseLinesDeleted​(long incr)
      Increases the number of lines deleted by the specified value
      void increaseLinesInput​(long incr)
      Increases the number of lines input by the specified value
      void increaseLinesOutput​(long incr)
      Increases the number of lines output by the specified value
      void increaseLinesRead​(long incr)
      Increases the number of lines read by the specified value
      void increaseLinesRejected​(long incr)
      Increases the number of lines rejected by the specified value
      void increaseLinesUpdated​(long incr)
      Increases the number of lines updated by the specified value
      void increaseLinesWritten​(long incr)
      Increases the number of lines written by the specified value
      boolean isSafeStop()
      Sets flag for safe stopping a transformation
      boolean isStopped()
      Returns whether the transformation or job was stopped before completion
      Result lightClone()
      Performs a semi-deep copy/clone but does not clone the rows from the Result
      void setElapsedTimeMillis​(long elapsedTimeMillis)
      Sets the elapsed time of the ETL execution in milliseconds
      void setEntryNr​(long entryNr)
      Sets the entry number to the specified value
      void setExecutionId​(String executionId)
      Sets a unique identifier of an ETL execution, should one ever care to declare one such
      void setExitStatus​(int exitStatus)
      Sets the exit status value to the specified value
      void setLogChannelId​(String logChannelId)
      Sets the log channel id of the object that was executed (trans, job, job entry, etc)
      void setLogText​(String logText)
      Sets the logging text to the specified String
      void setNrErrors​(long nrErrors)
      Sets the number of errors that occurred during execution of this transformation or job
      void setNrFilesRetrieved​(long filesRetrieved)
      Sets the number of files retrieved to the specified value
      void setNrLinesDeleted​(long nrLinesDeleted)
      Sets the number of lines deleted during execution of this transformation or job
      void setNrLinesInput​(long nrLinesInput)
      Sets the number of lines input during execution of this transformation or job
      void setNrLinesOutput​(long nrLinesOutput)
      Sets the number of lines output during execution of this transformation or job
      void setNrLinesRead​(long nrLinesRead)
      Sets the number of lines read during execution of this transformation or job
      void setNrLinesRejected​(long nrLinesRejected)
      Sets the number of lines rejected during execution of this transformation or job
      void setNrLinesUpdated​(long nrLinesUpdated)
      Sets the number of lines updated during execution of this transformation or job
      void setNrLinesWritten​(long nrLinesWritten)
      Sets the number of lines written during execution of this transformation or job
      void setResult​(boolean result)
      Sets the result of the transformation or job.
      void setResultFiles​(Map<String,​ResultFile> usedFiles)
      Sets the result files for this Result to the specified Map of ResultFile objects
      void setRows​(List<RowMetaAndData> rows)
      Sets the resulting rowset from the job or transformation execution
      void setSafeStop​(boolean safeStop)
      Returns the flag for safe stopping a transformation
      void setStopped​(boolean stopped)
      Sets whether the transformation or job was stopped before completion
      String toString()
      Returns a string representation of the Result object
    • Field Detail

      • XML_TAG

        public static final String XML_TAG
        A constant specifying the tag value for the XML node of the result object
        See Also:
        Constant Field Values
      • XML_FILES_TAG

        public static final String XML_FILES_TAG
        A constant specifying the tag value for the XML node for result files entry
        See Also:
        Constant Field Values
      • XML_FILE_TAG

        public static final String XML_FILE_TAG
        A constant specifying the tag value for the XML node for the result file entry
        See Also:
        Constant Field Values
      • XML_ROWS_TAG

        public static final String XML_ROWS_TAG
        A constant specifying the tag value for the XML node for the result rows entry
        See Also:
        Constant Field Values
      • stopped

        public boolean stopped
        Whether the job or transformation was stopped.
    • Constructor Detail

      • Result

        public Result()
        Instantiates a new Result object, setting default values for all members
      • Result

        public Result​(int nr)
        Instantiates a new Result object, setting default values for all members and the entry number
        Parameters:
        nr - the entry number for the Result
      • Result

        public Result​(Node node)
               throws KettleException
        Instantiates a new Result object from a DOM node
        Parameters:
        node - the DOM root node representing the desired Result
        Throws:
        KettleException - if any errors occur during instantiation
    • Method Detail

      • lightClone

        public Result lightClone()
        Performs a semi-deep copy/clone but does not clone the rows from the Result
        Returns:
        An almost-clone of the Result, minus the rows
      • clone

        public Result clone()
        Clones the Result, including rows and files. To perform a clone without rows, use lightClone()
        Overrides:
        clone in class Object
        Returns:
        A clone of the Result object
        See Also:
        Object.clone(), lightClone()
      • getReadWriteThroughput

        public String getReadWriteThroughput​(int seconds)
        Creates a string containing the read/write throughput. Throughput in this case is defined as two measures, number of lines read or written and number of lines read/written per second.
        Parameters:
        seconds - the number of seconds with which to determine the read/write throughput
        Returns:
        a string containing the read write throughput measures with labelling text
      • getNrFilesRetrieved

        public long getNrFilesRetrieved()
        Returns the number of files retrieved during execution of this transformation or job
        Returns:
        the number of files retrieved
      • setNrFilesRetrieved

        public void setNrFilesRetrieved​(long filesRetrieved)
        Sets the number of files retrieved to the specified value
        Parameters:
        filesRetrieved - The number of files retrieved to set.
      • getEntryNr

        public long getEntryNr()
        Returns the entry number
        Returns:
        the entry number
      • setEntryNr

        public void setEntryNr​(long entryNr)
        Sets the entry number to the specified value
        Parameters:
        entryNr - The entry number to set.
      • getExitStatus

        public int getExitStatus()
        Returns the exit status value.
        Returns:
        the exit status.
      • setExitStatus

        public void setExitStatus​(int exitStatus)
        Sets the exit status value to the specified value
        Parameters:
        exitStatus - The exit status to set.
      • getNrErrors

        public long getNrErrors()
        Returns the number of errors that occurred during this transformation or job
        Returns:
        the number of errors
      • setNrErrors

        public void setNrErrors​(long nrErrors)
        Sets the number of errors that occurred during execution of this transformation or job
        Parameters:
        nrErrors - The number of errors to set
      • getNrLinesInput

        public long getNrLinesInput()
        Returns the number of lines input during execution of this transformation or job
        Returns:
        the number of lines input
      • setNrLinesInput

        public void setNrLinesInput​(long nrLinesInput)
        Sets the number of lines input during execution of this transformation or job
        Parameters:
        nrLinesInput - The number of lines input to set.
      • getNrLinesOutput

        public long getNrLinesOutput()
        Returns the number of lines output during execution of this transformation or job
        Returns:
        the number of lines output
      • setNrLinesOutput

        public void setNrLinesOutput​(long nrLinesOutput)
        Sets the number of lines output during execution of this transformation or job
        Parameters:
        nrLinesOutput - The number of lines output to set
      • getNrLinesRead

        public long getNrLinesRead()
        Returns the number of lines read during execution of this transformation or job
        Returns:
        the number of lines read
      • setNrLinesRead

        public void setNrLinesRead​(long nrLinesRead)
        Sets the number of lines read during execution of this transformation or job
        Parameters:
        nrLinesRead - The number of lines read to set.
      • getNrLinesUpdated

        public long getNrLinesUpdated()
        Returns the number of lines updated during execution of this transformation or job
        Returns:
        the number of lines updated
      • setNrLinesUpdated

        public void setNrLinesUpdated​(long nrLinesUpdated)
        Sets the number of lines updated during execution of this transformation or job
        Parameters:
        nrLinesUpdated - The number of lines updated to set.
      • getNrLinesWritten

        public long getNrLinesWritten()
        Returns the number of lines written during execution of this transformation or job
        Returns:
        the number of lines written
      • setNrLinesWritten

        public void setNrLinesWritten​(long nrLinesWritten)
        Sets the number of lines written during execution of this transformation or job
        Parameters:
        nrLinesWritten - The number of lines written to set.
      • getNrLinesDeleted

        public long getNrLinesDeleted()
        Returns the number of lines deleted during execution of this transformation or job
        Returns:
        the number of lines deleted
      • setNrLinesDeleted

        public void setNrLinesDeleted​(long nrLinesDeleted)
        Sets the number of lines deleted during execution of this transformation or job
        Parameters:
        nrLinesDeleted - The number of lines deleted to set.
      • getResult

        public boolean getResult()
        Returns the boolean result of this transformation or job
        Returns:
        true if the transformation or job was successful, false otherwise
      • setResult

        public void setResult​(boolean result)
        Sets the result of the transformation or job. A value of true should indicate a successful execution, a value of false should indicate an error condition.
        Parameters:
        result - The boolean result to set.
      • getRows

        public List<RowMetaAndData> getRows()
        Returns the resulting rowset from the job or transformation. For example, Result rows are used in jobs where entries wish to receive the results of previous executions of jobs or transformations. The Result rows can be used to do many kinds of transformation or job post-processing.
        Returns:
        a List of rows associated with the result of execution of a job or transformation
      • setRows

        public void setRows​(List<RowMetaAndData> rows)
        Sets the resulting rowset from the job or transformation execution
        Parameters:
        rows - The List of rows to set.
      • isStopped

        public boolean isStopped()
        Returns whether the transformation or job was stopped before completion
        Returns:
        true if stopped, false otherwise
      • setStopped

        public void setStopped​(boolean stopped)
        Sets whether the transformation or job was stopped before completion
        Parameters:
        stopped - true if the transformation or job was stopped, false otherwise
      • clear

        public void clear()
        Clears the numbers in this result, setting them all to zero. Also deletes the logging text
      • add

        public void add​(Result res)
        Add the numbers of lines from a different result to this result
        Parameters:
        res - The Result object from which to add
      • getXML

        public String getXML()
        Returns a String object with the Result object serialized as XML
        Returns:
        This Result object serialized as XML
      • getBasicXml

        public String getBasicXml()
      • getResultFiles

        public Map<String,​ResultFile> getResultFiles()
        Returns the result files as a Map with the filename as key and the ResultFile object as value
        Returns:
        a Map with String as key and ResultFile as value.
        See Also:
        ResultFile
      • getResultFilesList

        public List<ResultFile> getResultFilesList()
        Returns the result files as a List of type ResultFile
        Returns:
        a list of type ResultFile containing this Result's ResultFile objects
        See Also:
        ResultFile
      • setResultFiles

        public void setResultFiles​(Map<String,​ResultFile> usedFiles)
        Sets the result files for this Result to the specified Map of ResultFile objects
        Parameters:
        usedFiles - The Map of result files to set. This is a Map with the filename as key and ResultFile object as value
        See Also:
        ResultFile
      • getNrLinesRejected

        public long getNrLinesRejected()
        Returns the number of lines rejected during execution of this transformation or job
        Returns:
        the number of lines rejected
      • setNrLinesRejected

        public void setNrLinesRejected​(long nrLinesRejected)
        Sets the number of lines rejected during execution of this transformation or job
        Parameters:
        nrLinesRejected - the number of lines rejected to set
      • getLogChannelId

        public String getLogChannelId()
        Returns the log channel id of the object that was executed (trans, job, job entry, etc)
        Returns:
        the log channel id
      • setLogChannelId

        public void setLogChannelId​(String logChannelId)
        Sets the log channel id of the object that was executed (trans, job, job entry, etc)
        Parameters:
        logChannelId - the logChannelId to set
      • increaseLinesRead

        public void increaseLinesRead​(long incr)
        Increases the number of lines read by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesWritten

        public void increaseLinesWritten​(long incr)
        Increases the number of lines written by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesInput

        public void increaseLinesInput​(long incr)
        Increases the number of lines input by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesOutput

        public void increaseLinesOutput​(long incr)
        Increases the number of lines output by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesUpdated

        public void increaseLinesUpdated​(long incr)
        Increases the number of lines updated by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesDeleted

        public void increaseLinesDeleted​(long incr)
        Increases the number of lines deleted by the specified value
        Parameters:
        incr - the amount to increment
      • increaseLinesRejected

        public void increaseLinesRejected​(long incr)
        Increases the number of lines rejected by the specified value
        Parameters:
        incr - the amount to increment
      • increaseErrors

        public void increaseErrors​(long incr)
        Increases the number of errors by the specified value
        Parameters:
        incr - the amount to increment
      • getLogText

        public String getLogText()
        Returns all the text from any logging performed by the transformation or job
        Returns:
        the logging text as a string
      • setLogText

        public void setLogText​(String logText)
        Sets the logging text to the specified String
        Parameters:
        logText - the logText to set
      • isSafeStop

        public boolean isSafeStop()
        Sets flag for safe stopping a transformation
        Returns:
        the safe stop flag
      • setSafeStop

        public void setSafeStop​(boolean safeStop)
        Returns the flag for safe stopping a transformation
        Parameters:
        safeStop - the safe stop flag
      • getElapsedTimeMillis

        public long getElapsedTimeMillis()
        Returns the elapsed time of the ETL execution in milliseconds
      • setElapsedTimeMillis

        public void setElapsedTimeMillis​(long elapsedTimeMillis)
        Sets the elapsed time of the ETL execution in milliseconds
        Parameters:
        elapsedTimeMillis - elapsed time of the ETL execution in milliseconds
      • getExecutionId

        public String getExecutionId()
        Returns the unique identifier of an ETL execution, should one ever care to declare one such
        Returns:
        unique identifier of an ETL execution, should one ever care to declare one such
      • setExecutionId

        public void setExecutionId​(String executionId)
        Sets a unique identifier of an ETL execution, should one ever care to declare one such
        Parameters:
        executionId - unique identifier of an ETL execution, should one ever care to declare one such