Rest DAO
In the JBStrap framework, the lowest level of Rest webservice handling is using the RestDao API. This API implements all supported tasks available for the application. The task handled by the API is compatible with the DataRecord and Criteria classes.
Fetch
Use this functionality to programmatically retrieve data based on a DataDescriptor from a Rest server. In the data query, you can apply filter criteria to the query (if server side supports it). Filter criteria are JBStrap Criteria objects. Results are returned as DataRecord or List<DataRecord> objects. You can retrieve all the corresponding records or only a subset of the record for a faster response time.
If you specify the client object, the access rights in the DataDescriptor are checked. If a user does not have read rights for the data (as specified in the DataDescriptor), an error is returned, preventing unauthorized access to the data.
Note that by default, the the REST service does not handle filtering by using criteria, ordering, or fetching a new page. If these are not handled, or are only partially handled (only ordering is handled, etc.) the unhandled operations will not function. All of these operations can be implemented in numerous ways. JBStrap allows you to develop your own, custom implementations by using the handler classes.
Here are a few examples of how to fetch data using the Rest DataDescriptor:
Counting the records:
Save and update records:
Delete records: