Monday, August 8, 2016

Seeded Customization : Understanding XML

Seeded Customization :
The very importance part of Oracle ADF framework is MDS. And this is what it’s make biggest different among Java EE framework.
If you observed or everyone know that ADF is heavily relay on XML and same applicable with MDS too. MDS is very wide it is not only used in ADF but other oracle fusion middleware application too.You will able to found a lot of blogs and documents which explained the same topic.
Therefore I will not explained basic thing here which include configuration and enabling customization. 

You can customize Oracle ADF application which basically follow in below category.
1-Seeded Customization
2-User Customization.

This post is limit to seeded customization.

User Case :
Adding component : The this requirement come under seeded customization. I have one page where I am showing all the employee records from employee table of HR schema. However I am only showing four column (employee id , first name , last name and email ). But for site customization layer I need to show one more column. I am using SiteCC customization class which come with Oracle ADF.

1-I have created application with above requirement. And also preconfigure customization layer and open jdeveloper into customization development.If you observer below screen most of files are locked which mean you cannot write code however xml file are available for change.


The below XML file is not available for changes.

1-adfm.xml
2-adf-setting.xml
3-faces-config.xml
4-trinidad-config.xml
5-web.xml
6-All the file under META-INF

Which make sense , there is no purpose of allow customization in these files.

What does this means ? It mean that we can customize pagedef file , data control files , taskflow flies , entity object , view object and application module , fragment pages.

2-After opening jdeveloper in customization mode , I have drag and drop salary attribute from data control to the page and I have observed the below changes.

a-Change inside the fragment page.


<mds:customization version="12.2.1_20151011.0031" xmlns:mds="http://xmlns.oracle.com/mds">
<mds:insert parent="t1" position="last" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:column xmlns:af="http://xmlns.oracle.com/adf/faces/rich" headerText="#{bindings.EmployeeView1.hints.Salary.label}" id="sc1">

<af:outputText xmlns:af="http://xmlns.oracle.com/adf/faces/rich" value="#{row.Salary}" shortDesc="#{bindings.EmployeeView1.hints.Salary.tooltip}" id="sot1">

<af:convertNumber xmlns:af="http://xmlns.oracle.com/adf/faces/rich" groupingUsed="false" pattern="#{bindings.EmployeeView1.hints.Salary.format}" />

</af:outputText>

</af:column>

</mds:insert>

</mds:customization>


b-Change inside the page def file.

<mds:customization version="12.2.1_20151011.0031" xmlns:mds="http://xmlns.oracle.com/mds">
<mds:insert parent="EmployeeView1(xmlns(mds_ns1=http://xmlns.oracle.com/adfm/uimodel))/mds_ns1:nodeDefinition[@Name='EmployeeView10']/mds_ns1:AttrNames" position="last">
<Item Value="Salary" xmlns="http://xmlns.oracle.com/adfm/uimodel" />
</mds:insert>
</mds:customization>


 If you observer able XML file which is outcome of dragging and dropping component. I feel oracle use DOM java API to parse XML file.

1-First let us try to understand fragment file code. (EmployeeHome.jsff.xml)

The page start and end with <mds:customization>. Since i have added component therefore the child component is <mds:insert>. If you observer this you can see it has parent and position attribute. parent attribute value is ="t1" which is id of table. and since i have added as last therefore position is last.

2-EmployeeHomePageDef.xml.xml file.
This is also start and end with <mds:customization>  and then insert tag.


You can find Sample Application from below location.
1-https://github.com/prateekazam/SeededCustomizationApp.

And i have used jdeveloper 12.2.1.0