Oracle Mobile Cloud Service 3 Days Workshop in Madrid

Last week I had the chance to attend a Mobile Cloud Service 3 days workshop in Madrid. This was the first MCS training in Spain where some partners and I were able to get a good insight about what MCS offers and also a complete hands-on.

If you want to know MCS functionality you can check my previous post: Oracle Mobile Cloud Service overview.

Although I already attended Oracle Summer Camps workshop in Lisbon, we are in the middle of a MCS development and  this workshop was a perfect fit for mastering my MCS skills and also any question we made was perfectly answer by Mireille Duroussaud (Senior Principal Product Manager).

We were also able to see some of the features that will bring the next versions of Mobile Cloud Service like Mobile Application Accelerator (Oracle MAX), and hear of others like for example a JavaScript editor for implementing and debugging APIs right in the browser.
I was really impressed about Oracle MAX becasue building a Mobile Application connected to Mobile Cloud Service was just a matter of 10 minutes. Although the things you can do with Oracle MAX are limitted, it is likely possible that we will be able to donwload the source code of the generated application to extend it wich is a nice feature.
I think this is a must-attend workshop it you are planning to start a Mobile Cloud Service project anytime soon. You can also check Oracle Mobile Platform Youtube channel where you can find more than 50 videos about MCS.

ADF: Filtering parent and child nodes in af:tree / af:treeTable

One of our customers required to filter data in a page with a tree component. Using Ashish’s post I am going to show you how to filter both parent and child nodes having just a single filter value. This can also be applied to treeTable component.

The first thing we need is a tree component and data structure, in this case we are going to use Oracle’s hr schema tables: Departments and Employees.

In our page we drag and drop DepartmentsView from datacontrols palette and create a tree component.

The next thing we have to do is to create a View Criteria in Departments View Object (parent).

We also have to crete a View Criteria in Employees View Object (child).

We have to expose setter method of the bind variable in parent View Object.
As we exposed the bind variable in parent, we need  to pass that value to the child by overriding createViewLinkAccessorRS method in parent View Object Implementation class (DepartmentsViewImpl.java)

The last step in the Model is to set a default View Criteria in parent View Object. To set it we have to right click on the View Object instance in our AppModule, click on ‘Edit’, select the View Criteria and click on ‘Ok’ button.

The Model is now finished, we now have to drag and drop the setter method from the data controls palette and create an ‘ADF Parameter Form’ so we can provide the filter value.

This will create ‘setsearchValue’ method binding in the pageDef. We also need to create a Execute operation of the parent View Object and call both operations from the ‘Filter’ button ActionListener.

This is how we should have the page.

If we run the application we can see the if we filter by ‘pat’ we just get values that contains that string.

If now we filter by ‘les’, we can see that we get values with ‘les’ string in both parent and child nodes.

PCS: Form rules in human tasks

In Oracle BPM it is possible to use Oracle ADF to implement Human Tasks, but in Oracle Process Cloud Service you can only create a form using web forms. Creating a form is an easy task and it offers us to define rules that it gives us a lot of flexibility to achieve complex requirements.

Having this simple form. We can navigate to rules clicking on the marked button.

For each of the elements we have a number of properties or events that we can manage,
For example we can manage form load event, or get if a field value is valid…

To build the rules we have to use JavaScript and we can get code snippets if we click on the button next to each of the properties.

Let’s build a couple of rules so you can see how easy it is.
Having this combo with this value.

We can build a rules that populates that combo and also add some kind of value change listener so if its value is “Spain” we can set the country code in Telephone field.

If we have any syntax errors, will be displayed in the bottom of the editor.

Once the error is fixed we can test the form clicking on the marked button.
We can see that the combo is now populated and if we select Spain, the country code is set.

PCS: Starting a process instance remotely

While implementing an Oracle Process Cloud Service PoC we had the requirement to allow users to start an instance using a form in their custom mobile application and also using the workspace.
We have a ‘Form Start Event’ so users can start the instance thought the workspace. We also added a ‘Message Start Event’ in order to publish it as a web service.
Having that process deployed, if we head to ‘Deployed Applications’ in workspace main page.

And click on the button in ‘Actions’ column.

We can see the web services exposed.

If we use that wsdl url in soapui we see that we have 2 operations, one for each of the start events.

Executing both, we can see that even using ‘Form Start Event’ we can start a process instance remotely as an operation is automatically created in the web service, so we can remove the ‘Message Start Event’ as we can meet both requirements just using the ‘Form Start Event’.

If we open aproval form in the workspace we can see that the data sent from soapui has been successfuly sent.

ADF: Display Map values in af:table

When we want to populate an af:table programatically we usually use a collection based on a java bean (e.g. List<MyObject>) but in this post of JDeveloper & ADF the developer required to populate the table with Map values.
First we need to create a Map in our bean and add the values that we are going to show in the table.

If we try to populate the table we can see tat we need to know the keys of the Map to get the values.

As you can see Value Columns displays the value in the Map for ‘Key 1’ key, but using this method we can not dynamically display all values.

To solve this issue we need to create an array in our bean where we will have all keys of the Map.

Now that we have created in our bean all that we need, we can start building the table structure.

On the table of the second image we need to make some changes. First, instead of using Map property, we have to use the key array we have just created as value property of the table.

And, as we have to access Map values, we have to add an af:iterator inside the table and add the columns we need inside this iterator. The value property of this iterator is the Map property in the bean.

This way, to retrieve keys we are going to use #{row} and to retrieve values asociated to a key we are going to use #{var[row]}.

Oce we have finished with the changes, if we run the application we can see that all the values of the Map are displayed in the table without the need of knowing the keys of the Map.