Browse Month by May 2016
View Post

ADF: af:table filter modifications using a custom Query Listener

In one of our last projects we had the requirement to allow the user to filter tables using the table filter feature. By default you can filter String fields starting with the word that the user provides, but our customer needed to find the rows that contained the criteria.

This is an easy task that can be accomplished by creating a custom Query Listener method.

As by default the filter works with “Starts with” condition you will see that filtering by “tra” will give no result although departments like Administration exists.
In this example we will use Departments table in HR schema.

When we drag and drop to create a table and we set it to be filterable, we can see that a query listener has been created by default.

As we need to modify the filter values we need to create ouor own query listener.
The idea of this method is to get every value, and if it is String we have to change the original value and concatenate ‘%’ before and after the value.
After that we need to call the default query listener that we can get from queryListener property in the table component.
If we end here, the  user would see the new filter with % symbol, so we are going to remove it and leave it as the user type it.

This is the helper method we use to call the default  query listener.

The last step is to set our new method as the table’s query listener.

If we run the application we can see that if we filter by “tra”, we can now see some records.

View Post

ADF: DVT Charts based on a dynamic vo

In one of our latest projects we had the requirement to create a reporting feature that based on some filters we had to built a custom query and display those results in a chart.
In this post I will show you the approach we followed.

The first step is to create a dummy view object. We are going to use SELECT * FROM DUAL as its  query.

After this we need to add this view object to our Application Module data model and also create AM implementation class.

The main thing we are going to make is to create a List in our bean, based on a POJO that we will populate with our viewobject data.
We are going to add 3 attributes to our java class with their getter and setter methods.

After that, in our page’s bean we need to create a couple of properties. The first one is the List that will hold the values, and that will be the value property of the graph, and the second one is a String that will be the value property of the input where we will introduce the query.

The next method of the bean is the one to create the graph.
The first three lines let us create the viewobject a runtime passing the query and the view object instance.

In the rest lines of our method we are just iterating the view iterator and populating the graph List object.

The last step is to create the page that will looks like this

In the page definition file associated to the page we have to create the iterator binding that we are using in the bean.

While testing if we use this query, we will see a graph with the data.

And if we change it, the graph will change with the new query’s data.

View Post

Oracle MCS 16.2.3 (v2.0) realeased. MAX and Location Services are now available

Oracle Mobile Cloud Service 16.2.3 (v2.0) has been released. This is the second major release in less than 1 year (Oracle MCS was released in July 2015). Although not every MCS instance has this new version, we can already see what’s new in it.

  • Location Based Services
We are now able to present information based on the location or preferences of the user. Thanks to the Location API we can get information about the location devices, assets and places.
Location Device is any device that provices location services, for example a beacon.
Currently Oracle MCS provides support for this protocols:
    • Altbeacon (Open Source)
    • Google’s Eddystone
    • Apple’s iBeacon
The second one is a Place  that is a physical location that you can associate with a device.
And the last one is an Asset. This is a mobile object that can be also associated with a location device.
Oracle MCS provides a REST API using the following endpoint “/mobile/platform/location/devices”
  • Oracle Mobile Application Accelerator (Oracle MAX)
Although I already had the chance to see what Oracle MAX offered back in January in a Workshop in Madrid, I was exited to see new features that MAX provides since then.
Oracle MAX is a Rapid Mobile Application Development (RMAD) tool that help us to build applications easier and faster. This tool allows business users and non developers to build applications.
It provides a development based on wizards where we can define the layout, selecting one from the predefined layouts and building each of the screens using components like lists, froms or charts consuming the APIs we have designed and implemented in Oracle MCS.
At this point we have to download Oracle MAX application that is available in Google Play Store and Apple App Store and scan the generated QR.
Who knows what features will bring future versions but it would be great if we will be allowed to download the source code to improve and extend those applications. 
  • More features
Other new features included in this version are new Security Policies for REST Connectors (Oauth and JWT) and we can also allow the users to login into the apps using their Microsoft Azure Active Directory by configuring it as an identity provider.
More posts will come in the next few weeks, stay tuned!
You can get more information in this link: What’s New in Mobile Cloud Service?
View Post

Oracle MAF: Oracle MCS as authentication provider

An usual requirement when working with Oracle Mobile Application Framework and Oracle Mobile Cloud Service is implement the login against Oracle MCS.
In this post I am going to show you how to configure Oracle MCS as an authentication provider in Oracle MAF.

  • Creating a Realm
A realm is a security context for a ser of users. We can have only one realm for each Mobile Backend, but we can have multiple Mobile Backend using the same realm.
Using one or more realm in MCS will depend on what users we will like to give access to our application.
Under Applications, we can find Mobile User Management. By default there is one realm named ‘default’, but we can create a new one by clicking on ‘New Realm’ button.
In the realm we can find some user information by default altough we can add more properties.

  • Create and configure a Mobile Backend
A Mobile Backend (MBE) is the gateway to Mobile Cloud Service. If we want to access any available resource from MCS, for example an API, we have to do it though an MBE.

We can find Mobile Backends option under Applications menu option.

Click on ‘New Mobile Backend’ to create a new one.

Once you have created the MBE head to Users option and click on ‘Change user realm’, by default the MBE has a realm but in this case we need to set the new realm we have just created. This is not the case, but we can also set a default realm for every new created MBE.

In the popup we can select any existing realm.

After that, as there is no users in the realm you can add them by clicking on ‘Add New User’ button.

You will receive an email to the email address you used to register the user.
  • Configuring a MAF Application.
The last step is to configure the MAF application. Here is a couple of things that we have to do.
First we need to create a secured page. We can do it in maf-feature.xml
The last thing is to configure the login server.
To do this, we need to open maf-aplication.xml. We can find the file in ‘Application Resources’ under descriptors/ADF META-INF folder.
Click on the add button.

In the popup we have to select HTTP Basic as Authentication type and set a name to the connection.

In HTTP Basic tab we need to configure login and logout URLs.
To build this URLs we need to know the base URL, and add to it at the end ‘/mobile/platform/users/login’ in Login URL and “/mobile/platform/users/logout” in Logout URL.
We can check the base URL in MBE Settings menu option.

The last step in the cofiguration is to add a custom header. The header name will be ‘Oracle-MobileBackend-ID’ and the value can be also found in MBE Settings menu option.

We just have to execute the application. As soon as we do it, the login page will appear.
If we set the right credentials we will access our secured page.
But if we enter wrong credentials we will se a’Invalid username or password.’ error message.