Showing posts from February, 2019

ADF BC REST service - Attachments

Source: 1) ADF BC REST, 2) Oracle JET application

Continuting on the previous discussion on ADF BC REST - Type Mapping - the framework can be stretched further to work with uploading files and images. Working with attachments is an important aspect in any commercial application; and ADF BC REST service provides us with a robust mechanism to store and display files and images through BLOB columns.

The following article discusses both about developing the REST service for storing documents in an Oracle database, as well as configuring an Oracle JET application which uploads and displays an image on the GUI.

The REST API I have added a PROFILE_IMAGE column of BLOB type to the employees table in the HR schema, and I will use this column for storing my attachments. BLOB columns are handled in a slightly different way by the REST API. The BLOB column is not included in the actual payload, but it comes as part of the links section, as an enclosure attribute.

The href value c…

ADF BC REST service - Type Mapping

This article talks about a powerful, yet under-utilized, feature of ADF BC - the data type mapping. Oracle ADF provides this feature to generate a runtime mapping between a View Object's String attribute and a Web Service's (both SOAP and REST) Boolean attribute.
The most popular use-case for this feature is to map a Boolean Active/Inactive flag from the service to a Yes/No value on the View Object. By default, ADF provides 3 mappings, which cover the following scenarios:
1. oracle.jbo.valuemaps.BooleanYNPropertySet - maps Y/N to true/false. 2. oracle.jbo.valuemaps.BooleanTFPropertySet - maps T/F to true/false. 3. oracle.jbo.valuemaps.Boolean10PropertySet - maps 1/0 to true/false.
These property sets are in adfm.jar, which is part of the ADF Model Runtime library.
The advantage of using a type mapping is a two-way binding - you may pass the String as well as the Boolean value in the payload, and the type mapper automatically translates to the required value t…