Tuesday, 28 February 2017

Oracle Open Interface

What is Oracle open interfaces?

Open interfaces used to integrate Oracle Applications with the non-oracle systems.
such as
1. Import data from your custom applications or legacy systems.
2. Migrate the old custom application data to the Oracle applications.
3. Import data from the banks, partners, suppliers, customers etc.


What is conversion?

Conversion is a one time Interface to migrate data from legacy application to the Oracle


Inbound Interface
The Interface which transforms and loads the data into the Oracle Applications system is called inbound interface.


Outbound Interface
The Interface which extracts the data from the oracle Application system for the purpose of loading into the external system is called outbound interface.


Common approach to interface is
  1. Data would be extracted from the source machine and loaded into the custom table (stagging table) in Oracle apps database. Depending upon the complexity of the data Stagging table can be avoided.
  2. The extracted data is then transformed into a form which oracle can recognize and pushed into interface tables.
  3. Final step is load the data from interface table to base table of Oracle applications.
This whole process is called extract load and transformation (ETL).


Oracle provides Interface tables for data intensive applications like Invoice, receipts, journals etc and PL/SQL APIs for master data interfaces like people, items, suppliers etc.


Traditional approach used sql Loader to load the data and pl/sql program to validate and extract data.
Modern approach uses BPEL, ESB for online data interfaces and Oracle Data Integrator for data intensive batch processing.


Common Interface technologies
1. XML Gateway
2. SQL*Loader
3. DB Link
4. Java Concurrent Program
5. BPEL or ESB
6. Oracle Data Integrator or ODI
7. PL/SQL package for reading file or XML data
8. Oracle Advanced Queuing


Some Useful Links

1. Oracle Integration Repository - List of Oracle open interfaces
2. Technical reference Manual - Column level details of Interface tables, base tables and APIs
3. Technical reference Manual for different versions.

Debug bc4j objects or ADF BC Objects

How to debug the VO, LOV, poplist queries?

You can see the executed queries and its bind values in the jdeveloper console or messages window.
By default, this option is not available in jdeveloper.

To enable the debug console option in 11g and 12c

I was just going through my previous posts and found the this option still works on Jdeveloper 11g and 12c. So you could use the debug option on the ADF BC - Model project and it will log all the queries on the jDeveloper console during execution.

Just follow same set of instructions as given for 10g jdeveloper.


To enable the debug console option in 10g

1. Right click on project and select project properties

2. Select Run/Debug

3. Ensure Default in selected in Run configurations

4. Select Edit button.

5. You can see the Launch Settings window.

6. Add the following parameter in the java options
-Djbo.debugoutput=console

7. Select OK

8. Rebuild the project and run again to see the debug information in jdeveloper log window







To enable the debug console option in Jdev 9i1. Right click on project and select project properties

2. Navigate Configurations -> Development -> runner

3. Add the following parameter in the java options
-Djbo.debugoutput=console

4. Select OK

5. Rebuild the project and run again to see the debug information in jdeveloper log window







This option would be very helpful in finding out what going on in the bc4j objects. Including LOV queries, poplist queries, VOs etc. Whenever the query is executed through the AM or procedure is called, the bind variable values and executed sql will be displayed in the jdeveloper message window.

How to Call PL/SQL from ADF?

You can use the following code to call a pl/sql block from the ADF bc Application module.


public void executePlsqlProcedure(){

CallableStatement updateStmt = null;
try {
// Put your PL/SQL block in a String variable.
String Stmt = "begin delete test_table where header_id = :1; "+
" :2 = xxx_pkg.yyy_function(); end;";
OADBTransaction txn = getDBTransaction();

// Pass the PL/SQL block to the callable Statement
updateStmt = txn.createCallableStatement(Stmt, 1);


// Set all the bind variables before calling the execute command
updateStmt.setInt(1, headerIdToDelete);

// And register the output parameter types
updateStmt.registerOutParameter(2, Types.DOUBLE);
updateStmt.executeUpdate();

// After execute you can get the value of pl/sql block output
Number amount = new Number(updateStmt.getDouble(2));
updateStmt.close();

// Commit the transaction in the database
txn.commit();


} catch(SQLException sqle) {
updateStmt.close();
}

}



And you can call the above Application Modules method from managed bean using following code.

FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory exp = facesContext.getApplication().getExpressionFactory();
DCBindingContainer bindingContainer = (DCBindingContainer)exp.createValueExpression(facesContext.getELContext(),"#{bindings}",DCBindingContainer.class).getValue(facesContext.getELContext()); 
DCIteratorBinding itr = bindingContainer.findIteratorBinding("Dept1Iterator"); 
DemoAppAMImpl svc = (DemoAppAMImpl)itr.getDataControl().getApplicationModule();


