Tuesday, 28 January 2014

ADF: Getting the current row clicked.

If your application has table and if user is clicking some of the action component(Button, Link) in the table, How will you get the user clicked row in the back-end code.

See one of the easiest solution below.


DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iteratorBinding = (DCIteratorBinding)bindings.get("sampleVO1Iterator");
        //_logger.info("iteratorBinding===="+iteratorBinding);
       

        if (iteratorBinding != null) {
            sampleVORowImpl currentRow = (sampleVORowImpl)iteratorBinding.getCurrentRow(); // this is the user clicked row.

In the attached source code, there is page1.JSF page, run it and click on the manager id(id click here) and check in the console. In the console whichever manager id you have clicked it will be printed.

Download the source code below.
Download

ADF : How to get the value of the Input Parameter Definitions through the code.

String scopeVariableValue = (String)this.getElExpression("#{pageFlowScope.variable}"); // pageFlowScope.variable is a Input Parameter Definitions variable

    public Object getElExpression(String el) { 
      
        FacesContext objFacesContext = FacesContext.getCurrentInstance();
        ELContext objELContext = objFacesContext.getELContext();
        ExpressionFactory objExpressionFactory = objFacesContext.getApplication().getExpressionFactory();
        ValueExpression objValueExpression =
            objExpressionFactory.createValueExpression(objELContext, el, Object.class);

        return objValueExpression.getValue(objELContext);
    }



Tuesday, 21 January 2014

Life Cycle of ADF

Different phases of ADF Life Cycle

1)Restore View:  Whenever Url lands in the browser, the view name in the URL is compared in the databindings.cpx file and from the cpx file, view path is available. If there is no state(Invoking the url first time) on the server side, response will be rendered. If there is any state on server side, view will follow the further life cycle steps.

2)Apply Request Values:  These are the user input values, these values will be applied to the ADF components.

3)Process Validations: If there are any validations provided to the ADF components, those validations will be evaluated. If any validation fails, error response will be rendered.

4)Update Model Values:  The values provided by the user enters in to the model layer.

5)Validate Model Values: If there are any model layer validations (entity level validations) they will get evaluated. If any validation fails, error response will be rendered.

6)Invoke Application: If any action(button click) gets execute, navigation to the different view will take place and response will be rendered. If there is no action this phase will be skipped.

7)Render Response:  The new component values will be rendered and the state gets stored on the server

Friday, 20 December 2013

ADF Mobile.

Its always probably exciting for a developer to develop mobile app's. As I have experience working in ADF Framework. I am choosing Oracle ADF to start developing mobile app's. Rather if I had chosen Android Platfrom or iOS Platfrom ,it would make me to learn new stuff's. If you are working in ADF, independent of iOS and Android platform, one can deploy the application in both the platform, this is the major advantage of ADF Framework. I have went through the ADF Mobile videos and tried one application in debug mode. Deployed the app on the android emulator, the bad thing is ADF app's are very slow in emulator. The same app , I have installed in the android device, the app is faster compare to emulator but comparing to normal app its too slow. The one reason for slow, I have used debug mode to deploy the app. I could have used release mode, but unfortunately the release mode didn't work for me(getting error). On the internet i searched ADF stuffs, found that Android 4 and above has support for HTML5 and make it best choice for ADF app's. Learn that ADF app's are fast on Android4 and above. Easy to learn, Declarative approach, Look and feel makes ADF as the best choice for mobile app's.

Continue.............