Class ActionResult<O>

  • Type Parameters:
    O - output type of the action

    public class ActionResult<O>
    extends java.lang.Object
    Result object of a cockpit action.
    • Field Detail

      • SUCCESS

        public static final java.lang.String SUCCESS
        Result code for success. Means that the action was performed successfully.
        See Also:
        Constant Field Values
      • ERROR

        public static final java.lang.String ERROR
        Result code for error. Means that the action was not performed successfully because of an error.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ActionResult

        public ActionResult​(java.lang.String resultCode)
        Constructor with a result code.
        Parameters:
        resultCode - the result code of the action
        See Also:
        SUCCESS, ERROR
      • ActionResult

        public ActionResult​(java.lang.String resultCode,
                            O data)
        Constructor with a result code and data.
        Parameters:
        resultCode - the result code of the action
        data - data to be returned
        See Also:
        SUCCESS, ERROR
    • Method Detail

      • getData

        public O getData()
        Returns the output data returned by the performed action.
        Returns:
        output data returned by the performed action
      • setData

        public void setData​(O data)
        Sets the output data of the performed action.
        Parameters:
        data - output data of the performed action
      • getResultCode

        public java.lang.String getResultCode()
        Returns the result code of the action.
        Returns:
        result code of the action
        See Also:
        SUCCESS, ERROR
      • setResultCode

        public void setResultCode​(java.lang.String resultCode)
        Sets the result code of the action.
        Parameters:
        resultCode - result code of the action
        See Also:
        SUCCESS, ERROR
      • getResultMessage

        public java.lang.String getResultMessage()
        Returns the result message.
        Returns:
        result message
      • setResultMessage

        public void setResultMessage​(java.lang.String resultMessage)
        Sets the result message.
        Parameters:
        resultMessage - result message
      • getOutputsToSend

        public java.util.Map<java.lang.String,​java.lang.Object> getOutputsToSend()
        Returns socket outputs and data to be sent after the action is has performed.
        Returns:
        socket outputs and data to be sent after the action is has performed. Key of the map is the socket ID, value contains the data to be sent.
      • addOutputSocketToSend

        public void addOutputSocketToSend​(java.lang.String outputId,
                                          java.lang.Object outputData)
        Adds data to be sent to the output socket with the given ID after the action has performed.
        Parameters:
        outputId - output ID of the socket through which the data should be sent. It is a socket of the widget the action resides in.
        outputData - the data to be sent
      • addSocketAfterOperation

        public void addSocketAfterOperation​(BackgroundOperationDefinition definition)
        Registers a background operation.
        Parameters:
        definition - background operation
      • getSocketAfterOperation

        public java.util.List<BackgroundOperationDefinition> getSocketAfterOperation()
        Retuns all background operations.
        Returns:
        all background operations