Or you can call this method by exposing into client interface.

System.out.println

This is the most commonly asked question in web applications development in jdeveloper including OA Framework, ADF, ejb, web services etc.


Can I leave System.out.println or System.err.println in the production code?

System.out.println comes handy when debugging the application because you can see the messages pretty much easily in the jdeveloper console. And it takes relatively less time than the debugging option in Jdeveloper. So even experienced developers use it for debugging. You may think, "Anyway this doesnot any affect in the production system". But actually System.out.println statements will have serious performance issue in the production system if you fail to remove them in the final code.

The reason is that the application server will have only one output stream and one error stream in the JVM. Hence multiple threads calling the System.out.println() have to be synchronized.

Considering the production system with thousands of users, back end programs, webservices, scheduled process running parralley in the machine. Calling system.out.println() will potentially block the performance of whole system.

Also the application server doesn't redirect the std out to a file, and is lost.



Hence always remove the System.out.println() /System.err.println() from the production code.

Managed Bean

Managed beans are Java classes that you register with the. The managed beans are initialized when they are referenced in the application for the first time. It helps to handle UI events or write data manipulation code. TIP: Use managed beans to store only logic that is related to the UI rendering.
Managed beans can be registered in three files
  1. adfc-config.xml
  2. Task flow definition file
  3. faces-config.xml

adfc-config.xml

Managed bean declared in this file can be of any scope.

Task Flow definition file

Managed bean scope can any scope. However, managed beans of request, pageFlow, or with scope set to none accessed within the task flow definition, must be defined within the task flow definition file. Managed bean definitions within task flow definition files will only be visible to activities executing within the same task flow.

faces-config.xml

Allows any managed bean scope other than pageFlow scope.
The order of searching a managed bean in the application is faces-config.xml, adfc-config.xml and Task flow definition file (if exists). Hence managed bean defined in the faces-config.xml takes the precedence.
As a general rule in fusion web applications, a bean that may be used in more than one page or task flow is defined in the adfc-config.xml and a bean that is used within the task flow is defined in the task flow definition XML file.

Add a managed bean

To add a managed bean
  1. Click the adbc-config.xml file or task flow definition file.
  2. Go to Property editor -> Managed bean tab
  3. Choose the +(Add) Icon.



Difference between Managed Bean and Backing Bean

Backing bean and Managed bean are not different they are the same. Managed bean is about how the bean is created and initialized. Backing bean is about the role a particular managed bean plays.
In other way, Managed bean is a Java Bean registered in the adfc-config.xml file. These beans have properties that are bound to the values of UIComponents.
Backing bean is a special type of managed-bean consisting of properties that are UIComponents. Instead of the bean properties being bound to the UIComponent values, they are instead bound to the UIComponents themselves.

Bounded and Unbounded Task Flows


Unbounded
A specialized form of task flow that has a single entry point and zero or more exit points. It is configured in adfc-config.xml file.

  • It cannot declaratively specify parameters.
  • It contains default activity
  • It cannot be called by another task flow.


Unbounded task flow can be used when
  • You want to take advantage of ADF controller features not offered by bounded task flows
  • You don’t need ADF controller features that are offered when using a bounded task flow.
  • The task flow will not be called by another task flow.
  • The application has multiple points of entry.




Bounded
A set of activities, control flow rules and managed beans that interact to allow a user to complete a task. It is used to encapsulate a reusable portion of an application.

  • A bounded task flow can be called another bounded task flow or unbounded task flow.
  • The bounded task flow always specifies a default activity
  • Managed bean specified in pageFlow scope is visible only within the task flow, and isolated from rest of application.

Because of the resuability features, bounded task is mostly used in all applications.


Features of Bounded Task Flow

  1. Well-defined boundary An ADF bounded task flow consists of its own set of private control flow rules, activities and managed beans. Input and Ouput parameters are available to bounded task flow just like a function call. Data controls can be shared between task flows.
  2. Single point of entry An ADF bounded task flow has a default activity that executes before all other activities in the task flow.
  3. PageFlow memory scope Its a new scope introduced in ADF. And its lifespan is ADF bounded task flow.
  4. Reuse You can identify an entire group of activities as a single entity and reuse it in another application.
  5. Parameters and return values You can pass the parameters and get the output just like a function call.
  6. Transaction ManagementIt represents a transactional unit of work. While entering a bounded task flow you can create new transaction or join the existing one.
  7. Reentry You can choose to reenter the bounded task flow.
  8. Security Secure a bounded task flow using fusion security.

