Thursday, September 5, 2013

ADF 11gR1: How to improve the UX of tables with filter


In a typical Oracle ADF application there might be a lot of tables with the query-by-example filter functionality. It is a great ADF standard feature that users love. However there is at least one thing that can be improved.

Use Case
Step 1: The user enters a filter criteria and performs the filtering.

=> The table data is filtered according to the criterion

Step 2: The user clicks on "QBE-Filter" button
=> The filter header row is not visible.
=> The table data is still filtered 
=> There is no hint for the user whether the data is filtered and if so how the data is filtered. From UX point of view the UI Feedback is not perfect.

How to improve
To  improve the user feedback it would be great to at least have a UI hint if the visible data is filtered or if the "Hide QBE-Filter" button would reset the filter. In this blogpost I am going to show a hack how you can achieve the latter one with ADF 11R1. 

Step 1: Create a Javascript file with the following content

The hack is to actually override the default showQBE function with a custom function that queues an AdfQueryEvent to clear all filter criteria before calling the default ADF showQBE function.

To register this override in JavaScript you must register a clientListener for the onLoad event in the JSF page.


Environment

Tested with
ADF 11.1.1.6 normal mode
ADF 11.1.1.7 normal and screenReader mode.

To my surprise this improvement is implemented in ADF 12.1.2! No need to hack if you are on the bleeding edge :)

Disclaimer
The described feature uses an unsupported ADF JavaScript Hack! So use on your own risk if your users want it and your stuck on 11gR1.

Wednesday, August 21, 2013

WebCenter: Checking the installed version information

Use Case

While installing WebCenter Portal 11.1.1.8 you will see a screen like the following during the domain creation

First I thought there is something wrong but beeing some time with Oracle technology now I know that these version information might just not be the one you really installing.

So the purpose of this post is to double check the WebCenter version once installed.

Check installed versions with OPatch

Create a checkversion.sh script like the following

export MW_HOME=/oracle/fmwhome11118
export ORACLE_HOME=$MW_HOME/Oracle_WC1
export JAVA_HOME=/oracle/javahome/jdk1.6.0_29
export PATH=$JAVA_HOME/bin:$PATH

java -version

$ORACLE_HOME/OPatch/opatch lsinventory -details -jdk $JAVA_HOME

The setting of Oracle is needed in order to run OPatch successfully.
Next run the script from the command line:

[oracle@soabpm-vm fmwhome11118]$ sh checkversion.sh
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
Oracle Interim Patch Installer version 11.1.0.9.9
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/fmwhome11118/Oracle_WC1
Central Inventory : /oracle/oraInventory
   from           : /oracle/fmwhome11118/Oracle_WC1/oraInst.loc
OPatch version    : 11.1.0.9.9
OUI version       : 11.1.0.9.0
Log file location : /oracle/fmwhome11118/Oracle_WC1/cfgtoollogs/opatch/opatch2013-08-17_06-35-49AM_1.log


OPatch detects the Middleware Home as "/oracle/fmwhome11118"

Lsinventory Output file location : /oracle/fmwhome11118/Oracle_WC1/cfgtoollogs/opatch/lsinv/lsinventory2013-08-17_06-35-49AM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle WebCenter Portal Suite 11g                                    11.1.1.8.0
There are 1 products installed in this Oracle Home.


Installed Products (42):

