Monday, November 12, 2012

Component Palette : Add Component to Favorite

We use many ADF Faces , HTML , JSF Component for User Interface ,So I would suggest adding most important component to favorite

 

Add to Favorite Final Outcome
image image

Thursday, November 8, 2012

Managed vs Backing Bean

Backing Bean is Type of Managed Bean which contains one to one mapping to JSF Component.

However , Managed Bean hold data and logic for application. Managed Bean is defined in faces-config.xml , adfc-config.xml , taskflow.

ADF BC : Showing Attribute Label using Groovy

While throwing exception from BC Validator you can throw exception from Message Bundle with some custom message. However ,If you want to include some attribute label from control hint in your message then you can use following expression.

source.hints.COLUMNNAME.label

image

Tuesday, November 6, 2012

Sunday, November 4, 2012

PageDefinition Parameter

Your page might be dependent on multiple id from external source which may be in different scope and It is good practice to create temporary variable in page definition file and assign it with value coming from different scope , So you can access that variable from page using only one standard #{bindings.VariableName} instead of pageflow , session or application scope access. This provided more consistency in user interface.

I created following two variable in parameters section of page definition and assigned it value with #{sessionScope.variablename} and #{pageFlowScope.variablename} , Now I don’t have to access this two different scope from my user interface , But I have to access only #{bindings.DeptId} and #{bindings.ExternalId} which provided a good standard to adopt while developing application.

image

SetCurrentRowWithKey and SetCurrentRowWithValue

ADF Table component handle the selection of row automatically ,However in some cases  you may need dynamic row setting mechanism there comes above operations provided by framework SetCurrentRowWithKey and SetCurrentRowWithValue.

Both operation require parameter ,But following explanation will differentiate between them.

SetCurrentRowWithKey

This operation require rowKey parameter and framework has already provided value in inbuild parameter i.e. #{row.rowKeyStr}.

SetCurrentRowWithValue

This operation on other hand require value which can be OrderId for Order table , EmployeeId for employee table and similar primary key for identifying the row.

Example :-  I designed simple table –> detail page each on separate page and I binded Link with Key and two buttons with Value. So when I clicked link it went to particular row pointing to rowKeyStr and when I clicked button seperately it went to each row which was specified in button setting as depicted in below diagram.

Page definition three bindings that is called

image

image

Each button was called from User Interface as below.

image

Invoke Action in Page Definition

Before rendering of page results in to some output , You might want to run pre-requisite procedure or methods for performing business or criteria logic.

InvokeAction

If you want to achieve this at User Interface level then mostly developers use “InvokeAction” provided by ADF framework.

image

I simply created FOD schema Order Table EO and VO with bind variable OrdId which I binded it with value in AppModule.java file and exposed it as client method.image

Then I added this method as InvokeAction which will be called before iterator in Executables box which will make sure it is called before the iterator renders OracleItem list on table component on User Interface.

image

Finally when you run the page it will only show rows with order id 1004. This was just for test purpose , you can use it for various reasonable business criteria.

RefreshCondition

If you have noticed I kept Refresh to IfNeeded that means it will call this method by default. You can also put some Refresh Condition that will prevent this criteria to be executed or allow the criteria to be executed based on some condition.

Thursday, November 1, 2012

Restricting ADF BC visibility in Consuming Project

Generally , We create multiple project in ADF and plug it to central project which will consume rest of ADF project as ADF library.

Sometime , You don’t want consumer to see the Business Component to be reused in consuming project because it may be dependent component in same sub project.

Hide the Visibility

Set the Library Private to “True” for EO object which will hide this object in consuming project and will not allow consuming project to utilize this object.

image

ADF Taskflow : Clean PageFlowScope

We used pageflowscope between pagefragment or other node in bounded taskflow. But when we exit the taskflow ,it does not get clear automatically. So in order to improve performance , we can clear the scope manually by calling the clear method.

Taskflow properties has two property Initializer and Finalizer which can be binded to method call . So we can write a method in managed bean which will clear pageflowscope variable while exiting taskflow.

Finalizer :-

