org.eclipse.datatools.sqltools.result.model
Interface IResultInstance

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
ResultInstance

public interface IResultInstance
extends java.io.Serializable

Represents a result in SQL Results View. There are two groups of methods defined in this interface:

  • Methods that updates the result instance. Adding more information to it. They are called by the ResultsViewAPI.
  • Methods that get information of the result instance.
  • An instance of IResultInstance contains a list of ResultItem instances and a list of Parameter instances.

    Author:
    Dafan Yang
    See Also:
    Parameter, ResultItem

    Method Summary
     int calculateStatus()
              Calculates the status of this result instance based on the status of its sub-results
     void createSubResult(OperationCommand cmd, java.lang.Runnable terminateHandler)
              Creates a sub results
     void dispose()
              Disposes resources after the instance terminated.
     java.util.Date getExecuteDate()
              Returns the date-time this result instance was created
     java.lang.String getExecuteTime()
              Returns the time in string this result instance was created
     java.lang.Throwable[] getFailThrowables()
              Returns the exceptions thrown when generating the result instance
     int getFrequency()
              Returns the execution frequency
     ResultItem getItem(int index)
              Returns the result item at given index (base on 0)
     int getItemCount()
              Returns number of result items.
     OperationCommand getOperationCommand()
              Returns the operation command that produces this result instance.
     java.util.List getParameters()
              Returns the parameters
     IResultInstance getParentResult()
              Returns the parent result of this result
     int getStatus()
              Returns the current status.
     java.util.List getSubResults()
              Returns the sub-results of this result
     boolean hasTerminateHandler()
              Checks if there is a terminate handler
     void increaseFrequency()
              Inceases the execution frequency by 1, will only be called when this instance is re-executing
     boolean isFinished()
              Checks if this result is finished
     boolean isMayHaveSubResults()
              Return the current flag value which indicates that this IResultInstance object may have sub results.
     boolean isParentResult()
              Checks if the result instance is a parent result
     void morePlainMessage(java.lang.String text)
              Appends a plain message.
     void moreResultItem(ResultItem item)
              Appends a new result item.
     void moreResultSet(IResultSetObject resultset)
              Appends a new result set.
     void moreResultSet(java.sql.ResultSet resultset)
              Appends a new result set.
     void moreStatusMessage(java.lang.String message)
              Appends a status message, which will be displayed on 'Status' tab when using multiple tabs display mode
     void moreThrowable(java.lang.Throwable th)
              Appends an exception
     void moreUpdateCount(int updateCount)
              Appends a new update count.
     void resetInstance()
              Clears all the result items and parameters
     void setMayHaveSubResults(boolean flag)
              Set new value to the flag which indicates that this IResultInstance object may have sub results.
     void showParameters(java.util.List params)
              Shows the given parameters on SQL Results View
     void terminate()
              Terminates the instance.
     void updateStatus(int status)
              Updates the status of this result instance
     

    Method Detail

    morePlainMessage

    void morePlainMessage(java.lang.String text)
    Appends a plain message. For example, through "print" in the SQL code.

    Parameters:
    text - the plain message

    moreStatusMessage

    void moreStatusMessage(java.lang.String message)
    Appends a status message, which will be displayed on 'Status' tab when using multiple tabs display mode

    Parameters:
    message - the status message

    moreUpdateCount

    void moreUpdateCount(int updateCount)
    Appends a new update count.

    Parameters:
    updateCount - the update count

    updateStatus

    void updateStatus(int status)
    Updates the status of this result instance

    Parameters:
    status - the new status
    See Also:
    OperationCommand.STATUS_STARTED, OperationCommand.STATUS_RUNNING, OperationCommand.STATUS_SUCCEEDED, OperationCommand.STATUS_FAILED, OperationCommand.STATUS_TERMINATED, OperationCommand.STATUS_WARNING, OperationCommand.STATUS_CRITICAL_ERROR

    showParameters

    void showParameters(java.util.List params)
    Shows the given parameters on SQL Results View

    Parameters:
    params - the Parameter instances list
    See Also:
    Parameter

    moreResultSet

    void moreResultSet(java.sql.ResultSet resultset)
                       throws java.sql.SQLException
    Appends a new result set.

    Parameters:
    resultset - instance of JDBC ResultSet
    Throws:
    java.sql.SQLException - - if a database access error occurs

    moreResultSet

    void moreResultSet(IResultSetObject resultset)
    Appends a new result set.

    Parameters:
    resultset - the IResultSetObject instance

    moreResultItem

    void moreResultItem(ResultItem item)
    Appends a new result item.

    Parameters:
    item - the result item

    getOperationCommand

    OperationCommand getOperationCommand()
    Returns the operation command that produces this result instance.

    Returns:
    the operation command

    getItemCount

    int getItemCount()
    Returns number of result items. Including result sets, messages, update counts.

    Returns:
    result item count

    getItem

    ResultItem getItem(int index)
    Returns the result item at given index (base on 0)

    Parameters:
    index - the index
    Returns:
    the result item

    getStatus

    int getStatus()
    Returns the current status.

    Returns:
    the current status of this result
    See Also:
    OperationCommand.STATUS_RUNNING, OperationCommand.STATUS_SUCCEEDED, OperationCommand.STATUS_FAILED, OperationCommand.STATUS_TERMINATED, OperationCommand.STATUS_STARTED, OperationCommand.STATUS_CRITICAL_ERROR, OperationCommand.STATUS_WARNING

    isFinished

    boolean isFinished()
    Checks if this result is finished

    Returns:
    true if this instance finishs

    terminate

    void terminate()
    Terminates the instance.


    dispose

    void dispose()
    Disposes resources after the instance terminated.


    getExecuteTime

    java.lang.String getExecuteTime()
    Returns the time in string this result instance was created

    Returns:
    the execution time

    getExecuteDate

    java.util.Date getExecuteDate()
    Returns the date-time this result instance was created

    Returns:
    the execution date-time

    resetInstance

    void resetInstance()
    Clears all the result items and parameters


    hasTerminateHandler

    boolean hasTerminateHandler()
    Checks if there is a terminate handler

    Returns:
    true if there is a terminate handler

    getParameters

    java.util.List getParameters()
    Returns the parameters

    Returns:
    the Parameter instances list

    getFrequency

    int getFrequency()
    Returns the execution frequency

    Returns:
    the execution frequency

    increaseFrequency

    void increaseFrequency()
    Inceases the execution frequency by 1, will only be called when this instance is re-executing


    getFailThrowables

    java.lang.Throwable[] getFailThrowables()
    Returns the exceptions thrown when generating the result instance

    Returns:
    the exceptions thrown

    moreThrowable

    void moreThrowable(java.lang.Throwable th)
    Appends an exception

    Parameters:
    th - the exception

    getSubResults

    java.util.List getSubResults()
    Returns the sub-results of this result

    Returns:
    the sub-results

    createSubResult

    void createSubResult(OperationCommand cmd,
                         java.lang.Runnable terminateHandler)
    Creates a sub results

    Parameters:
    cmd - the operation request object of the new result
    terminateHandler - the terminate handler

    getParentResult

    IResultInstance getParentResult()
    Returns the parent result of this result

    Returns:
    the parent result

    isParentResult

    boolean isParentResult()
    Checks if the result instance is a parent result

    Returns:
    true if it is a parent result, false if it is a sub-result

    calculateStatus

    int calculateStatus()
    Calculates the status of this result instance based on the status of its sub-results

    Returns:
    the status of this result instance

    isMayHaveSubResults

    boolean isMayHaveSubResults()
    Return the current flag value which indicates that this IResultInstance object may have sub results.

    Returns:
    the current flag value

    setMayHaveSubResults

    void setMayHaveSubResults(boolean flag)
    Set new value to the flag which indicates that this IResultInstance object may have sub results.

    Parameters:
    flag - the new flag value