Thursday, October 23, 2014

ADF BC View Object SQL Query Customization with MDS

This post is based on my previous article about MDS Seeded Customization - MDS Seeded Customization Approach with Empty External Project. Today I will focus on explaining how to customise SQL query for read-only VO. This is not so obvious as it sounds. However, it is doable - I will explain how.

Sample application - contains both main and customisation projects. Main project implements read-only VO for Jobs data, it doesn't include Job Title attribute:

This is how SQL query looks for such VO in the wizard:

We should take a look into the source code, SQL query is defined by SQLQuery tag. Tag doesn't have ID, this would disable tag customisation using JDEV MDS wizards:

No matter there is no ID set, we still could customise it - I will show you how. Here is the example of SQL query customisation stored in MDS customisation file. Firstly you should remove SQL query completely from VO and then add it again (this will create two entries in MDS customisation file). Once SQL query is written to the MDS customisation file, we can change it as we would like to - Job Title attribute is added to the SQL statement:

We need to add separately VO attribute for Job Title, this can be done through JDEV MDS customisation wizard. Make sure to set IsSelected=true property, otherwise attribute will not be set from the query:

You should drag and drop Job Title attribute from Data Control into the fragment, this will generate binding entry in the page definition file:

UI component for Job Title will be generated as ADF Faces output text:

You should notice on runtime customised SQL statement executed, this statement would include Job Title added through MDS customisation:

Job Title value is fetched and displayed on UI:

No comments: