Skip to content

This example illustrates how to create and use custom collection datasource in the CUBA Platform

Notifications You must be signed in to change notification settings

aleksey-stukalov/custom-datasource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custom-datasource

This example illustrates how to create and use custom collection datasources in your CUBA Application.

The application combines two showcases:

  1. Shows how to integrate 3rd party datasets, so for the example this application fetches data about currency rates through a collection datasource from this resource.
  2. Demonstrates how to enable pagination over your custom datasource.

Short Overview

Integrating 3rd Party Data

The CurrencyRate entity contains information about conversion rate between two currencies. The entity is not stored in the database, getting data through CurrencyService.

CurrencyServiceBean implements CurrencyService, parsing JSON response of the 3rd party service into a collection of CurrencyRate entities.

CurrencyRateDatasource wraps CurrencyService into a collection datasource to be able to use CUBA's standard mechanisms. As an example, this class is specified as a datasource class in currency-screen.xml; so the main table of the screen is filled automatically according to the specified datasource .

Enabling Pagination

To enable pagination in your custom datasource you should implement getEntities and getCount methods, as it is shown in FooCollectionDatasource and set a maximum nubmer of records to be returned in one page from the screen controller, where this datasource is used.

Based on CUBA Platform 6.3.1

About

This example illustrates how to create and use custom collection datasource in the CUBA Platform

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages