Class ResponseActionsBuilder


  • public class ResponseActionsBuilder
    extends Object
    This class is a helper that can be used to build the standard response actions of a BaseProcessActionHandler in an easy way.
    • Method Detail

      • showMsgInView

        public ResponseActionsBuilder showMsgInView​(ResponseActionsBuilder.MessageType msgType,
                                                    String msgTitle,
                                                    String msgText)
        It shows a message in the current active view.
        Parameters:
        msgType - The message type.
        msgTitle - The title of the message.
        msgText - The text of the message.
        Returns:
        a ResponseActionsBuilder that contains a 'show message in view' response action.
      • showMsgInProcessView

        public ResponseActionsBuilder showMsgInProcessView​(ResponseActionsBuilder.MessageType msgType,
                                                           String msgTitle,
                                                           String msgText,
                                                           boolean force)
        It shows a message in the view that invoked the process.
        Parameters:
        msgType - The message type.
        msgTitle - The title of the message.
        msgText - The text of the message.
        force - If it should force the message to be show in the pop-up. Typically it is used in error cases together with the retryExecution action.
        Returns:
        a ResponseActionsBuilder that contains a 'show message in process view' response action.
      • openDirectTab

        public ResponseActionsBuilder openDirectTab​(String tabId,
                                                    String recordId,
                                                    ResponseActionsBuilder.Command command,
                                                    String criteria,
                                                    boolean wait)
        Opens a view using a tab id and record id. The tab can be a child tab. If the record id is not set then the tab is opened in grid mode.
        Parameters:
        tabId - The id of the tab to be opened.
        recordId - The id of the record to be opened.
        command - The command to be used to open the tab ('DEFAULT', 'NEW').
        criteria - A removable filtering criteria which will be automatically added to the open tab
        wait - If true, the next response action will not be started until this one finishes.
        Returns:
        a ResponseActionsBuilder that contains a 'open direct tab' response action.
      • setSelectorValueFromRecord

        public ResponseActionsBuilder setSelectorValueFromRecord​(String recordId,
                                                                 String recordIdentifier)
        It sets a given value in the selector caller field (if it exists).
        Parameters:
        recordId - The id of the record to be set in the selector.
        recordIdentifier - The identifier of the record to be set in the selector.
        Returns:
        a ResponseActionsBuilder that contains a 'set selector value' response action.
      • refreshGrid

        public ResponseActionsBuilder refreshGrid()
        It refreshes the grid where the process button is defined. This is commonly used when the process adds or deletes records from that grid.
        Returns:
        a ResponseActionsBuilder that contains a 'refresh grid' response action.
      • refreshGridParameter

        public ResponseActionsBuilder refreshGridParameter​(String gridName)
        It refreshes a grid parameter defined within a parameter window. This can be useful for those parameter windows which are not closed after the execution of the action handler, for example those process definitions which are directly opened from the application menu.
        Parameters:
        gridName - The name of the grid parameter.
        Returns:
        a ResponseActionsBuilder that contains a 'refresh grid parameter' response action.
      • retryExecution

        public ResponseActionsBuilder retryExecution()
        Allows to re-execute the process again, by enabling the process UI. This is useful to do backend validations as this allows the user to fix data and resubmit again.
        Returns:
        a ResponseActionsBuilder configured to retry the process execution.
      • retryExecution

        public ResponseActionsBuilder retryExecution​(ResponseActionsBuilder.MessageType msgType,
                                                     String msgText)
        Allows to re-execute the process again, by enabling the process UI. This is useful to do backend validations as this allows the user to fix data and resubmit again. In addition, a message will be displayed with the severity and the text specified with the parameters of this method.
        Parameters:
        msgType - The message type.
        msgText - The text of the message.
        Returns:
        a ResponseActionsBuilder configured to retry the process execution.
      • retryExecution

        public ResponseActionsBuilder retryExecution​(ResponseActionsBuilder.MessageType msgType,
                                                     String msgTitle,
                                                     String msgText)
        Allows to re-execute the process again, by enabling the process UI. This is useful to do backend validations as this allows the user to fix data and resubmit again. In addition, a message will be displayed with the severity, title and text specified with the parameters of this method.
        Parameters:
        msgType - The message type.
        msgTitle - The title of the message.
        msgText - The text of the message.
        Returns:
        a ResponseActionsBuilder configured to retry the process execution.
      • showResultsInProcessView

        public ResponseActionsBuilder showResultsInProcessView()
        Allows to configure the response to show the result of a process directly in the process window itself.
        Returns:
        a ResponseActionsBuilder configured to show the result in the process window itself.
      • build

        public org.codehaus.jettison.json.JSONObject build()
        Generates the JSON with the response actions to be executed once the process has finished.
        Returns:
        a JSONObject with the response actions.