Application Server 11g Cloning Component                             11.1.1.8.0
Installer SDK Component                                              11.1.0.9.0
Jython                                                               11.1.1.7.0
Oracle Bali Share                                                    11.1.1.7.0
Oracle Business Process Management Process Spaces                    11.1.1.7.0
Oracle Display Fonts                                                 11.1.1.7.0
Oracle Extended Windowing Toolkit                                    11.1.1.7.0
Oracle Fusion Middleware Admin Config                                11.1.1.6.0
Oracle Help for Java                                                 11.1.1.7.0
Oracle Help for the Web - UIX                                        11.1.1.7.0
Oracle Help for the Web Shared Library                               11.1.1.7.0
Oracle Help Share Library                                            11.1.1.7.0
Oracle Ice Browser                                                   11.1.1.7.0
Oracle Jakarta                                                       11.1.1.7.0
Oracle JFC Extended Windowing Toolkit                                11.1.1.7.0
Oracle JGroups                                                       11.1.1.7.0
Oracle JSCH                                                          11.1.1.7.0
Oracle One-Off Patch Installer                                       11.1.0.9.9
Oracle Remote Diagnostic Agent                                       11.1.1.7.0
Oracle Remote Intradoc Client                                        11.1.1.8.0
Oracle SOA workflow                                                  11.1.1.7.0
Oracle UIX                                                           11.1.1.7.0
Oracle Universal Installer                                           11.1.0.9.0
Oracle Upgrade Assistant                                             11.1.1.8.0
Oracle Upgrade Assistant                                             11.1.1.8.0
Oracle Upgrade Assistant for Webcenter                               11.1.1.8.0
Oracle WebCenter Portal Suite                                        11.1.1.8.0
Oracle WebCenter Portal Suite 11g                                    11.1.1.8.0
Oracle WebCenter Portal: Activity Graph                              11.1.1.8.0
Oracle WebCenter Portal: Analytics Collector                         11.1.1.8.0
Oracle WebCenter Portal: Discussions Server                          11.1.1.8.0
Oracle Webcenter Portal: Framework                                   11.1.1.8.0
Oracle Webcenter Portal: Framework Core                              11.1.1.8.0
Oracle WebCenter Portal: Pagelet Producers                           11.1.1.8.0
Oracle WebCenter Portal: Personalization                             11.1.1.8.0
Oracle Webcenter Portal: Portlet Server                              11.1.1.8.0
Oracle WebCenter Portal: RCU                                         11.1.1.8.0
Oracle Webcenter Portal: Spaces                                      11.1.1.8.0
Oracle WebCenter Portal: Suite Components                            11.1.1.8.0
Oracle WebCenter Portal: Wiki                                        11.1.1.8.0
Oracle WebLogic Communications Service Client Library                11.1.1.7.0
OracleAS Documentation                                               11.1.1.8.0
There are 42 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@soabpm-vm fmwhome11118]$

Further information
If you want to try out WebCenter follow the links for more information

Download WebCenter Portal 11.1.1.8

Neue Features und Ă„nderungen in WebCenter Portal  11.1.1.8.0
http://docs.oracle.com/cd/E29542_01/doc.1111/e27603/whatsnew.htm#sthref8

See more Screenshots of the WebCenter Portal  11.1.1.8.0 on our german blog
http://www.enpit.de/webcenter-portal-11-1-1-8-mit-zahlreichen-neuerungen/

Saturday, August 17, 2013

ADF: Creating a custom train button bar, reflecting the disabled state

Requirement

In some cases there is a need to obtain more control over the ADF train button bar. The generated default does not allow to add an additional actionListener.



Environment

JDeveloper/ADF 11.1.1.7

Solution

There is a simple solution I found on http://www.adftips.com/2010/10/adf-ui-how-to-specify-actionlistener.html to create custom buttons for the previous / next functionality.


But there is still one thing missing. The buttons are always enabled. Unfortunataly there is no easy way to set the disabled property right from the given trainModel that is accessible by EL.

To solve this we create a managed bean as follows:



Now it is possible to bind the properties for disabled status




Similiar posts


Friday, August 2, 2013

JDeveloper 12c: Create RESTful Service from Java Class

With JDeveloper 12c finally it is possible to create RESTful Services from a Java Class. The implementation is based on Jersey following the Java EE 6 specification JAX-RS. For testing JDeveloper includes a comprehensive Tooling. In general RESTful services are really popular for mobile applications, e.g. ADF Mobile.

Get started
Create a simple Java Class for your business domain object plus a Service Facade that you want to expose as a RESTful Service.
Make sure to annotate the class with the @XmlRootElement otherwise the REST Service will not work for this domain object.

Next create a simple service facade with some test data, e.g.
package enpit.sample.adf12c.pojorest.model;
import java.util.ArrayList;
import java.util.Date;import java.util.List;

public class PersonService {

    
private List<Person> persons;
    
private Person person;

    
public PersonService() {
        
super();
        
this.persons = new ArrayList<Person>();
        
for (long i = 0; i < 10; i++) {
            Person p = 
new Person();
            p.setId(i);
            p.setFirstname(
"Firstname " + i);
            p.setLastname(
"Last " + i);
            p.setHiredate(
new Date());
            
this.persons.add(p);
        }
        
this.person = this.persons.get(0);
    }

    public List<Person> getPersons(){
        return this.persons;
    }

    public void addPerson(Person person) {
        System.out.println(
"add person " + person);

        
if(person != null){
            getPersons().add(person);
        }
    }
    public Person getPerson(){
        
return person;
    }
}

So far there is nothing special. 

