Please disable your adblock and script blockers to view this page

Search this blog

Wednesday 30 December 2015

Create REST Web Service with Application Module declaratively in ADF 12.2.1

REST stands for Representational State Transfer, REST is an architectural style not a protocol as SOAP that's why it can use any other protocol like SOAP, HTTP etc.
REST requires less bandwidth and resources (lighter) than SOAP

New ADF 12.2.1 supports creating RESTful web services directly from Application Module, In previous versions we have to do everything manually
See- Create RESTful services on top of ADF Business Components

Tuesday 22 December 2015

Create SOAP Web Service with Application Module quickly in ADF 12.2.1


SOAP stands for Simple Object Access Protocol, a protocol to exchange information in XML format between two applications over HTTP. This protocol is used to create ,access and consume web services.

SOA (Service Oriented Architecture) focuses on re-usability and exposing application module as web service makes it's methods and objects accessible from any device , any platform and these methods and objects can be further used by any other application

Friday 18 December 2015

Scroll to particular component using af:scrollComponentIntoViewBehavior tag in ADF Faces


You all must have seen HTML Anchor links, this is actually called link within page and used to navigate between page sections
Same as HTML anchor tag ADF Faces has <af:scrollComponentIntoViewBehavior> tag that allows user to jump to a particular component on page

Tuesday 15 December 2015

Checkbox ValueChangeListener problem in af:table - ADF 12.1.3


Recently i faced a problem while working on one of my application, it has an editable table having one check box column and a valueChangeListener is defined on that check box.

Problem is that whenever user selects any row of table , valueChangeListener of check box is called every time for all editable rows, this is weird because VCL should execute only when user selects or deselects check box

Monday 14 December 2015

Responsive UI with new af:matchMediaBehavior in ADF 12.2.1.0


Jdeveloper and ADF 12.2.1 comes with many new features ( see these posts-
New look of dvt:funnelChart for Data Visualization in Jdeveloper 12.2.1.0
New look of dvt:pieChart as donut chart for Data Visualization in Jdeveloper 12.2.1.0  )
and supports responsive UI design.
Masonry Layout and MatchMediaBehaivor tag is introduced to support responsive UI design

af:matchMediaBehavior allows developer to control properties of components according to screen size. It uses CSS media queries to detect screen size and changes value of specified property of component

Friday 4 December 2015

New look of dvt:pieChart as donut chart for Data Visualization in ADF 12.2.1.0


Oracle Jdeveloper 12C (12.2.1.0) documentation tells about a new enhancement in look of pie chart

We can now design donut chart using dvt:pieChart , innerRadius property allows us to create donut chart look on the base of default pie chart.
Donut chart is nothing just a variation of pie chart that show data in sections of a circle, I believe everyone knows how to design a pie chart in ADF Faces

Thursday 26 November 2015

Responsive UI with new Masonry Layout in ADF 12.2.1.0


What is Responsive UI and Why it is Important-

User interface or view of website or web application changes as the screen size of device changes
This type of UI is called Responsive and it is important to design responsive UI for your application because each device have different screen dimension and you can not restrict user to use any specific device to view your application . This is very basic requirement of web development that UI should look good on Mobile, PC, Tablet or any other device

Saturday 21 November 2015

New look of dvt:funnelChart for Data Visualization in ADF 12.2.1.0

A couple of weeks ago Oracle Jdeveloper and ADF team released new version of Jdevloper 12.2.1 with many cool features
New funnel chart (<dvt:funnelChart>) is introduced instead of funnel graph (<dvt:funnelGraph>)
Old funnel graph looks like this-



Funnel chart is used to show visual distribution of different steps of any cycle
What docs says-

A chart representing data related to steps in a process. The steps appear as vertical slices across a cone-shaped section which represent stages of a procees or target and actual values, showing levels by color.

Here we see how to use this new component to design a better UI, For this I have created a viewObject using this sql




SELECT A.DEPARTMENT_NAME, 
B.FIRST_NAME ||' '|| B.LAST_NAME AS EMPLOYEE_NAME,
B.SALARY,
100000 AS TARGET
FROM DEPARTMENTS A, EMPLOYEES B
WHERE A.DEPARTMENT_ID=B.DEPARTMENT_ID;

