Methods

ServiceDataProvider implements most methods from oj.DataProvider, except for the isEmpty method.

Most ServiceDataProvider methods, such as fetchFirst, fetchByKeys, fetchByOffset, containsKeys, and getCapabilities, are called by the component that interfaces with the DataProvider implementation and will rarely need to be used directly. The getTotalSize method is an exception to this general rule.

getTotalSize method

The getTotalSize method returns a Promise that resolves to the total size of data available on the service endpoint. If a positive number is not set in the response transforms, a size of -1 is returned. Generally the returned value is the canonical size of the (endpoint) fetch when no search criteria is applied. In other words, this value is meant to be the same every time a fetch is called against the endpoint.

Because page authors often want the convenience of binding the totalSize on the page, vb/ServiceDataProvider supports a totalSize property that is a number. This can be used instead of the getTotalSize method, which is used by JavaScript callers.

For example, a page author can use the totalSize property of the ServiceDataProvider in markup as follows:

<oj-bind-text id="totalIncRows"
  value="[[ $variables.incidentListDataProvider.totalSize ]]"></oj-bind-text>

Features and Capabilities

Page authors generally need not be concerned with this, but it's generally useful to understand the features and capabilities that SDP supports. For details refer to JET DataProvider#getCapability.

At design time, a page author may need to know what features and capabilities the endpoint supports, and they may need to configure the correct properties and transforms.