public void cleanScope(){
    RequestContext.getCurrentInstance().getPageFlowScope().clear();
}

Wednesday, October 31, 2012

Oracle ADF : Best Book out in the market

I did not wait for even few minutes before ordering this fantastic book on Oracle ADF which covers all the important aspect of ADF framework and which will definitely take experienced as well as beginner developer to new level.

I would strongly recommend this book for adapting best enterprise Implementation practice with ADF.

I already went through few hundreds pages of this book and I would say, It is amazing book.

Book Details :
Paperback : 590 pages [ 235mm x 191mm ]
Release Date : October 2012
ISBN : 1849684820
ISBN 13 : 9781849684828
Author(s) : Jobinesh Purushothaman
Topics and Technologies : All Books, Enterprise, Oracle

Also , Please visit Link

image

Sunday, October 21, 2012

ADF BC : Validation Rule

Sometime we need to create rule that will be used in most of the entity objects like employee id pattern , salary range pattern and more.

I created simple rule to explain you how to create rule that can be applied to all the entities.

I have used employee table of HR schema and My rule is taking care that first name and last name is not entered same.

I create ADF BC object type Validation Rule and It has generated following java file that implements JboValidatorInterface interface.

I added code to validateValue , validate and validateEntityLevel.

image

validateEntityLevel make sure that validation is called during Entity Level Validation stage.

Now we need to associate this validation as Entity Validator.

In EO , I associated FirstName and LastName String variable I created with accessor in java files with Entity Object attribute value.

image

When I create Entity Row and give First Name and Last Name as same value it will throw exception not allowing me to save row.

Saturday, October 20, 2012

Debugging ADF Application

We can see queries that are run during runtime , bind variable value and more if we debug ADF application.

Right click View Controller and set following flag and run the application.

-Djbo.debugconsole=console

image

There are other value that can be associated with debugconsole that are file , ADF Logger , silent.

ADF Logger

-Djbo.debugconsole=adflogger –Djbo.adflogger.level=FINEST

ADF BC : findByPrimaryKey Method Usage

Even though ADF provide lot of declarative way of achieving our goal , There are some instance where you need to write your own code.

Example If I need to write code that is generic to all VO then I will put that code in Application Module Implementation file.

Let us say we need to search employee based on employee id.

I wrote following code in ApplicationModuleImpl and exposed it to be called from user interface. I have given static value for employee but you can make it more generic according to requirement.

image

ADF BC : Post Changes

Sometime we need to override EOImpl method to do some extra validation or other custom code.

One of most used overridden method is PostChanges() to intercept the logic before actually commit happens. This can be used to call PL/SQL method to push the Middle-Tier data without committing the changes.

As per Oracle documentation postChange Documentation , This method calls doDML with DML_INSERT , DML_UPDATE , DML_DELETE flags.

PostChanges() is called when all validation and custom validation is completed and you have data in entity cache which is validated , but about to be committed.

Most of the bloggers have suggested to use this method to call PL/SQL while migrating legacy application. Further research is advisable.

image

Tuesday, September 25, 2012

ADF GUI : Print Navigation in showPrintablePageBehavior

One of my customer want simple print behavior. I thought it is simple with showPrintablePageBehavior component provided by ADF.

When I tried it , I noticed it will not print hyperlink and other navigation component which is correct as per definition of this component . It is common to have hyperlink in Table or Form component , But fortunately , I found the work around which made my life simple.

Develop simple page with table component and make sure where ever hyperlink is present repeat that definition of that command link with output text rendered only in print version.

i.e.

Add following tag inside command or menu item which will enable print behavior of particular page. Add extra output text corresponding for each hyperlink component. This output text will be visible only when you go to page with print behavior.

Enabling Print Behavior

<af:showPrintablePageBehavior/>

Printable behavior check condition

#{adfFacesContext.outputMode eq 'printable'}

In navigation component do the following.

<af:outputText value="#{row.columnname}" rendered="#{adfFacesContext.outputMode eq 'printable'}"/>

System : Disabling startup program in Window 7

Disabled startup program from window.

Open msconfig.exe