Then go to datacontrol and drop this viewObject on page as chart

In dialog select Funnel on left panel and you can select horizontal or vertical layout of funnel at right side


This is the configuration screen for Funnel. Here we can select Actual and Target values and Section Name appears on view port


Click on ok button of this dialog and your Funnel chart is ready
See generated XML-


<dvt:funnelChart id="funnelChart2" var="row" value="#{bindings.DeptEmpView11.collectionModel}">
                        <dvt:funnelDataItem id="di2" targetValue="#{row.Target}" label="#{row.DepartmentName}"
                                            value="#{row.Salary}"/>
                    </dvt:funnelChart>

Now run this application and see how it appears :)


Wow.. it's good :)
If we want to show only Departments Name with salary (No comparison with Target) then just remove this targetValue from xml code and then it looks like this


There are lots of properties to change it's layout , 3D effect , Title , FootNote etc. Try each one and see how it affects Funnel

Cheers :) Happy Learning

Tuesday 3 November 2015

ADF Basics: Using f:attribute to pass parameter in ActionEvent

f:attribute tag (JSF Tag supported in ADF Faces) is used to pass some additional attribute value to associated component
Sometimes using f:attribute simplify a complex piece of code, this tag has very simple structure. It has two properties

name- Name of tag attribute
value- Value or an EL reference of value

Here in this post we will see how to use this tag with ADF Faces, I am using Departments table of HR Schema and requirement is to delete departments with attribute DepartmentId  greater than 100

Friday 30 October 2015

Read data from Google Spreadsheet without authentication using Java

Google Spreadsheets provides a way to create, edit, save spreadsheets online.
The Google Sheets API (formerly called the Google Spreadsheets API) lets you develop client applications that read and modify worksheets and data in Google Sheets.
Read More about Sheets API

Let's see how to use this API to read data from Spreadsheet, here i am going to use Spreadsheet version 3.0 , if this link doesn't work then check on GitHub , from here you will get  client library for all Google APIs

Saturday 24 October 2015

Oracle JDeveloper and Oracle ADF 12c (12.2.1.0.0) out (bug fixed and lots of new features introduced)

Time to check new Jdeveloper 12.2.1 , Wait is over Check out new features :)
Download- Oracle JDeveloper 12g (12.2.1.0.0)

1. Alta UI is now default skin for all ADF Faces components , previously it was Skyros
Read more about Oracle Alta UI Design Patterns

4. In Data Visualization some change done in Pie Chart and Thematic Map. New component NBox and funnel chart is introduced

Monday 19 October 2015

Get domain information (WHOIS) using Apache Commons Net API- ADF & Java

We can get any domain information using Apache commons net library. It supports various protocols and WHOIS information is one of them

WhoisClient class provides access of domain information
See what docs says -

The WhoisClient class implements the client side of the Internet Whois Protocol defined in RFC 954. To query a host you create a WhoisClient instance, connect to the host, query the host, and finally disconnect from the host. If the whois service you want to query is on a non-standard port, connect to the host at that port.

Download required library or if this link doesn't work then goto API page and download from there

This simple java method will fetch information of domain using Apache library

Wednesday 14 October 2015

Blog Completed 3 awesome years

I am happy to tell you that my (Ashish Awasthi's Blog) blog has completed 3 years today.
On 14-October-2012 i have posted my first blog post on ADF Basics: Show inline Message in Oracle ADF and till now blog has more than 180 posts on ADF, Java, JavaScript, jQuery etc.

I started blogging to help Java & ADF developers, to share what i have learnt and still trying to do same
Initially started this blog with blogspot.com - oracleadf-java.blogspot.com & after one year changed it to a custom domain www.awasthiashish.com

It has 1700+ fan following on facebook -Facebook Page
Now i am trying to put some more interesting stuff to learn, Keep an eye on blog

Taking as a whole it was awesome journey of 3 years :) Thanks for your support , Keep reading Keep Learning :)

Now say Happy B'day to Ashish Awasthi's Blog  :)



