Saturday, October 20, 2012

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