image

Go to startup tab and uncheck

image

Apply changes and restart.

Sunday, September 9, 2012

Oracle ADF : Model and View Controller Resource Bundle

In any web application we need to define labels, hints , tooltips and more. Also our application may be deployed for multiple languages users. In ADF we can achieve having bundle for each language.

Example :-

English :- Model_En.properties , ViewController_En.properties

Spanish :- Model_Sp.properties , ViewController_Sp.properties

It will be easy to dynamically switch from one bundle to another during run time.

1. Create Fusion Project and create EO/VO , We don’t see any resource bundle here.

image

2. By Default attribute name will come as label , Until we override this value.

image

3. Override the label in the control hints property of attribute , We can use any EO/VO to give control hint , but I prefer to use EO.

image

If we give this value and click OK , it will create following resource bundle file.

image

 

View Controller Bundle

In Product list page we will place some button and name it as “Create New” label which will come from view controller bundle.

Right click view controller project properties and set the following value in Resource Bundle

image

Select the command button and select following

image

Give following value and don’t forget to select View-Controller Bundle.

image

 

ViewController bundle contains following properties

image

To refer this value use

#{viewcontrollerBundle['hasim.createrow']} which will print Create Row.

This bundle is loaded in JSF with following JSF Tag.

image

Putting view controller bundle in faces-config.xml

Instead of giving above JSF tag in all JSPX pages , we should generalize this definition ,so that we don’t have to provide this tag on every JSF pages.

open face-config.xml and enter following properties in faces-config.xml

image

We can see we are referring our variable as bundle which is pointing to our view controller bundle.

Now comment the JSF tag referring to bundle.

image

Now click expression builder

image

Now you will see it is visible in following window.

image

Just click this which will automatically populate the expression part.

Enjoy !

Saturday, September 8, 2012

Oracle ADF : Working with DOMAIN and Validation

DOMAIN is used as datatype for Oracle ADF business component entity attributes. It is good facility provided by this framework to implement our own datatype for special purpose attributes like Email , Phone , Employee Id which require specific pattern to be followed.

Let me give me an example to portray you the power of domain.

Let us create simple EO/VO for supplier table in FOD Schema.

1. Create Domain

image

2.Give Domain name and don’t select check box. Then keep everything default in all screens and click finish.

image

3. It will generate xml and java file and We have to override validate method to write the validation.

image

I wrote following simplest validation logic and threw the exception.

image

4. Associating the Domain with entity attribute in type Drop down.

image

5.Now run the app module tester and give the email without @ which will throw the exception.

image

This concept can be extended to include much complex business rules for particular filed.

Friday, September 7, 2012

Groovy : JSR 241 for Groovy

Light weight new programming language that our JVM can understand.

For further information please read JSR and corresponding article, I mean to say keep an EYE on it.

Groovy JSR

Thursday, September 6, 2012

Jdeveloper : Oracle Public Cloud SDK

 

If you want fly , you have to go to cloud and you can well go to cloud from jdeveloper .

image

Jdeveloper : Existing Extensions and Extend Jdeveloper

 

You can extend your jdeveloper as per your requirement which include SOA Editor , BPM Editor , Webcenter Extension and more.

image

Jdeveloper : Clean Project Everytime before running

 

Jdeveloper has auto clean feature while running project everytime as found in other popular IDE like Eclipse.

image

Jdeveloper : Opening Internet Explorer from Jdev

 

When working with Jdeveloper we need Internet Explorer and other browser during web development work. Jdeveloper has utility to embed such regular stuff.

image

It will automatically pull some frequently used tool. Click “Find Tool”

image

You can add new tool like Chrome , Fire Fox and more using this utility.

Eventually ,It will appear as follow on jdevelopr as short cut.

image

Jdeveloper : Deleted File Accidently and Want to Restore

 

Accidently you may sometime delete the file from Jdeveloper project by mistake and Jdeveloper has provided utility to restore deleted file as follow.

image

Right click project and click restore from local history.

image

Then select the file that need to be restored and click Restore

image

You can control how many back file you need for each file from following configuration.

image