Wednesday 7 October 2015

ADF Basics: Reorder ADF table column using DisplayIndex property

This post is about a very simple use case that is reordering of af:table column at run time. 
Ordering of columns in af:table is controlled by DisplayIndex property of af:column
Check what docs says-

Default Value: -1

The display order index of the column. Columns can be re-arranged and they are displayed in the table based on the displayIndex. Columns are sorted based on the displayIndex property, columns without displayIndex are displayed at the end, in the order in which they appear. The displayIndex attribute is honored only for top level columns, since it is not possible to rearrange a child column outside of the parent column.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core

We can set DisplayIndex property for all columns in a sequence (1,2,3 etc) that we want to see on page

Monday 5 October 2015

Allow user input in Jdeveloper for Java applications, Using Java Scanner Class to take input from console

Sometimes we have to take input from Keyboard when we use Scanner or BufferedReader class.
and to take input from Jdeveloper we have to change a setting to allow user input in Jdeveloper.

Let's take an example of java.util.Scanner class-

package client;

import java.util.Scanner;

public class UserInput {
    public UserInput() {
        super();
    }

    public static void main(String[] args) {
        System.out.println("Please Enter your Name-");
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        System.out.println("Your Name is " + name);
    }

}

Tuesday 22 September 2015

Using popupFetchListener to execute method on popup launch in Oracle ADF

Everyone must have used ADF Faces popup component , this is one of most used container to show information on top of page
In this post i am talking about popup fetch event suppose we have to perform some operation before opening popup like filtering data inside popup . We can do this by capturing popup fetch event, if you have checked af:popUp documentation then you must have seen concept of popupFetchListener

From Docs-
The PopupFetchEvent is one of two server-side popup events but doesn't have a corresponding client event. The popup fetch event is invoked during content delivery. This means that the event will only queue for popups that have a contentDelivery type of lazy or lazyUncached. Another caveat is that the event will only work when the launch id is set. This is automatically handled by the af:showPopupBehavior but must be provided as a popup hint if programmatically shown.

So here we will see -

How to use popupFetchListener to filter data inside popup ?
How to execute some operation before opening popup ?
How to call AMImpl method before launching popup?

Monday 14 September 2015

ADF Basics: Call PL/SQL Stored function in ADF Application


This post is about calling stored function in ADF Application , a very basic requirement. Many times we need to call a PL/SQL function in ADF app for any specific requirement.
In this post i am discussing same so for that i have created a PL/SQL function that takes EmployeeId as input parameter and return it's Employees Name (Using Oracle HR Schema)


CREATE OR REPLACE FUNCTION FN_GET_EMPNAME(EMP_NO NUMBER)
RETURN VARCHAR2 IS
   EMP_NAME VARCHAR2(50) := 'N';
BEGIN
   SELECT FIRST_NAME||' '||LAST_NAME into EMP_NAME
   FROM EMPLOYEES WHERE EMPLOYEE_ID=EMP_NO;
   
   RETURN EMP_NAME;
END;

Thursday 10 September 2015

Jdeveloper installation folder size increasing beyond limit , Reason was hprof (Heap Profiling) files

Recently i faced a problem, i was lacking space on my C drive so  checked all directories and found that the size of Jdeveloper 12.1.3 installation folder Oracle-->Middleware  was approx 30 GB . This is not expected as Jdev. takes approx 1.5 to 2 GB space only


Then i found some java_pidXXXX.hprof file that was taking lot of space in this folder

Saturday 5 September 2015

Apply ValueChangeListener to programmatically created ADF Faces components

Again a post in series of  Working with ADF Faces Components programmatically
Previously i have posted about Getting value , Applying Action Listener , Applying Client/Server Listener, Creating and applying client Attributes, Setting value expression , Applying Validation to programmatically created component
Now this post post is about applying Value Change Listener to a component that is created at run time
See how to do this (Jdev 12.1.3)-
  • First created a FusionWebApplication and a page in viewController project
  • Dropped a button on page , on this button action i will create an inputText programmatically and assign Value Change Listener method reference to it
  • To create new inputText i have added following code (described in previous post)