org.appng.api.support

## Class CallableDataSource

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

-     public class CallableDataSource
      extends Object

  A `CallableDataSource` is responsible for preparing and performing an `Datasource`, based on a `DatasourceRef`. This `DatasourceRef` is provided either by a `PageDefinition`'s `SectionelementDef` or by an `Action`.
  Author:
    Matthias Müller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallableDataSource(Site site, Application application, ApplicationRequest applicationRequest, ParameterSupport parameterSupport, DatasourceRef datasourceRef)` Creates a new `CallableDataSource` and also determines the return value for `doInclude()`, based on `Permissions` and `Condition`s.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `doInclude()` Checks whether or not to include this `CallableDataSource` on the referencing `PageReference` or `Action`.
    `Datasource` | `getDatasource()`
    `Data` | `perform(String pageId)` Performs this `CallableDataSource`, setting the `Bean` `null` afterwards.
    `Data` | `perform(String pageId, boolean addMessagesToSession)` Performs this `CallableDataSource`, setting the `Bean` `null` afterwards.
    `Data` | `perform(String pageId, boolean setBeanNull, boolean addValidation)`
    `Data` | `perform(String pageId, boolean setBeanNull, boolean addValidation, boolean addMessagesToSession)` Performs the `CallableDataSource`. Note that the caller needs to check if the `Datasource` should be included by itself (by calling `doInclude()`), as this method doesn't check that condition.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### CallableDataSource

          public CallableDataSource(Site site,
                                    Application application,
                                    ApplicationRequest applicationRequest,
                                    ParameterSupport parameterSupport,
                                    DatasourceRef datasourceRef)
                             throws ProcessingException

      Creates a new `CallableDataSource` and also determines the return value for `doInclude()`, based on `Permissions` and `Condition`s.
      Parameters:
        `site` - the current `Site`
        `application` - the current `Application`
        `applicationRequest` - the current `ApplicationRequest`
        `parameterSupport` - the `ParameterSupport` holding the parameters for the `Datasource`
        `datasourceRef` - the `DatasourceRef` as given in the `SectionelementDef` of a `PageDefinition` or by an `Action`.
      Throws:
        `ProcessingException` - if an error occurs while assembling the `CallableDataSource`

  - ### Method Detail

    - #### getDatasource

          public Datasource getDatasource()

    - #### perform

          public Data perform(String pageId)
                       throws ProcessingException

      Performs this `CallableDataSource`, setting the `Bean` `null` afterwards.
      Throws:
        `ProcessingException`
      See Also:
        `perform(String, boolean, boolean, boolean)`

    - #### perform

          public Data perform(String pageId,
                              boolean addMessagesToSession)
                       throws ProcessingException

      Performs this `CallableDataSource`, setting the `Bean` `null` afterwards.
      Throws:
        `ProcessingException`
      See Also:
        `perform(String, boolean, boolean, boolean)`

    - #### perform

          public Data perform(String pageId,
                              boolean setBeanNull,
                              boolean addValidation)
                       throws ProcessingException

      Throws:
        `ProcessingException`
      See Also:
        `perform(String, boolean, boolean, boolean)`

    - #### perform

          public Data perform(String pageId,
                              boolean setBeanNull,
                              boolean addValidation,
                              boolean addMessagesToSession)
                       throws ProcessingException

      Performs the `CallableDataSource`.
      Note that the caller needs to check if the `Datasource` should be included by itself (by calling `doInclude()`), as this method doesn't check that condition.
      Parameters:
        `pageId` - the ID of the current page
        `setBeanNull` - whether or not to set the `Bean` of the `Datasource` to `null` after performing
        `addValidation` - whether or not to add validation metadata
        `addMessagesToSession` - if `Messages` should be added to the session or kept on the `Datasource`
      Returns:
        the `Data` retrieved from the `Datasource` by calling `DataProvider.getData(Site, Application, org.appng.api.Environment, Options, org.appng.api.Request, org.appng.api.FieldProcessor)`
      Throws:
        `ProcessingException` - if an error occurs while retrieving the `Data`

    - #### doInclude

          public boolean doInclude()

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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