Wednesday, March 19, 2008

JDeveloper 11g and SOA Suite 11g integration

On my blog you can find application I have developed previously - Invoking BPEL Process from Oracle ADF Application. Application described in my previous post is developed with JDeveloper 10.1.3.x, BPEL process with parameters is invoked here, however I don't return any parameters back to ADF application from BPEL process. Today I have developed new application based on JDeveloper 11g TP3 and SOA Suite 11g TP, where a set of parameters is accepted and returned by BPEL process from and to ADF application.

Sample application for this blog post is based on two parts - SOAComposite.zip and SalaryUpdate.zip. First part contains a simple BPEL process that accepts and returns a set of parameters. Second part is ADF application that invokes BPEL process, receives result from BPEL process and stores this result into database. I'm using HR schema for this sample, you can find this schema in Oracle XE database.

In order to run developed sample application, you need to configure JDeveloper 11g TP3 according to instructions available on this page - Oracle SOA Suite 11g - Technology Preview. Just follow install instructions and it will work. May be also this Oracle SOA Suite 11g Technology Preview - Configuration Hint will be useful.

SOA part in developed sample application is relatively simple, it contains one BPEL process:


This BPEL process accepts input parameters, performs some calculations and returns updated parameters:


Since there are three parameters - EmployeeID, SalaryValue and CompensationValue, updateSalary Assign activity implements Copy operation and provides values for process output:


However, one of the parameters isn't just copied, but modified - SalaryValue is increased by 100:


If we will test developed BPEL process and will provide 5300 as a value for SalaryValue parameter:


Generated result will have 5400 for SalaryValue parameter:


Now let's talk about a second part - ADF application. Here I have created Web Service Data Control based on WSDL for BPEL process:


As a result, I got a possibility to invoke BPEL process and to have a Data Control for returned parameters:


BPEL process invocation is defined in Page Definition file:


I'm accessing results returned from BPEL process through accessorIterator, this iterator is binded to methodIterator which is related to BPEL process invocation definition. accessorIterator and methodIterator definitions:


And finally, all fun stuff is done in Backing bean method associated with Update button:


In this method I'm invoking BPEL process, retrieving returned result from accessorIterator and storing updated value into database.

How it works? Let's say we select employee with STOBIAS email and press Update button:


Salary value is updated by 100:

Wednesday, March 5, 2008

Oracle Maps in JDeveloper 11g - Perfectly Fits into Enterprise

Let's get back to Oracle Maps topic again, in this post I will describe how spatial logic in JDeveloper 11g can be combined with traditional non-spatial operations. Before reading this post, I suggest to read my previous post - Oracle Maps in JDeveloper 11g - Even More Simple, I describe there how to develop and run basic Oracle Maps application.

Developed sample application - OraMaps11.zip, demonstrates how Search functionality can be implemented with Spatial technology. I'm using MVDEMO datasource for this application, you can download this datasource from OTN. Sample application implements a form with a table for search results, however there is no traditional search parameters in this form. Search criteria is defined using Oracle Maps functionality. Based on this criteria, query in database is executed and table with results is refreshed. It also allowed to update rows available in results table, changes are reflected in generated map as well.

Ok, let's describe this with pictures. Here you see Oracle Maps screen and table with Search results:


Oracle Maps comes with Circular selection tool, you don't need to develop it, just use it. So, five customers are selected spatially - results table is refreshed and shows information only about those five selected customers:


Now let's select only one customer - EMBARCADERO CENTER 3, Sales here are around 181:


If row contained in results table is updated, related point on the map is updated as well. I have updated Sales to 70, and you can notice it's reflected on the map:


Oracle Maps comes not only with Circular selection, but with Rectangular, Multy-Point and simple Click selection. Rectangular selection:


And refreshed table with selection results:


And it's really not complex to develop all this stuff. There are three main points:

1. Map Theme Selection Listener

I have defined Selection Listener for Customers theme. This listener receives all events related to Customers theme selection:


You can find code for this listener in Backing bean class. Developed code manages keys for selected points, invokes query and executes results table visual refresh.

2. Search results table refresh

When keys for selected points are prepared, selectCustomers method in Model layer is executed to query database and refresh View object:


