Tuesday, February 4, 2014

Progress Bar in ADF

This artical is going to demo on how to place Progress Bar in ADF pages.

Version:

JDEV 11.1.1.5


Step1:
Create ADF Fusion Web Application using JDev.


Step2;
Create First.jspx and Second.jspx files. Add them in adfc-config then link them

Step3:
Create a managedbean and add it in taskflow

Step4:
update First.jspx, add the action listener for a command link to the bean.

Step5:
update the bean to add some Thread sleep to delay the response.

Step6:
update the First.jspx, add the javascript; add the popup; add the clientlistener in the command link.

Step7:
Save All, run the First.jspx file.


First.jspx:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document id="d1">
      <af:resource type="javascript">
        function enforcePreventUserInput(evt) {
            var popup = AdfPage.PAGE.findComponentByAbsoluteId('pt_p1');
            if (popup != null) {
                AdfPage.PAGE.addBusyStateListener(popup, handleBusyState);
                evt.preventUserInput();
            }
        }
        function handleBusyState(evt) {
            var popup = AdfPage.PAGE.findComponentByAbsoluteId('pt_p1');
            popup.show();
            if (popup != null) {
                if (evt.isBusy()) {
                    popup.show();
                }
                else if (popup.isPopupVisible()) {
                    popup.hide();
                    AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState);
                }
            }
        }
      </af:resource>    
      <af:form id="f1"
               inlineStyle="text-align:center; vertical-align:baseline; margin:20px; padding:20px; font-size:large; color:Blue; border-color:Fuchsia; border-style:double; text-decoration:none;">
        <af:panelGroupLayout id="pgl1" layout="vertical" halign="center"
                             valign="middle"
                             inlineStyle="text-align:center; vertical-align:middle;">
           <af:outputText value="FIRST PAGE" id="ot1"/>
           <af:commandLink text="Go2Second" id="cl1" actionListener="#{ProgressBean.onSecondAL}" action="second" inlineStyle="font-size:medium; text-decoration:underline;">
            <af:clientListener method="enforcePreventUserInput" type="action"/>
          </af:commandLink>
        </af:panelGroupLayout>
      </af:form>
      <af:popup id="pt_p1" contentDelivery="immediate">
        <af:dialog id="pt_d1" type="none" closeIconVisible="false">
          <af:panelGroupLayout id="pt_pgl15" layout="vertical" halign="center">
            <af:outputText id="ot15"
                           value="Please wait while your request is being processed..."
                           inlineStyle="font-family:Arial, Helvetica, sans-serif; font-size:12px;"/>
            <af:spacer width="1" height="20" id="s16"/>
            <af:image source="/image/spinningwheel.gif" shortDesc="System Busy"
                      id="pt_i1"/>
          </af:panelGroupLayout>
        </af:dialog>
      </af:popup>
    </af:document>
  </f:view>
</jsp:root>



Second.jspx;
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document id="d1">
      <af:form id="f1">
        <af:outputText value="SECOND PAGE" id="ot1"/>
      </af:form>
    </af:document>
  </f:view>
</jsp:root>

Bean:
package org.sen.poc.view;

import javax.faces.event.ActionEvent;

public class ProgressBean {
    public ProgressBean() {
    }

    public void onSecondAL(ActionEvent actionEvent) {
        // Add event code here...        
        System.out.println("onSecondAL() invoked.");
        for(int i=0;i<3;i++) {
            try {
                Thread.sleep(1000);
                System.out.println("Thread.sleep...");
            } catch (InterruptedException e) {
            }
        }
    }
}


Tuesday, February 19, 2013

Maven and Profile

How to create a Maven Project in Eclipse:

1. Install Eclipse 4.2.0 (Juno) or latest
2. Add the maven plugin in Eclipse using the following update site URL.
      http://m2eclipse.sonatype.org/sites/m2e
(or)
      http://m2eclipse.sonatype.org/update/ 
(or)
      http://m2eclipse.sonatype.org/update-dev/ 
3. Create Maven Project
















4. Run the Project using Maven.


How to use Profile in maven build?

Create Maven POM and Profile file under the root folder:


  1. Maven pom file is               : pom.xml
  2. Maven profile file name is   : profile.xml








This i how you have to refer the profile file in Maven POM.xml file:

Wednesday, February 13, 2013

ADF Business Comonent

ADF Business Componenet ( BC)

ViewObject:
View Object is nothing but the SQL Query Object. It represents a row of a table.
http://docs.oracle.com/cd/E15051_01/web.1111/b31974/bcquerying.htm

Advanced View Object:
If you are not using Table/DB and want to have a View Object using your own populated values or programatically. then refer this section;
http://docs.oracle.com/cd/E15051_01/web.1111/b31974/bcadvvo.htm#sm0331

http://docs.oracle.com/cd/E15051_01/web.1111/b31974/bcquerying.htm



Friday, February 8, 2013

ADF WebService


1. How to Invoke a Web Service using ADF.

There are many ways to invoke the Web service in ADF. One of the best and controllable way is Proxy way. Follow the steps below to do so.

Steps to Invoke Web Service:
1. you should have admin rights in your PC
2. Install JDeveloper 11.1.1.5.0 ( you can download it from Oracle Site)
3. Create a Generic / Model Application
4. Create a Generic/Model Project under the application.
5. Right click on the project, NEW -> Web Service (under All technologies , Business Components) -> Web Service Proxy.
6. Follow the Wizard ( it copies the WSDL into your local) and Finish.
7. Open the Client file "XYZSoapHttpQSPortClient.java"
8. Right client on client file and Run. it will invoke the Web service.


<TBD> For the following, come back  blog later....
1. How to Create a Data control from a Web service (WSDL)
2. How to make the WebService Data control as a re-usable Service in ADF.
3. How to invoke the Webservice DataControl in your Viewcontroller Layer
4. How to test and dubug
5. How to modify the WebService Datacontrol when the WSDL has been changed,
6. What is the advantage and dis-advantrage of using the WebService Datacontrol.
7. How to create Data Controll for Secured webservice
8.  How to create Java client proxy from Webservice WSDL in ADF?
9. How to Adjust the Endpoint for a Web Service Data Control ( when moving test env to prod)




References:
Oracle Blog:
https://blogs.oracle.com/middleware/entry/calling_web_services_using_adf_11g

Oracle Doc;
http://docs.oracle.com/cd/E16162_01/web.1112/e16182/web_services.htm
http://www.oracle.com/technetwork/developer-tools/jdev/overview/index-100269.html
http://www.oracle.com/webfolder/technetwork/tutorials/obe/jdev/obe11jdev/ps1/webservices/ws.html

Vedios:
http://www.youtube.com/watch?v=XF18vXxYkxM

Friday, February 24, 2012

Oracle ADF



"Application Development Framework" - here you start your carrier.

I am a software application developer. I want a Framework based IDE to develop my application. What is the best IDE? the Answer is ADF.

How to Start and Where to Start ( HS / WS)? Answer is Google + ADF, click on the first link.