Class StepResult


  • public class StepResult
    extends Object
    This class define a step result.
    Since:
    2.0
    Author:
    Laurent Jourdren
    • Constructor Detail

      • StepResult

        public StepResult​(AbstractStep step)
        Constructor.
        Parameters:
        step - the step
    • Method Detail

      • getStepMessage

        public String getStepMessage()
        Get step message.
        Returns:
        the step message in a String
      • getStepCounters

        public Map<String,​Long> getStepCounters()
        Get the step counters.
        Returns:
        the step counters in a map
      • getContextMessage

        public String getContextMessage​(int contextId)
        Get a context message.
        Parameters:
        contextId - context id
        Returns:
        the message for the context
      • getContextCounters

        public Map<String,​Long> getContextCounters​(int contextId)
        Get the contextName counters.
        Parameters:
        contextId - context id
        Returns:
        the contextName counters as a map
      • isImmutable

        public boolean isImmutable()
        Test if the object immutable.
        Returns:
        true if the object is immutable
      • isSuccess

        public boolean isSuccess()
        Test if the step result is a success.
        Returns:
        true if the step result is a success
      • getException

        public Throwable getException()
        Get the exception.
        Returns:
        an Exception object or null if the step has not returned an Exception
      • getErrorMessage

        public String getErrorMessage()
        Get the error message.
        Returns:
        the error message
      • getDuration

        public long getDuration()
        Get the duration of the step.
        Returns:
        the duration of the step in milliseconds
      • setImmutable

        public void setImmutable()
        Set the object immutable.
      • addResult

        public void addResult​(TaskContextImpl context,
                              TaskResultImpl result)
        Add a task result to the step result.
        Parameters:
        context - the context to execute
        result - the result to add
      • toJSON

        public String toJSON()
        Convert the object to JSON
        Returns:
        a string with the object content at the JSON format
      • toEoulsanLogV1

        public String toEoulsanLogV1()
        Get a representation of the result in the old Eoulsan format.
        Returns:
        a String with the result
      • read

        public void read​(DataFile file)
                  throws IOException
        Read a step result file.
        Parameters:
        file - the file to read
        Throws:
        IOException - if an error occurs while reading the file
      • read

        public void read​(InputStream in)
        Read a step result file.
        Parameters:
        in - the input stream to read
      • write

        public void write​(DataFile file,
                          boolean oldFormat)
                   throws IOException
        Write the result.
        Parameters:
        file - output file
        oldFormat - write the result in old Eoulsan format instead of JSON
        Throws:
        IOException - if an error occurs while writing result
      • write

        public void write​(OutputStream out,
                          boolean oldFormat)
                   throws IOException
        Write the result.
        Parameters:
        out - output stream
        oldFormat - write the result in old Eoulsan format instead of JSON
        Throws:
        IOException - if an error occurs while writing result