It is highly recommended to create our custom set of subclasses of the framework BC base classes and to build our BC model on the top of them. This gives us a certain flexibility and ability to control what's going on. But sometimes it would be cool to have our own extension at the middle layer, I mean the data control layer. A wide range of tricks can be done having a custom data control. I've already blogged about some and definitely will blog about many more. A lot of ADF developers are a bit scared of this technique and consider it as something from the dark side. But actually it's a very easy technique despite the power it gives to developers.
So, you have to make the following steps:
Create custom data control class:
It is recommended to use JUApplication as a base class for your custom data control:
Override the desired methods:
Create custom data control factory returning the class name of your custom data control:
Specify custom data control factory in the DataBindings.cpx file:
Enjoy!
That's it!
So, you have to make the following steps:
Create custom data control class:
It is recommended to use JUApplication as a base class for your custom data control:
public class AgileDataControl extends JUApplication { ...
Override the desired methods:
@Override protected void applySortCriteria(DCIteratorBinding iter, SortCriteria[] sortBy) { //Some job }
Create custom data control factory returning the class name of your custom data control:
public class AgileDataControlFactory extends DataControlFactoryImpl { @Override protected String getDataControlClassName() { return AgileDataControl.class.getName(); } }
Specify custom data control factory in the DataBindings.cpx file:
<BC4JDataControl id="AgileDataModelServiceDataControl" Package="agiledatamodel" FactoryClass="agiledatamodel.datacontrol.AgileDataControlFactory" ...
Enjoy!
That's it!