OAF vs ADF 10g

OAF vs ADF 10g

Hi all,

With the emergence of next generation Fusion technology middleware stack there is confusion between the technologies OA framework and ADF among Oracle developers especially for the people who are developing extensions for Oracle Applications 11i/R12. Both are Oracle technologies for developing web based User Interface with Jdeveloper. Hence I decided to bring out the detailed overview of OA framework and ADF, and identify the rite technology for your web development projects.


OA Framwork


OAF (Oracle Applications Framework) is used to create the web based Oracle Application extensions and it is the default web technology for 11i and R12 development. It is closely integrated with Oracle Apps hence it is meaningless outside apps context. OAF is a model-view-controller technology stack which comprised of OA framework View (regions and pages) and BC4j respectively as view and model layers.

OAF and Oracle Applications 11i/R12
  • OAF includes AOL which provides e-business functionality like functions, menus, responsibility, functional security, data security, messages, profiles, flexfields, and concurrent programs.
  • List of Values – validation, auto complete, auto clear is available in OAF.
  • Transactional Search – Query Bean is available in OAF.
  • Data export, Configurable pages and Rich text editor is available in OAF.
  • OAF supports translatable table (TL tables).
  • Who columns like created by, modified by, creation date, modified date are supported in OAF.
  • Since OAF is tightly integrated with E-Business session management is done automatically.
  • Menu that appears at the top of the page is integrated with AOL menus. Hence the menus can be configured dynamically by manipulating AOL menus and no coding is required.
  • Functional security is available in OAF which allows you to configure the responsibility dynamically for the user.
  • User authentication is done from SSO. So no need to configure or write any code.
  • Data security is available.
  • Secured against cross site scripting attack.
  • OAF page access can be tracked.
  • Standards and guidelines are available for developing extensions in OAF which is the most important thing.
  • Reusable regions are available in OAF.
  • UI cannot be migrated to ADF 11g (may be in the future Oracle will come up with migration utility for UI but even then only declarative pages would be migrated and the UI pages should have followed the coding standards strictly).
  • BC4J can be migrated with minimal code change.
  • Controller cannot be migrated hence you have to rewrite all the logics in the controller if you want to migrate it to ADF 11g.

ADF 10g

ADF 10g (Application Development Framework) is the core technology for Fusion Applications and uses lot of open standards and technologies. ADF can also be used for common J2EE applications because ADF technology stack allows you choose between various options. ADF is primarily comprised of ADF Faces, ADF model and ADFbc (which is previously known as bc4j in OAF)

ADF 10g and Oracle Applications 11i/R12
  • ADF 10g does not include any support for AOL
  • List of Values and its associated features like validation, auto complete and clear does not exists in ADF.
  • No Transactional search, Data Export, Configurable pages or Rich text editor.
  • No support of Translatable Table and who columns.
  • No support for E-business suite session management.
  • No support for integration with Oracle Workflow.
  • E-business security features are totally unavailable in ADF 10g. (security features include Data security, functionally security, SSO etc)
  • Page access cannot be tracked in ADF 10g.
  • No support of for menus in ADF.
  • Reusable regions cannot be created in ADF 10g.
  • ADF 10g can be easily migrated to ADF 11g.
  • And most of all you cannot extend or personalize the existing page with the help of ADF.

And the advantage of ADF 10g over OA framework is that your investments would be protected when you want to migrate to ADF 11g.

(ADF has many advantages starting from the underlying architecture, the level of support for Web Services and SOA development and going all the way to the actual development experience of UIs using visual editor and drag and drop binding. -- Shay)

Conclusion

Consider following points when choosing technology.
  • If you want to build few pages with close integration of e-business suite then opt for OA framework. Remember if you want to migrate your code to ADF 11g in the future, you have to follow the coding standards strictly and code all the business logic in bc4j rather than handling the logic in controller.
  • If you don’t want a close integration e-business suite or your building entirely new application then go for ADF 10g.

Monday, 27 February 2017

What is Oracle ADF?

It is a new framework developed by Oracle to solve the complexity of the J2EE platform, and which is based on the MVC model, such as: 
- Allows to concentrate on the business logic 
- Based on the standards of the development industry 
- standard Expression Language (EL) for web clients 
- standard Components for Java Swing GUI client 
- Supports various server-side technologies: Oracle ADF Business Components, Oracle Application Server TopLink, EJB, web Services, Java Objects ... 



Architecture Framework