com.microfocus.awm.control.toolexecution

## Class ToolResult

- java.lang.Object
- - com.microfocus.awm.control.toolexecution.ToolResult

- All Implemented Interfaces:
    IToolResult

      public class ToolResult
      extends java.lang.Object
      implements IToolResult

  Standard implementation of `IToolResult`.
  Author:
    Micro Focus

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ToolResult(IToolContext pToolContext)` Creates a new tool result without a tool message, no output parameters and severity `ToolResultSeverity.OK`.
    `ToolResult(IToolContext pToolContext, IToolOutput pToolOutput)` Creates a new tool result with tool output, no message and severity `ToolResultSeverity.OK`.
    `ToolResult(IToolContext pToolContext, java.lang.String pMessage, IToolResultSeverity pSeverity)` Creates a new tool result with a message and severity.
    `ToolResult(IToolContext pToolContext, java.lang.String pMessage, IToolResultSeverity pSeverity, IToolOutput pToolOutput)` Creates a new tool result with a message, severity and tool output.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `IToolResultSeverity` | `getSeverity()` Gets the severity of the execution result.
    `IToolContext` | `getToolContext()` Gets the tool context that was used for executing the tool descriptor.
    `ToolDescriptor` | `getToolDescriptor()` Gets executed tool descriptor.
    `java.lang.String` | `getToolMessage()` Gets the returned tool message or `null`, if the tool does not return a message.
    `IToolOutput` | `getToolOutput()` Returns the `IToolOutput`.
    `void` | `setSeverity(IToolResultSeverity pSeverity)` Sets the result's severity.
    `void` | `setToolMessage(java.lang.String pToolMessage)` Sets the result message.
    `void` | `setToolOutput(IToolOutput pToolOutput)` Sets the result's tool output.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ToolResult

          public ToolResult(IToolContext pToolContext)

      Creates a new tool result without a tool message, no output parameters and severity `ToolResultSeverity.OK`.
      Parameters:
        `pToolContext` - the tool context

    - #### ToolResult

          public ToolResult(IToolContext pToolContext,
                            IToolOutput pToolOutput)

      Creates a new tool result with tool output, no message and severity `ToolResultSeverity.OK`.
      Parameters:
        `pToolContext` - the tool context
        `pToolOutput` - the tool output

    - #### ToolResult

          public ToolResult(IToolContext pToolContext,
                            java.lang.String pMessage,
                            IToolResultSeverity pSeverity)

      Creates a new tool result with a message and severity.
      Parameters:
        `pToolContext` - the tool context
        `pMessage` - tool message
        `pSeverity` - severity

    - #### ToolResult

          public ToolResult(IToolContext pToolContext,
                            java.lang.String pMessage,
                            IToolResultSeverity pSeverity,
                            IToolOutput pToolOutput)

      Creates a new tool result with a message, severity and tool output.
      Parameters:
        `pToolContext` - the tool context
        `pMessage` - tool message
        `pSeverity` - severity
        `pToolOutput` - tool output

  - ### Method Detail

    - #### getToolMessage

          public java.lang.String getToolMessage()

      Description copied from interface: `IToolResult`
      Gets the returned tool message or `null`, if the tool does not return a message.

      Tool messages will always be displayed to the user after the action has finished or when the tool returned an error severity. Therefore tools should not return messages for debug/trace purposes, since it will affect the user experience.

      Specified by:
        `getToolMessage` in interface `IToolResult`
      Returns:
        the tool message or `null`
      See Also:
        `IToolResult.getSeverity()`

    - #### getSeverity

          public IToolResultSeverity getSeverity()

      Description copied from interface: `IToolResult`
      Gets the severity of the execution result.

      The returned severity can affect the executed action in two ways:

      1. `Information`, `Warning` and `Error` severities affect how returned tool messages are being displayed.
      2. An `Error` severity will cause the action to be aborted, preventing any subsequent tool descriptor to be executed.
      Specified by:
        `getSeverity` in interface `IToolResult`
      Returns:
        the severity
      See Also:
        `ToolResultSeverity`

    - #### getToolDescriptor

          public ToolDescriptor getToolDescriptor()

      Description copied from interface: `IToolResult`
      Gets executed tool descriptor.
      Specified by:
        `getToolDescriptor` in interface `IToolResult`
      Returns:
        the tool descriptor

    - #### getToolContext

          public IToolContext getToolContext()

      Description copied from interface: `IToolResult`
      Gets the tool context that was used for executing the tool descriptor.
      Specified by:
        `getToolContext` in interface `IToolResult`
      Returns:
        the tool context

    - #### getToolOutput

          public IToolOutput getToolOutput()

      Description copied from interface: `IToolResult`
      Returns the `IToolOutput`.
      Specified by:
        `getToolOutput` in interface `IToolResult`
      Returns:
        the tool output

    - #### setToolOutput

          public void setToolOutput(IToolOutput pToolOutput)

      Sets the result's tool output.
      Parameters:
        `pToolOutput` - the output to set. Must not be `null`.

    - #### setSeverity

          public void setSeverity(IToolResultSeverity pSeverity)

      Sets the result's severity.
      Parameters:
        `pSeverity` - the severity to set. Must not be `null`.

    - #### setToolMessage

          public void setToolMessage(java.lang.String pToolMessage)

      Sets the result message.
      Parameters:
        `pToolMessage` - the tool message. Can be `null`.

Copyright © 2015 Micro Focus GmbH. All rights reserved.