Saturday, 9 March 2013

What are the ADF Business Components Core Objects?

ADF Business Components implements the business service through the following set of cooperating components.


Entity object:
An entity object represents a row in a database table and simplifies modifying its data by handling all DML operations for you. It can encapsulate business logic for the row to ensure that your business rules are consistently enforced. You associate an entity object with others to reflect relationships in the underlying database schema to create a layer of business domain objects to reuse in multiple applications.

View object:
A view object represents a SQL query. You use the full power of the familiar SQL language to join, filter, sort, and aggregate data into exactly the shape required by the end-user task. This includes the ability to link a view object with others to create master-detail hierarchies of any complexity. When end users modify data in the user interface, your view objects collaborate with entity objects to consistently validate and save the changes.

Application module:
An application module is the transactional component that UI clients use to work with application data. It defines an updatable data model and top-level procedures and functions (called service methods) related to a logical unit of work related to an end-user task.

Tuesday, 5 March 2013

How to Customizing Error Handling?

You can report errors using a custom error handler that extends the default DCErrorHandlerImpl class. You are not required to write any code to register your custom exception handler class. Instead, you select the root node of the DataBindings.cpx file in the Structure window, and then use the Property Inspector to set the ErrorHandlerClass property to the fully qualified name of the error handler you want it to use.

Your custom error handler can contain the following overridable methods:
reportException(): Called to report any exception that occurs. It can be overridden to analyze reported exceptions.
getDisplayMessage(): Returns the message that will be reported to JSF for each error that occurs. Returning null is the way your custom error handler signals that a given exception should not be reported to the client.
getDetailedDisplayMessage(): Returns the detail portion of the message as a String object or HTML that will be reported to JSF for each error that occurs. Returning null is the way your custom error handler signals that a given exception should not be reported to the client.
skipException(): Returns a boolean depending on whether you want to display each item from the nested exception in the final error list displayed to the user. This method override lets you implement logic to check for specifics exception types and, based on the business scenario, determine whether to display it in the list.

custom error handler that extends the DCErrorHandlerImpl class and shows the override for the skipException() method that is needed to skip exceptions that should not appear in the list displayed to the user.
Example: 
Custom Error Handlerpackage view.controller.fwkext;
 import java.sql.SQLIntegrityConstraintViolationException; 
 import java.util.ArrayList; import java.util.List;
 import oracle.adf.model.binding.DCBindingContainer; 
 import oracle.adf.model.binding.DCErrorHandlerImpl; 
 import oracle.jbo.CSMessageBundle; import oracle.jbo.DMLConstraintException; import oracle.jbo.JboException;
 public class CustomErrorHandler extends DCErrorHandlerImpl { List<ExceptionMapper> exceptionMapperList = new ArrayList<ExceptionMapper>();
 public CustomErrorHandler() { this(true);
 }
 public CustomErrorHandler(boolean setToThrow) 
{
 super(setToThrow); exceptionMapperList.add(new DisableJboExceptionCodesMapper());
 }
 public void reportException(DCBindingContainer bc, Exception ex)
 {
 for (ExceptionMapper mapper : exceptionMapperList)
 { 
if (mapper.canMapException(ex))
 {
 ex = mapper.mapException(ex); 
 }
 }
 super.reportException(bc, ex); 
 }
 /** * If an exception is a RowValException or a TxnValException and they * have nested exceptions, then do not display it. This example shows * an implementation that skips the SQLIntegrityConstraintViolationException * from displaying in the error final list displayed to the user. */ 
@Override protected boolean skipException(Exception ex) {
 if (ex instanceof DMLConstraintException) 
{
 return false;
 }
 else if (ex instanceof SQLIntegrityConstraintViolationException) 
{ 
 return true; 
 } 
 return super.skipException(ex);
 }
 }

What Happens at Runtime,if the Validation is Successful/Failure?

When a user submits data, as long as the submitted value is a non-null value or a string value of at least one character, then all validators on a component are called one at a time. Because the f:validator tag on the component is bound to the validator property on the binding, any validation routines set on the model are accessed and executed.

The process then continues to the next component. If all validations are successful, the Update Model Values phase starts and a local value is used to update the model. If any validation fails, the current page is redisplayed along with an error message.

How to Create ADF Model Validation?

To create an ADF Model validation rule:

  • Open the page definition that contains the binding for which you want to create a rule.
  • In the Structure window, select the attribute, list, or table binding.
  • In the Property Inspector, select More and then Edit Validation Rule.
  • In the Edit Validation Rules dialog, expand the binding node, select the attribute name, and click New.
  • In the Add Validation Rule dialog, select a validation rule and configure the rule as needed.
  • Select the Failure Handling tab and configure the message to display when the rule is broken.

HOW TO DO VALIDATION IN ADF MODEL LAYER

In the model layer, ADF Model validation rules can be set for a binding's attribute on a particular page. When a user edits or enters data in a field and submits the form, the bound data is validated against any set rules and conditions. If validation fails, the application displays an error message.