This method is defined in Page Definition file and is invoked from Backing bean class:


In order to refresh table visually, from Selection Listener available in Backing bean class, it's enough to use only one line of code:

AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTable1());

3. Search results editing

To update edited rows in Search results table, standard Commit action is used. However, it's important here to refresh both after Commit action is done - table and map. So, I have enabled PartialSubmit for Save button and provided PartialTriggering for table and map components pointing to Save button.

In my future posts, I will describe more sample application related to Spatial functionality.

Tuesday, February 26, 2008

Oracle SOA Suite 11g Technology Preview - Configuration Hint

I was recently configuring Oracle SOA Suite 11g on my computer and I have faced configuration related problem. Want to describe it and give hint how not to face it.

Problem description:

1. SOA Suite configuration is failing with message - Configuring SOA Infrastructure has FAILED

2. In startsoa.log there are only two strange lines printed:

java.lang.NoClassDefFoundError:
Exception in thread "main"

And no more information about problem :-)

Ok, I have found solution in Release Notes for SOA Suite 11g Technology Preview 3 update 1. It seems problem was in spaces in JDEV_USER_DIR path. In order to change home directory you need to open \jdev\bin\jdev.boot file and change value for ide.user.dir variable.

After those changes, I configured Oracle SOA Suite 11g Technology Preview successfully.

Complete Guide for Oracle SOA Suite 11g Technology Preview configuration you can get on OTN.

Thursday, February 21, 2008

Oracle Maps in JDeveloper 11g - Even More Simple

With JDeveloper 11g we have standard support for Databound Geographic Maps. This means we don't need anymore to be GIS (Geographic Information System) specialists to enable Location-Based functionality in our enterprise applications. It sounds cool? Yes, but also it works :). It took for me 10 minutes (or little bit more) to develop sample application for this blog post.

Before I will start to describe implemented application, let's remember little bit how it was in JDeveloper 10g. You can check my older blog post - JavaScript in ADF Faces - Oracle Maps. It was easy as well, but it wasn't so elegant as it is now. In JDeveloper 11g you don't need to care about JavaScript or Oracle Maps API, it's because you don't need to develop - just use provided components. And most important, there is no need to deploy developed application on the same OC4J, where Oracle MapViewer is deployed.

You can download developed application - OraMapsSimple11.zip and run it directly from JDeveloper 11g TP3. Base map in this sample is retrieved from open Oracle service - http://elocation.oracle.com/mapviewer, so in order to run application you need to have Internet connection. In this sample I'm using Customers point theme, data for this theme is retrieved from MVDEMO datasource. You can download this datasource from Oracle MapViewer page on OTN.

When I was developing sample application, I discovered that MDSYS.SDO_GEOMETRY object type is not supported yet by map component in current JDeveloper 11g Technology Preview. But no matter of this I wanted to use point theme from my database, so I applied workaround. Workaround is to add two read-only attributes for X and Y coordinates:


As you can notice, I'm accessing information from spatial column directly - using LOCATION.SDO_POINT.X and LOCATION.SDO_POINT.Y definition.

I have generated map area in View layer using steps described in section 25.6 Creating Databound Geographic Maps from Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1. To add point theme to the map, it's needed only to provide required values and click Ok:


If you will not be lazy to run developed sample application, you will notice how cool are Oracle Maps in JDeveloper 11g. To run this application, you need to open it in JDeveloper 11g TP3 and select Run for main.jspx page, you will get similar view:


All functionality available in this screen, comes with standard component in JDeveloper 11g, you don't need to develop it, you can just use it:

Thursday, February 14, 2008

ADF Business Components: Complex Insert in Easy Way

In this post I continue series of my posts related to DML (Data Manipulation Language) in ADF Business Components, those posts are among of most popular on my blog. I'm writing this post and have developed sample application based on comment i received from one blog reader of Create, Edit and Delete operations in Master-Detail af:table components post. Reader was asking me about how during Insert operation to insert data into second table, table that is not referenced through binding in View layer. Yes, it's possible to put custom method in application module and do insert from Java code, however this will broke declarative approach for Create action in main table.