Create RESTful Service with the help of JDeveloper 12c
Now comes the interesting part. Select the PersonService.java in the application navigator and
choose "Create RESTful Service…"

You will get a wizard to specify the RESTful Service interface. Set the desired root path. Choose the desired media types and the Methods you want to expose as REST Service
After finishing the wizard the following happens
- JAX-RS Annotations are generated  on the Java Class
package enpit.sample.adf12c.pojorest.model;
import java.util.ArrayList;
import java.util.Date;import java.util.List;import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;import javax.ws.rs.POST;import javax.ws.rs.Path;import
 javax.ws.rs.Produces;


@Path(
"rest")
@Produces(value = { "application/json", "application/xml" })
@Consumes(value = { "application/json", "application/xml" })
public class PersonService {

    
private List<Person> persons;
    
private Person person;

    
public PersonService() {
        
super();
        
this.persons = new ArrayList<Person>(){
        
for (long i = 0; i < 10; i++) {
            Person p = 
new Person();
            p.setId(i);
            p.setFirstname(
"Firstname " + i);
            p.setLastname(
"Last " + i);
            p.setHiredate(
new Date());
            
this.persons.add(p);
        }
        
this.person = this.persons.get(0);
    }

    @GET
    @Path(
"/persons")
    
public List<Person> getPersons(){
        
return this.persons;
    }

    @POST
    @Path(
"/person")    
    
public void addPerson(@FormParam("person") Person person) {
        System.out.println("add person " + person);

        
if(person != null){
            getPersons().add(person);
        }
    }

    @GET
    @Path(
"/person")
    
public Person getPerson(){
        
return person;
    }
}

- web.xml is created. The Jersey Servlet is configured properly.

Testing the RESTful Service in JDeveloper 12c
Jdeveloper is quite powerful. It lets you test the RESTful service right in the IDE.
Right-Click on the PersonService.java class and choose Run.

In background WebLogic Server 12c starts and the RESTFul Service gets deployed.

The WADL is kind of WSDL for RESTful Services. Clicking on the "Target Application WADL" URL brings you to the overview of the provided service operations

You can test each Service Operation right from the IDE. Pressing the "Test" Button brings you to the HTTP Analyzer Screen.
Here you can choose the Method, change HTTP Headers (e.g. what kind of media type you want to accept).
Press "Send Request" to actually test the Service Operation. Make sure to change the view to "HTTP Content" not "WADL Structure" otherwise you want see the pretty formatted output on the right hand side.

Change the Accept-Header to application/json and send the request again. The output automatically will be in JSON format.
The HTTP Analyzer is even so good to parse the POST Parameter to create a good looking form for data entry

Conclusion
Creating and Testing RESTful Services is really simple with JDeveloper 12c.

Friday, July 19, 2013

ADF 12c: Model-Driven LOV with Bean Data Control


Introduction

Prior to ADF 12c Model-driven input List-Of-Values (LOV) was a feature exclusively reserved to the ADF BC DataControl. With ADF 12c the Bean DataControl has been enhanced a lot. Now it is possible to create input LOVs the declarative way.

Prerequisites
You have a plain Java Object Model, for which you want to build the UI, including an LOV. In this sample we use Person, Address and a PersonService, which we want to expose as a DataControl
The adressId of Person should be filled through a LOV from available Address-Entities.

How to do it

First, create the DataControl from the PersonService: Right Click the PersonService.java class and Choose: Create DataControl


For this purpose, just keep the defaults in the wizard and complete with "Finish"

Open the generated DataControls.dcx, Select the Collection Type person and choose 'Edit'

The metadata file for the Person entity will be created. Next open the generated metadata file and configure the LOV on addressId as follows

Now the LOV is already configured and could be used for the UI Creation. If needed the LOV can be refined with UI Hints (as known from the ADF BC LOVs)

Now you can go on an build the UI. Drop the persons collection from the Data Control Palette onto the Page and
choose "ADF Form":

As indicated an ADF LOV Input will be crated for the addressId attribute. It can be further adjusted if needed in the next wizard screen

The LOV has been created

and can be tested at runtime.

The LOV Popup contains a query panel to limit the given values. As a wildcard only % is working. no Asterisk (*) what I personally would prefer. Anyway the LOV works as expected. In the sample the adressId is filled correctly.

Validation also works by default. If you try to enter an invalid value an error message pops up.

Download


Further Reading

Wednesday, June 19, 2013

Production Redeployment with ADF Shared WebLogic Libraries


Based on my previous post I wanted to know if we can achieve to redeploy parts of an ADF application by using shared WebLogic Libraries. In conjuction with the production redeployment WLS feature the overall goal is to prove that we can update modular ADF applications without downtime.

Introduction

The sample application consists of an employees taskflow that is bundled as ADF Library and deployed as shared library on WebLogic server. The sample is based on ADF 11.1.1.7 / WLS 10.3.5 / HR Schema.

First step: Create ADF Library as Shared WAR deployment

Goto JDev application with the containing Taskflow:

Create a MANIFEST.MF file under ViewController/src/META-INF/ with the following contents
The important parts are

Extension-Name: enpit.sample.empFlow
Specification-Version: 1.0
Implementation-Version: 1.0

Create ADF Library Deployment Profile for the empFlow on ViewController project with dependency on your Model project.
Make sure only connection name is Included in the Library

Having an ADF Library Deployment Profile in the employee taskflow application we create an additional Deployment profile (of type WAR) in the ViewController project. 

Under  WAR Options include the MANIFEST.MF file

Make sure to remove everything from Web Files contributors since we only want to wrap the ADF Library inside this WAR file.

Same to WEB-INF/classes. Exclude everything.

Under Profile Dependencies add the dependency to the ADF Library Profile

Goto WEB-INF/lib Filters and uncheck everything except the desired ADF Library JAR file.

With that WAR deployment configuration we are able to deploy -  the ADF Taskflow -  as shared library to the WebLogic server. (Select ViewController, right click, Choose Deploy > SharedADFLib ...to Application Server)

As a result the library shows up under Deployments in the WebLogic Admin Console

Deploy master application

In the master application that consumes the taskflow from the ADF Library we need to make sure
  • versioning is configured for application deployment
  • ADF Library is not bundled with the EAR
  • Library reference is added to the ADF Shared Library in weblogic.xml (not weblogic-application.xml)
To enable the versioning for the app deployment we add /src/META-INF/MANIFEST.MF file with the contents
Manifest-Version: 1.0
Weblogic-Application-Version: 1.0

Now goto the EAR deployment profile and add the MANIFEST.MF file under the EAR Options

Goto application descriptors Filters and exclude MANIFEST.MF. (Otherwise the EAR won't be created as JDeveloper will try to include 2 MANIFEST.MF files in the EAR. You will see this exception in the deployment log window).

Now exclude the ADF Library from the application deployment. Goto ViewController project properties of the master application and make sure the library is not deployed by default.

In the WAR deployment profile check that the ADF Library JAR is not included


Next create WEB-INF/weblogic.xml and add library reference to the ADF Shared Library.

Important note: In my first try I added that library reference in the weblogic-application.xml. That won't work. At deployment time there will be the following exception
[08:23:54 AM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application enpit_application1 [Version=1.0] on DefaultServer.: javax.faces.context.ExternalContext.
[08:23:54 AM] Weblogic Server Exception: weblogic.application.WrappedDeploymentException: javax.faces.context.ExternalContext
[08:23:54 AM]   See server logs or server console for more details.
[08:23:54 AM] weblogic.application.WrappedDeploymentException: javax.faces.context.ExternalContext
[08:23:54 AM] ####  Deployment incomplete.  ####
[08:23:54 AM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)

So don't try this.

Doing it right you should see the following in Admin Console:

Test the application. It loads the taskflow and displays version 1

Next Step: Test production redeployment based on new version of ADF Shared Library
We are going to 
  • Make changes in employees taskflow
  • Change Library Implementation-Version to 1.1
  • Deploy ADF Library as Shared WLS Library
  • Increase application version to 1.1
  • Redeploy master application
So first we increase the library version
and make some simple changes to the JSFF

Next: Deploy ADF Library to JAR
Next: Deploy sharedADFLib Deployment to IntegratedWebLogic

Check deployment in the Admin Console

Goto the master application and change Weblogic-Application-Version to 1.1

and deploy the master application to Verify deployment in the Admin Console once again. You should notice that previous application (1.0) is in stop running state. Actually it is meant to be RETIRED Mode. Existing web sessions will be served by that version 1.0.

Open a NEW BROWSER WINDOW (a different browser window to be dead sure) and point to the master application URL. You should see new version of the integrated Taskflow.

Conclusion

This mechanism is really powerful. It lets you redeploy application parts - maybe of a huge application - without downtime.

Download Sample Application


Related Posts