Defining Validation Rules in the ADF Model Layer:

  • You can configure ADF Model validation for a binding's attributes on the page definition file. Validation rules in the model layer are executed for a binding's attribute on a particular page when the containing form is submitted.
  • You can optionally set the skipValidation property to true to bypass the ADF Model validation. You can set skipValidation to skipDataControls to validate the bound objects without validating the transaction. For example, set skipValidation to skipDataControls if you have a table action that opens a popup window to accept data entries and you want to allow the view layer to validate those entries before the commit on the table. The skipValidation property can be found in the Property Inspector after you have selected the root node of the page definition file in the Structure window.

Validation Can be Done by following:
Validator Rule Name Description
Compare Compares the attribute's value with a literal value
List Validates whether or not the value is in a list of values
Range Validates whether or not the value is within a range of values
Length Validates the value's character or byte size against a size and operand (such as greater than or equal to)
Regular Expression Validates the data using Java regular expression syntax
Required Validates whether or not a value exists for the attribute


Friday, 1 March 2013

ADF TaskFlow Related Questions

Define TaskFlow?
ADF task flows provide a modular approach for defining control flow in a Fusion web application. Instead of representing an application as a single large JSF page flow, you can break it up into a collection of reusable task flows. Each task flow contains a portion of the application's navigational graph. 
The nodes in the task flows are activities. An activity node represents a simple logical operation such as displaying a page, executing application logic, or calling another task flow. 
The transitions between the activities are called control flow cases.
Ex:
In The Above Example two view activities called Create and Confirm. These view activities are similar to page nodes within a JSF page flow

How Many Types of TaskFlow ?Define Them?

The are two types of ADF task flow:

Unbounded task flow: A set of activities, control flow rules, and managed beans that interact to allow a user to complete a task. The unbounded task flow consists of all activities and control flows in an application that are not included within a bounded task flow.

Bounded task flow: A specialized form of task flow that, in contrast to the unbounded task flow, has a single entry point (an entry point is a view activity that can be directly requested by a browser) and zero or more exit points. It contains its own set of private control flow rules, activities, and managed beans. A bounded task flow allows reuse, parameters, transaction management, reentry, and can render within an ADF region in a JSF page.


What is the difference in jspx and jsff?
Ans: jspx and jsff file are same in most of manner. Only difference is that you can run jspx directly on browser while jsff file container which will run on browser.


What is taskflow ? how many type of taskflow adf support?
Ans: Taskflow is the Component of Oracle ADF which is used to define simple task. After successfully defining task-flow can consume any number of time.
ADF support two kind of taskflow:
Bounded TaskFlow : Bonded taskflow require the page on which they will consume.
UnBounded TaskFlow : Unbounded taskflows can directly run on browser


How to develop reusable taskflow in ADF?
Ans: Please fins the step below
Define taskflow
Define deployment profile as ADF Library jar
Deploy adf jar file
Open new project where you want to consume the task flow.
Add newly created jar of taskflow project 
go to component palate You will fine you jar name select it.
It will show list of taskflow you developed
Drag drop your taskflow as region on jsff/jspx page and run ur application

Can bounded taskflow run on browser?
Ans: NO

What are different scope of adf taskflow?
Ans: Isolate/Shared
Shared scope will share data among the multiple instance of taskflows while Isolated doesn’t.

How can you force ADF taskflow to use new transaction everytime taskflow is called?
Ans: Go taskflow overview and you will file below item 

Select always begin new transaction fron dropdown

How to use same transaction in ADF taskflow?
Ans 

How can you pass parameter to adf taskflow?
Ans: Go to overview select parameters link it will show screen like 

Here you can add multiple parameter which you want to pass takflow while loading it.

Explain the purpose of using Controls flow in adf?
Ans: Controls flow defined in taskflow can be called anytime from any page of that taskflow.if you have same flow for multiple pages just define the control flow once in taskflow. You can invoke it anytime from any action event.

What is the behavior of router in ADF taskflow?
Ans : Based on some condition router can decide which route need to be follow. If none of condition match in that case router will follow default route defined by used.

How can navigation define in taskflow?
Ans : Navigation can be defined in taskflow using control flows and invoked by jsff/jspx page using action event like button link etc.


Can ADF task flow hold more than 1 view activity?
Ans: Yes. ADF taskflow can have multiple view activity but 1 activity has to be defined as default activity. 


What is the Parent Action in ADF Taskflow?
Ans:Parent action is activity using that you can invoke the Control flow define in parent taskflow from child taskflow. More details about how to develop it can be found on Parent Activity.


What is method activity in Adf Taskflow?
Ans: Using this activity you can invoke and method defined in manage-bean.

How to initialize ADF Taskflow?
Ans: Open the taskflow in Overview Mode select general like there is initiallizer property. 
you can provide the any method reference which will get invoked whenever taskflow instance created.





Explain about Oracle ADF Architecture?
Applications  build using the Fusion web technology stack achieve a clean separation of business logic, page navigation, and user interface by adhering to a model-view-controller architecture.


  • The model layer represents the data values related to the current page.
  • The view layer contains the UI pages used to view or modify that data.
  • The controller layer processes user input and determines page navigation.
  • The business service layer handles data access and encapsulates business logic.