Monday, September 16, 2019

Oracle ADF 12cR2 – Deploy Application as shared library and Use the taskflow in another Application


Nowadays I am working on different Banking application to digitize the process. I am working on application where 7 to 8 ADF developers working separately and building the taskflow for the single application which we need to integrate in one single application. This post I will explain how to deploy the application as shared library which contain taskflow and consume it in standalone ADF 12cR2 application.
First we will start with creating the new application and create the taskflow. I am using HR schema for Business component and creating one taskflow where I can drop employee View Object as as list. This application where we have created the taskflow
I have two below two application
SharedApp – contain one taskflow( Employee list) which we will deploy as shared library
StandaloneApp- Main application where we are consuming the above taskflow
Note: Rename the ViewController package to avoid the conflict of DataBindings.cpx file. Make sure both applications DataBindings.cpx file should have unique package name otherwise you will get below error.
oracle.jbo.JboException: JBO-29114 ADFContext is not setup to process messages f
or this exception. Use the exception stack trace and error code to investigate t
he root cause of this exception. Root cause error code is JBO-34010. Error messa
ge parameters are {0=view/DataBindings.cpx, 1=jar:file:H:/MWH_WEBCENTER/oracle/m
iddleware/user_projects/domains/wcp_domain/servers/AdminServer/tmp/_WL_user/Stan
dAloneDeploy_Project1_StandAloneDeploy/zdjg7x/war/WEB-INF/lib/SharedWEBAPPEMP.ja
r!/view/DataBindings.cpx, 2=jar:file:H:/MWH_WEBCENTER/oracle/middleware/user_pro
jects/domains/wcp_domain/servers/AdminServer/tmp/_WL_user/StandAloneDeploy_Proje
ct1_StandAloneDeploy/zdjg7x/war/WEB-INF/lib/_wl_cls_gen.jar!/view/DataBindings.c
px}
REPORT THIS AD
  • Right click on ViewController of SharedApp and create ADF library JAR File Deployment profile. Make sure Model is available and unselect the connection checkbox as we are going to use JNDI name.
ShardLib.JPG
Remove_Connection.JPG
Now Just right click on ViewController and deploy the ADF Library JAR File
  • Create the custom project in your application (SharedApp) which you want to deploy as shared library.
customproject
  • Create the WAR deployment Profile.  Check ADF Library JAR Profile dependency.
profiledependancy
Go to project properties and Add the library dependencies.
LibraryAdd.JPG
  • Remove the extra entries in web.xml Just keep as below.
<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
 version="3.0">
 </web-app>

  •  Right click on deployment profile and click on Refresh ADF Library dependencies.
  •  Right click on deployment profile again and Project properties -> Libraries and Classpath and remove the other libraries
SharedLIB RemoveOther.JPG
  • Deploy the application to the managed server as a shared library from JDeveloper
REPORT THIS AD

DeployShar.JPG
  • Login to the server and check the status of application

  • Now create the File system connection to particular shared library application.
Go to Resource -> IDE Connection -> File System
FIle Connection.JPG
Now in standalone application where we need to consume the application drag it particular taskflow from File System connection to the page.
Drag.JPG


Now you can deploy the EAR profile for this application as a standalone application.
DeployJDEV.JPG

SharedLIBDep.JPG
Now access the page containing the taskflow
output.jpg

Monday, September 9, 2019

Invoke a method from Managed Bean when JSPX Page Loads in ADF.

Requirment -invoke a method from Managed Bean when JSPX Page Loads in ADF.

Suppose you have some method in managed bean, which you want to call on page load.For that
Your managed bean should implement implements PagePhaseListener i.e
public class vinayManagedBean implements PagePhaseListener{ }
You should import “oracle.adf.controller.v2.lifecycle.PagePhaseListener;”
Now you will be calling method in beforePhase event of ADF page life cycle.In side the beforePhase ,pageLoad method will be called.You can write your custom method there.
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
onPageLoad();
}
}
 
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
// onPagePreRender();
}
}
 
public void onPageLoad() {
if (!AdfFacesContext.getCurrentInstance().isPostback()) {
// add your onPageLoad event here
 
// to set the View Criteria on the Iterator
doSomeOperation();  ///your custom method.
}
}
After all then right click on .jspx page and go to page definitions file .In your JSPX page definition make sure you add the ControllerClass that points to the managed bean that handles the onPageLoad event.
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.2.60.17" id="InspectionTaskHomePageDef"
                Package="oper.view.pageDefs" ControllerClass="vinayManagedBean">
  <parameters/>
By doint this whenever you page loads, the onPageLoad() method gets invoked which inturn invokes the v() method. You can even call multiple methods in onPageLoad() method.
Note:- It will not work in jsff.