You can download sample application - ComplexInsert.zip, this application implements declarative approach to Insert new row into Locations table and triggers Insert into Departments table. To run this sample you need to have Oracle XE database installed with HR schema. Application is developed with JDeveloper 10.1.3.3 production release.

First let's look into Model part. Application is based on two Entity objects and one View object. LocationsView is exposed to View layer where new row is created in declarative way.


New Location is created with CreateInsert action defined in mainPageDef.xml Page Definition file:


And let's say we have requirement to create default Department for newly created Location. How to achieve this and not to broke declarative approach we have already implemented for Locations? My answer - with ADF BC you can do this in easy way, simply you can use doDML(...) method in Entity object.

In order to be able to use doDML(...) method, with Entity Object Editor generate Entity Object Class and select Data Manipulation Methods option as well:


Entity Object Class is generated and can be accessed from Structure window:


In generated doDML(...) method I have implemented custom code to insert new row into Departments entity with some default data. This code is executed only during Insert DML operation. This allow to insert data programmatically into separate table based on executed declarative Create action:


To make it even more clear, I will show how it works. User creates new Location from Web UI and press Save button - new row is inserted into LOCATIONS table in database:


Based on this insert, default department for newly created location should be generated. We can check this in database. Oracle SQLDeveloper shows that new row is inserted into LOCATIONS table:


That correct, but what about DEPARTMENTS table? We can check it, and here we have new row inserted for newly created Location:


When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.

Wednesday, February 6, 2008

List-Of-Values Component in Search and Edit Form

Sample application described in this post contains high practical value, it implements real use case. Defined use case - based on value selected in List-Of-Values (LOV) component, perform query in database and display results in form. Form with results is updated, when value in LOV is changed.

You can download developed application - LOVSearchEdit.zip and run it in JDeveloper 11g TP3, additionally you need to have Oracle XE database with HR schema.

Model part of sample application contains Locations Entity object and two View objects - LocationsView and CountriesLovView. First View object is based on Entity object and second View object is read-only, is used in LOV component.


View object - LocationsView is used to query database and return results displayed in form. In other words, this View object perform Search action. LocationsView contains WHERE clause with bind variable, it retrieves Locations by specified Country Id:


In View layer of our application, Search action is initialized by LOV component for Countries. I have created this LOV component as unbounded and not related to Model. I achieved this, by declaring countryIdVar variable in Page Definition, and using this variable as Base Data Source for LOV component.


You can create unbounded LOV component in JSPX page, by dropping empty af:inputListOfValues from ADF Faces Common Components palette. As next step, right-click on newly created component and select from menu - Bind to ADF Control. In Edit List Binding dialog you should choose variables as Base Data Source and in List Data Source choose View object that you want to use as list data provider. For example, in my application this dialog looks like this:


To execute Search action, I'm using ExecuteWithParams action defined in Page Definition and associated with LocationView. Input parameter for bind variable is retrieved directly from attribute wired with LOV component Base Data Source variable.


Defined ExecuteWithParams action is invoked from countryIdReturnPopupListener created for Countries LOV:


And finally last step, in order to refresh form with displayed Search results, you need to put AutoSubmit=true for Countries LOV component. And change PartialTriggers property of form with results to point to Countries LOV Id.

And yes, all this stuff really works. When page is opened and there still no value in LOV is selected, empty form is not displayed:


Let's select any value in LOV component:


Search results are retrieved and form with data is opened. User can navigate through results and update locations from selected country:

Saturday, February 2, 2008

ODTUG Kaleidoscope '08 - Abstracts Posted

Conference abstracts are posted, you can check - ODTUG Kaleidoscope '08.

This year ODTUG Kaleidoscope will cover eight main topics:
  • Fusion Middleware
  • Business Intelligence
  • Methodology
  • Oracle Tools
  • Professional Development
  • Third-Party Tools
  • Java EE and SOA
  • Development DBA
My presentation is under Fusion Middleware branch - Development with Oracle JDeveloper/ADF 11g Reusing 10g Best Practices. As you can see from posted abstract, I will talk about development strategies in JDeveloper/ADF 11g and will develop real demo sample application. Topics that I will cover - new ADF BC features, ADF Task Flows, Templating, ADF Faces Rich Client.

I'll post detail information about my presentation, more close to the event.