org.appng.api.support

## Class CallableAction

- java.lang.Object
- - org.appng.api.support.CallableAction

-     public class CallableAction
      extends Object

  A `CallableAction` is responsible for preparing and performing an `Action`, based on a given `ActionRef` which is part of a `PageDefinition`'s `SectionelementDef`.
  Author:
    Matthias Müller

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `CallableAction(Site site, Application application, ApplicationRequest applicationRequest, ActionRef actionRef)` Creates a new `CallableAction` and also determines the return values for `doInclude()` `doExecute()` `getOnSuccess()` , based on `Permissions` and `Condition`s.
    `protected` | `CallableAction(Site site, ApplicationRequest applicationRequest, ElementHelper elementHelper)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `doExecute()` Checks whether or not this `CallableAction` should execute the `ActionProvider` provided by the referenced `Action`.
    `boolean` | `doForward()` Checks whether this `CallableAction` causes a page-forward, which is the case when `hasErrors()` returns `false` and `getOnSuccess()` a non-`null` value
    `boolean` | `doInclude()` Checks whether or not to include this `CallableAction` on the `PageReference`.
    `Action` | `getAction()`
    `protected Object` | `getBindObject(FieldProcessor fieldProcessor)` Creates, fills and returns a new bindobject.
    `String` | `getOnSuccess()` Returns the forward-path that was defined by the `ActionRef` this `CallableAction` was build from.
    `boolean` | `hasErrors()` Checks whether some errors occurred while performing the `Action`.
    `FieldProcessor` | `perform()` Performs this `CallableAction`. If the `Action` is actually included and/or executed depends on the returns values of `doInclude()` and `doExecute()`.
    `FieldProcessor` | `perform(boolean isSectionHidden)` Performs this `CallableAction`. If the `Action` is actually included and/or executed depends on the returns values of `doInclude()` and `doExecute()`.
    `protected boolean` | `retrieveData(boolean setBeanNull)`
    `String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CallableAction

          public CallableAction(Site site,
                                Application application,
                                ApplicationRequest applicationRequest,
                                ActionRef actionRef)
                         throws ProcessingException

      Creates a new `CallableAction` and also determines the return values for
      - `doInclude()`
      - `doExecute()`
      - `getOnSuccess()`
      , based on `Permissions` and `Condition`s.
      Parameters:
        `site` - the current `Site`
        `application` - the current `Application`
        `applicationRequest` - the current `ApplicationRequest`
        `actionRef` - the `ActionRef` as given in the `SectionelementDef` of a `PageDefinition`.
      Throws:
        `ProcessingException` - if an error occurs while assembling the `CallableAction`

    - #### CallableAction

          protected CallableAction(Site site,
                                   ApplicationRequest applicationRequest,
                                   ElementHelper elementHelper)

  - ### Method Detail

    - #### getAction

          public Action getAction()

    - #### retrieveData

          protected boolean retrieveData(boolean setBeanNull)
                                  throws ProcessingException

      Throws:
        `ProcessingException`

    - #### perform

          public FieldProcessor perform()
                                 throws ProcessingException

      Performs this `CallableAction`.
      If the `Action` is actually included and/or executed depends on the returns values of `doInclude()` and `doExecute()`. If the `Action` is executed and a forward-path exists, a redirect is send via `Site.sendRedirect(Environment, String)`.
      Returns:
        a `FieldProcessor`, only non-`null` if the `Action` has been executed successfully
      Throws:
        `ProcessingException` - if an error occurred while performing
      See Also:
        `doInclude()`, `doExecute()`, `doForward()`, `getOnSuccess()`

    - #### perform

          public FieldProcessor perform(boolean isSectionHidden)
                                 throws ProcessingException

      Performs this `CallableAction`.
      If the `Action` is actually included and/or executed depends on the returns values of `doInclude()` and `doExecute()`. If the `Action` is executed and a forward-path exists, a redirect is send via `Site.sendRedirect(Environment, String)`.
      Parameters:
        `isSectionHidden` - whether this action is part of a hidden `Section`, meaning no `Messages` should be set for the action.
      Returns:
        a `FieldProcessor`, only non-`null` if the `Action` has been executed successfully
      Throws:
        `ProcessingException` - if an error occurred while performing
      See Also:
        `doInclude()`, `doExecute()`, `doForward()`, `getOnSuccess()`

    - #### getBindObject

          protected Object getBindObject(FieldProcessor fieldProcessor)
                                  throws BusinessException

      Creates, fills and returns a new bindobject.
      Parameters:
        `fieldProcessor` - the `FieldProcessor` to use
      Returns:
        a new bindobject
      Throws:
        `BusinessException` - if `ApplicationRequest.getBindObject(FieldProcessor, org.appng.forms.RequestContainer, ClassLoader)` throws such an exception
      See Also:
        `ApplicationRequest.getBindObject(FieldProcessor, org.appng.forms.RequestContainer, ClassLoader)`

    - #### doInclude

          public boolean doInclude()

      Checks whether or not to include this `CallableAction` on the `PageReference`.
      Returns:
        `true` if this `CallableAction` should be included, `false` otherwise

    - #### doExecute

          public boolean doExecute()

      Checks whether or not this `CallableAction` should execute the `ActionProvider` provided by the referenced `Action`.
      Returns:
        `true` if this `CallableAction` should be executed, `false` otherwise

    - #### hasErrors

          public boolean hasErrors()

      Checks whether some errors occurred while performing the `Action`.
      Returns:
        `true` if some errors occurred, `false` otherwise

    - #### getOnSuccess

          public String getOnSuccess()

      Returns the forward-path that was defined by the `ActionRef` this `CallableAction` was build from.
      Returns:
        the forward-path, may be `null`

    - #### doForward

          public boolean doForward()

      Checks whether this `CallableAction` causes a page-forward, which is the case when `hasErrors()` returns `false` and `getOnSuccess()` a non-`null` value
      Returns:
        `true` if a page-forward is caused, `false` otherwise

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.