Posts

Entity Object based on a PL/SQL Package API

A simple demo application that uses Entity Object based on the Stored Procedure is attached here . More details can be found in Developer's Guide, section 37.5 Basing an Entity Object on a PL/SQL Package PS: Unzip the attachment and run the script(StoredProcedureExample/script) to set up the required DB objects for running this demo

Reset the content of a web page

Resetting the page contents or undoing the changes made by a user is a very common use case scenario in Rich Internet Applications. The 'reset action' should skip all validations defined on the current page and page contents needs to restored from the underlying data layer. Some of the web frameworks support this feature out of the box. Let me try explaining possible ways to reset a page when developing applications using ADFFaces. 1. <af:resetButton> As the name suggests, af:resetButton resets the contents of a form. Please note that developer doesn't have much control here as he/she might not be able to bind any action method with this built in reset button. <af:resetButton text="ResetButton" id="rb1"/> 2. <af:resetActionListener> This tag is usually bound to an action source like command button to reset all submitted values whenever an action is triggered. Obviously this gives more control to the developer as the action sourc...

Decorate JSF managed bean with custom Annotations

Image
Java Annotatons   has been widely accepted by enterprise application developers. It really free up developers from writing down tons of boilerplate code which is used for business service invocation or basic infrastructural set up like initializing the service context or getting handle to some core runtime services etc. This blog post is mainly intended to take you through the possibilities of using annotation while building enterprise solutions. There are definite advantages if you use this tool judiciously. Few highlights are: Reduces the boilerplate code in your business tier. Adds dynamism to your code. Greater control on the implementation part, as the logic is abstracted  from the developers. High Extensibility etc... JSF managed bean and custom ADF flavored annotations A closer look at the source code of a typical web application may reveal fair amount of boilerplate code that spread across managed beans on the client tier. This repetitive piece of code ma...

Format date for a Locale

A very common use case related to localization is that, formatting the date specific to a user-selected locale. Following code snippet will help you to identify the default pattern corresponding to a locale. String pattern = ((SimpleDateFormat)DateFormat.getDateTimeInstance(SimpleDateFormat.FULL, SimpleDateFormat.LONG, locale)).toPattern(); Your jsf page snippet may look like: <af:inputDate label="Date:" id="id1" value="#{viewScope.TestBean.date}" binding="#{viewScope.TestBean.inputDate}" partialTriggers="soc1"> <af:convertDateTime type="both" timeZone="#{viewScope.TestBean.timeZone}" locale="#{viewScope.TestBean.locale}" pattern="#{viewScope.TestBean.pattern}" /> </af:inputDate> You can downloa...

How to Skip Validation?

Image
ADF has a very robust validation framework. Validations can be added at different layers (view, model and business services) based on your application's requirement. To learn more about the ADF validation framework, please go through the Fusion Developer's Guide for Oracle Application Development Framework . That said, however, in a real business scenario there are cases where the validation needs to be skipped (or by passed) conditionally while submitting the form. This post discusses this topic with some common use cases. Keep immediate=true A very common way to skip validation is by keeping the value for immediate attribute as 'true' for the UIComponents. Immediate attribute allow processing of components to move up to the Apply Request Values phase of the lifecycle. Use case scenario While canceling a specific action, system should not perform the validation. One possible way to achieve this is by keeping immediate=true associated with UI element. To know ...

How to keep track of modified values of controls in a JSF application?

I recently encountered an interesting use case where ADF Faces is used for the view layer and the data(model) is persisted in LDAP Store. Now the requirement is to identify the modified records/attributes and perform the update only on these records. There may be different ways to achieve this, say for example using container like Spring with AOP. But, is there any other smart approach without adding extra layer to my application's technology stack? Answer is 'Yes'. Let us explore one possible approach for this use case scenario. ELResolver The solution is based on customized ELResolver. We know that backing beans are bound to the view(jsf pages) using Expression Language(EL). ELResolver actually resolves thesa 'binding expressions' at runtime. So idea is to intercept in the invocation of setters for the backing beans through a customized ELResolver. And add the logic to track the modified attributes at this point. JSF specification enables to add customized javax.e...

Tips on LOV Runtime

Image
Do you know how does LOV query get executed if there doesn't exist any entity instance to back up the source ViewObject? The scenario usually arises if you have LOV defined for an attribute, which is part of query panel. This article discusses this specific scenario with a use case. Use case Let us take the classical Employee entity as example. This 'Employee' is based on HR schema . The detailed entity is shown below. You can see that each Employee falls under specific Department and Manager. This means that while defining a new Employee record, it's required to associate an existing Employee as manager to the new record. To improve the usability, let us define a LOV against manager attribute in Employee ViewObject. Let us make this LOV much smarter by adding an additional requirement to filter down the values of ‘Manager LOV’ based on logged in user's Department Id. So 'Manager LOV' should display only those Employees who belong to the same Department as ...