com.philemonworks.selfdiagnose
Class DiagnosticTaskResult

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

public class DiagnosticTaskResult
extends Object

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

Author:
emicklei

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

Field Detail

STATUS_PASSED

public static final String STATUS_PASSED
See Also:
Constant Field Values

STATUS_FAILED

public static final String STATUS_FAILED
See Also:
Constant Field Values

STATUS_ERROR

public static final String STATUS_ERROR
See Also:
Constant Field Values

STATUS_UNKNOWN

public static final String STATUS_UNKNOWN
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 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

isUnknown

public boolean isUnknown()
Returns:
boolean true if the run has an unkown result

wantsToBeReported

public boolean wantsToBeReported()

setErrorMessage

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

Parameters:
aMessage -

getMessage

public 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(StringWriter writer)

getTask

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

Returns:
DiagnosticTask

setPassedMessage

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

Parameters:
passedMessage - String

setFailedMessage

public void setFailedMessage(String failedMessage)

getExecutionTime

public long getExecutionTime()

setExecutionTime

public void setExecutionTime(long executionTime)

addToResults

public void addToResults(List<DiagnosticTaskResult> results)
Dispatch method exists because of CompositeDiagnosticTaskResult.

Parameters:
results -

toString

public String toString()
Overrides:
toString in class Object

hasComment

public boolean hasComment()

getComment

public String getComment()

setComment

public void setComment(String newComment)


Copyright © 2012. All Rights Reserved.