Module: ojdataproviderfactory

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

QuickNav

JET Modules

See JET Module Loading for an overview of module usage within JET.

Description

This module contains a utility function getEnhancedDataProvider() that enhances a base DataProvier with additional capabilities.

The additional capabilites available are:

  • Caching - the wrapper DataProvider caches the results returned by the iterators of the base DataProvider. The wrapper DataProvider then optimizes fetch methods such as fetchByKeys, fetchByOffset, and containsKeys to retrieve data from cached items before calling the base DataProvider's methods for any missing data.
  • Mutate event filtering - the wrapper DataProvider excludes details of mutate events from the base DataProvider that are not within the range of items previously returned by its iterators.

Functions

getEnhancedDataProvider<K, D>(dataProvider, capabilityConfigurations) : {DataProvider.<K, D>}

Utility function that enhances a base DataProvier with additional capabilities by wrapping it in other DataProviders.
Parameters:
Name Type Description
dataProvider DataProvider.<K, D> The base DataProvider to enhance.

If this is a TreeDataProvider, the base DataProvider and each DataProvider returned by getChildDataProvider will be enhanced.

capabilityConfigurations CapabilityConfigurations Capabilities being requested. The capabilities of the base DataProvider will be checked to see if it already supports at least the requested capabilities. Any capability it doesn't support will be provided by wrapping DataProviders.

For example, if "visitedByCurrentIterator" caching is requested for the fetchFirst capability, and the base DataProvider already supports "all" or "visitedByCurrentIterator" caching, there is no need to wrap it.

Returns:

The outermost wrapping DataProvider. This may be the base DataProvider itself if it already supports all of the requested capabilities.

Type
DataProvider.<K, D>

Type Definitions

CapabilityConfigurations

Properties:
Name Type Argument Description
eventFiltering {type?: "iterator"} <optional>
If "iterator" is specified for the "type" property, enhance the base DataProvider to filter mutate events to hide items that are not within range of items that have been returned by its iterators.
fetchFirst {caching?: "visitedByCurrentIterator", totalFilteredRowCount?: "exact"} <optional>
If "visitedByCurrentIterator" is specified for the "caching" property, enhance the base DataProvider to cache the results returned by its iterators. Cached results, if available, can be returned when fetchByKeys, fetchByOffset, or containsKeys is called on the enhanced DataProvider.

If "exact" is specified for the "totalFilteredRowCount" property, enhance the base DataProvider to include totalFilteredRowCount in the iterator results. Note that this enhancement can be expensive because all rows will be iterated to determine totalFilteredRowCount.

Examples

Using getEnhancedDataProvider() to retrieve a wrapper DataProvider with mutate event filtering capability

const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider,
  {
    eventFiltering: {type: "iterator"},
  }
);

Using getEnhancedDataProvider() to retrieve a wrapper DataProvider with caching capability

const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider,
  {
    fetchFirst: {caching: "visitedByCurrentIterator"}
  }
);

Using getEnhancedDataProvider() to retrieve a wrapper DataProvider with all capabilities

const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider,
  {
    eventFiltering: {type: "iterator"},
    fetchFirst: {caching: "visitedByCurrentIterator"}
  }
);