com.philemonworks.selfdiagnose
Class DiagnosticTaskResult

java.lang.Object
  extended by com.philemonworks.selfdiagnose.DiagnosticTaskResult
Direct Known Subclasses:
CompositeDiagnosticTaskResult

public class DiagnosticTaskResult
extends java.lang.Object

DiagnosticTaskResult hold information about the execution of a DiagnosticTask and known how to create a report for logging.

Author:
emicklei

Field Summary
static java.lang.String STATUS_ERROR
           
static java.lang.String STATUS_FAILED
           
static java.lang.String STATUS_PASSED
           
 
Constructor Summary
DiagnosticTaskResult(DiagnosticTask task)
          Constructor requires a DiagnosticTask to store the result of its run.
 
Method Summary
 void addToResults(java.util.List results)
          Dispatch method exists because of CompositeDiagnosticTaskResult.
 long getExecutionTime()
           
 java.lang.String getMessage()
           
 java.lang.String getStatus()
          Indicates the outcome of the task
 DiagnosticTask getTask()
          Return the DiagnosticTask for which the result hold the results.
 boolean isError()
           
 boolean isFailed()
           
 boolean isPassed()
           
 void logReport()
          Write a log entry using the logger associated with SelfDiagnose.
 void setErrorMessage(java.lang.String aMessage)
          Set the message explaining why the run has failed.
 void setExecutionTime(long executionTime)
           
 void setFailedMessage(java.lang.String failedMessage)
           
 void setPassedMessage(java.lang.String passedMessage)
          Add a message to the list of reporting messages
protected  void writeMessagesOn(java.io.StringWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_PASSED

public static final java.lang.String STATUS_PASSED
See Also:
Constant Field Values

STATUS_FAILED

public static final java.lang.String STATUS_FAILED
See Also:
Constant Field Values

STATUS_ERROR

public static final java.lang.String STATUS_ERROR
See Also:
Constant Field Values
Constructor Detail

DiagnosticTaskResult

public DiagnosticTaskResult(DiagnosticTask task)
Constructor requires a DiagnosticTask to store the result of its run.

Parameters:
task - DiagnosticTask
Method Detail

getStatus

public java.lang.String getStatus()
Indicates the outcome of the task

Returns:
STATUS_PASSED || STATUS_FAILED || STATUS_ERROR

isError

public boolean isError()
Returns:
boolean true if the run has failed

isFailed

public boolean isFailed()
Returns:
boolean true if the run has failed

isPassed

public boolean isPassed()
Returns:
boolean true if the run has passed

setErrorMessage

public void setErrorMessage(java.lang.String aMessage)
Set the message explaining why the run has failed.

Parameters:
aMessage -

getMessage

public java.lang.String getMessage()

logReport

public void logReport()
Write a log entry using the logger associated with SelfDiagnose. If the result was an error then write a verbose report.


writeMessagesOn

protected void writeMessagesOn(java.io.StringWriter writer)

getTask

public DiagnosticTask getTask()
Return the DiagnosticTask for which the result hold the results.

Returns:
DiagnosticTask

setPassedMessage

public void setPassedMessage(java.lang.String passedMessage)
Add a message to the list of reporting messages

Parameters:
passedMessage - String

setFailedMessage

public void setFailedMessage(java.lang.String failedMessage)

getExecutionTime

public long getExecutionTime()

setExecutionTime

public void setExecutionTime(long executionTime)

addToResults

public void addToResults(java.util.List results)
Dispatch method exists because of CompositeDiagnosticTaskResult.

Parameters:
results -


Copyright © 2008. All Rights Reserved.