Professional Documents
Culture Documents
Oracle JDeveloper 11g is designed to make enterprise Java development more efficient and to allow developers be more productive. High productivity level can be achieved by using visual and declarative approach that is supported in JDeveloper 11g even on higher level comparing to previous JDeveloper releases. If you are looking for something more and further development simplification is needed, required efficiency level will be provided by the Oracle Application Development Framework (Oracle ADF) an enterprise Java development framework that implements design patterns and eliminates routine coding. JDeveloper provides menu options, wizards, dialogs and property windows related to Oracle ADF development and allow real declarative development based on design patterns implemented by Oracle ADF. Enterprise developer does not need to download any third-party extensions for successful development with JDeveloper, everything is provided out of the box. However, even if developer will miss some functionality, he can develop his own extension for JDeveloper. JDeveloper offers an extension SDK that developer can use to add desired functionality to JDeveloper. Developers familiar with JDeveloper 10g will find many new features in new release, however developers can reuse their best practices acquired during work with 10g. Goal of this paper is to show main steps applied during enterprise applications development with Oracle JDeveloper 11g based on Oracle ADF framework with ADF Business Components in Model layer and JSF in View-Controller layer.
Preparation
Download and install Oracle JDeveloper 11g from OTN: ? Go to http://www.oracle.com/technology/products/jdev/11/index.html download and after unzip, installation is done.
Download and install Oracle Database 10g Express Edition from OTN: ? Go to http://www.oracle.com/technology/products/database/xe/index.html from here you can download and install Oracle XE Database on your server or personal computer. When Oracle XE Database will be installed, unlock HR schema. You can unlock it from Database Home Page, go to Administration section and select Manage Users, you will see HR user schema displayed.
www.odtug.com
Baranovskis
List-Of-Values Components JDeveloper provides standard support for List-Of-Values (LOV) components development. LOV component is defined directly in Model layer, for View object attribute. It is easily possible to develop complex LOV components with data dependency. For example, if source defined for LOV component contains complex query logic with Bind variables, its possible to refer through defined variables to data available in current row.
(Employees.DEPARTMENT_ID = :CurrentDept OR Employees.MANAGER_ID IS NULL) AND Employees.EMPLOYEE_ID NOT IN (SELECT Employees1.EMPLOYEE_ID FROM EMPLOYEES Employees1 WHERE Employees1.MANAGER_ID = :CurrentEmp) AND Employees.EMPLOYEE_ID ! = :CurrentEmp
Calculated Attributes With Groovy expressions in JDeveloper 11g it became possible to develop calculated attributes declaratively. Its enough to open Edit Attribute wizard and provide needed expression for Value field.
www.odtug.com
Baranovskis
Dependent Validation Rules Validation logic can be implemented with validation rules directly on Entity objects in Model layer.
www.odtug.com
Baranovskis
Page Fragments and Regions Page Fragments and Regions allow to develop more dynamic applications with reusable components. If there is functionality in your application that is reused in several pages, you can put it into page fragment and reuse it. This will allow to develop reusable functionality only once. Page Fragments are not just independent parts of application, each Page Fragment can accept and return parameters. What is most important, when input parameter changes, Page Fragment can be automatically refreshed in order to reflect changes.
www.odtug.com
Baranovskis
<taskFlow id="taskflowemployeesdefinition1" taskFlowId="/WEB-INF/task-flow-employees-definition.xml#task-flow-employees-definition" xmlns="http://xmlns.oracle.com/adf/controller/binding" Refresh="ifNeeded"> <parameters> <parameter id="JobIdParam" value="#{bindings.jobIdVar_Attr.inputValue}" xmlns="http://xmlns.oracle.com/adfm/uimodel"/> </parameters> </taskFlow>
ADF Task Flows ADF Task Flow in JDeveloper 11g is a new feature that improves JSF page flow available in previous JDeveloper releases. With ADF Task Flow large navigation flow in application can be splitted into several smaller reusable modules. ADF Task Flow are much more than navigation transactions can be managed just directly within navigation modules. Exist possibility to call remote ADF Task Flows available in separate application, this allows to implement reusability on application level.
www.odtug.com
Baranovskis
ADF Faces Rich Client Oracle ADF Faces Rich Client provides standard set of JSF components with built -in Ajax functionality. With ADF Faces Rich Client its easy to use declarative development approach. Developer can drag and drop data bound components from component palette and generate menus, dialogs, tabs, accordions, dividers, forms and sortable tables. Such components as geographic maps, dynamic charts and graphs can be declaratively created with ADF Faces Rich Client as well. In Figure 9 you can see example of screen that contains ADF Faces Rich Client components.
www.odtug.com
Baranovskis
Web Service Invocation from ADF Application JDeveloper 11g allows to have Data Controls based on various sources ADF Business Components, EJB, Web Service, XML files, etc. In order to call Web Service, developer needs to create Data Control based on this Web Service. It can be done with JDeveloper 11g wizards. When Data Control structure is created, developer can operate with available actions in the same way as it is done with Data Control based on ADF Business Components.
<methodAction id=execute InstanceName=JobsArchive DataControl=JobsArchive RequiresUpdateModel=true Action=invokeMethod MethodName=execute IsViewObjectMethod=false> <NamedData NDName=JobID NDValue=${bindings.JobId.inputValue} NDType=java.lang.String/> <NamedData NDName=JobTitle NDValue=${bindings.JobTitle.inputValue} NDType=java.lang.String/> <NamedData NDName=MinSalary NDValue=${bindings.MinSalary.inputValue} NDType=java.math.BigDecimal/> <NamedData NDName=MaxSalary NDValue=${bindings.MaxSalary.inputValue} NDType=java.math.BigDecimal/> </methodAction>
Finally, when action to invoke Web Service is defined in Page Definition file, this action can be invoked Backing Bean method associated with command button. Below is listed code source needed to invoke action associated with Web Service.
Public String saveButton_action() { BindingContainer bindings = getBindings(); OperationBinding operationBinding = bindings.getOperationBinding(execute); operationBinding.execute(); operationBinding = bindings.getOperationBinding(Commit); Object result = operationBinding.execute(); if (!operationBinding.getErrors().isEmpty()) { return null; } return save; }
www.odtug.com
Baranovskis
Resources
1. 2. Oracle Technology Network (OTN) http://www.oracle.com/technology/index.html Andrejus Baranovskiss Blog http://andrejusb.blogspot.com
www.odtug.com