Pageviews

Saturday, December 28, 2013

Build ADF Hierarchy Viewer Component using custom built java data control.


Step 1:  Create a custom java object to hold the tree node object. I called it as TreeItem in my example.





Step 2: Create a custom java control to load the dummy data. Check out the HRTreeData java class for details.




Step 3:  Open adfc-config.xml, then add a view to the unbounded task flow. Create the view by double clicking the view control. Lets call the view as HViewer.jsf for now.




Step 4: Add HRTreeData as a managed bean resource to adfc-config, so that the custom java class is accessible from the view.



Step 5: Open the view in design mode, drag and drop Hierarchy Viewer component by selecting  ADF Data Visualization option in Component palette window.



Step 6: Add the images required to populate the Hierarchy Viewer component, and then right click on the view and run the application.







Enjoy and have fun!.



Check out the below video for demo.







Click download to get the source code.








Saturday, August 10, 2013

ADF - MYSQL JDBC connection issue.

ADF JDBC Error:

java.lang.ClassCastException: com.mysql.jdbc.JDBC4Connection cannot be cast to oracle.jdbc.OracleConnection
    at oracle.jbo.server.OracleSQLBuilderImpl.setSessionTimeZone(OracleSQLBuilderImpl.java:5534)
    at oracle.jbo.server.DBTransactionImpl.refreshConnectionMetadata(DBTransactionImpl.java:5329)
    at oracle.jbo.server.DBTransactionImpl.initTransaction(DBTransactionImpl.java:1167)
    at oracle.jbo.server.DBTransactionImpl.initTxn(DBTransactionImpl.java:6838)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:298)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:329)
    at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:600)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:417)
    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:9053)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4606)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2536)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2346)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3245)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:571)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:504)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:499)
    at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:517)
    at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:867)
    at oracle.jbo.jbotester.binding.TesterBinding.getConnectionInfo(TesterBinding.java:222)
    at oracle.jbo.jbotester.MainFrame.initializeDataControl(MainFrame.java:945)
    at oracle.jbo.jbotester.MainFrame.loadConfiguration(MainFrame.java:646)
    at oracle.jbo.jbotester.MainFrame.processArgs(MainFrame.java:612)
    at oracle.jbo.jbotester.MainFrame.main(MainFrame.java:446)

Solution:


To resolve this issue, select the SQL Platform to SQL92 when creating the entity objects and associations. SQL92 is the SQL standard platform to connect to MySQL database.  The default selection of Oracle should be used when connecting to Oracle Database.

Please note:  This is a one time setup. This option will not be available to view or modify after the selection is made. Check out the below screenshot for details.





Enjoy and have fun !

Sunday, July 28, 2013

ADF Train Component


ADF Train Component


The train component represents a series of train stops, each stop representing a step in a multi-step process. Each stop is tied to a view (.jsf page). Each page can either interact or display information that will help the user to complete the multi-step process. The train component helps the user to walk through these steps one stop at a time. User will be able to navigate to next stop or the previous stop in order to take corrective action to complete the multi-step process.  The train component can be rendered in a vertical layout as well as in horizontal layout, default being a horizontal layout.  The train component walks through the user in a predefined order as defined in the train model. Each train step is rendered with an image and a textual link indicating if they are in visited, current stop, unvisited stop and disabled state. 

Check out the below demo video explaining , bounded task flow, unbounded task flow, train model, train button bar, task flow control, method call activity etc.,  Persisting the user information collected in each train stop to a database table is not intended to be covered in this demo.  This is a basic demo to explain the above mentioned concepts. Hope it is helpful.


 



Saturday, July 27, 2013

JDeveloper - MySQL DB connection setup


JDeveloper - MySQL DB connection setup


JDeveloper connection to MySQL database is not straight forward, and certainly does not work with out of the box drivers. Check out the below screen shot for details. You need to download and add, Connector/J driver to establish the connection. MySQL Connector/J is the official JDBC driver for MySQL.

Follow the below instructions to download and configure, Connector/J driver.

Here is my connection details,

Connection In: Application Resources (selected by default)
Connection Name: dbConn
Connection Type: MySQL
Username : root

Under MySQL Settings:

Host Name: <Enter your hostname, in my case it is, localhost>
Port: Enter the default MySQL DB port number, 3306
Driver Class: com.mysql.jdbc.Driver (Default)
Library: <Press Browse to select a library>




The problem here is, MySQL connection library is not available by default to establish the MySQL DB connection. 
To resolve this issue, follow the below steps..

Step 1: 

To get the driver, navigate to the following link and download the jar file.


The above link takes you to the main download Connector/J driver location. From here, you have a choice to download as a compressed tar archive file or a zip archive format.

The above link2 takes you directly to download the Connector/J driver directly in zip archive format.

Step 2: 


Place the downloaded jar file under  a domain lib folder location. In my case, I placed the jar file in

Macintosh HD/Users/RajVenugopal/Oracle/Middleware/user_projects/applications/DefaultDomain/lib/mysql-jdbc-5.1.25

Quick Note: I renamed mysql-connector-java-5.1.25,zip to mysql-jdbc-5.1.25.zip. Unzipping the folder gets you the needed driver jar file.



Step 3:


In 'Create Database Connection' wizard, click the library browse button to open up "Select Library" window. Select User selection under Libraries. Click the "New" button to open the 'Create Library' window. Then click 'Add Entry' button to add the downloaded jar file to the library. Check out the below screenshot for details.








Step 4: 

Add the download jar file to the user libraries, and then select 'Test Connection' to test the DB connection. You should get a successful db connection at this point.



Enjoy and have fun.

Friday, July 12, 2013

ADF UI Components, Task Flow and Page Fragments

ADF faces rich client components


The best way to go about exploring the Oracle ADF faces rich client component is by checking out the below link.

http://jdevadf.oracle.com/adf-richclient-demo/faces/index.jspx


Things to remember when working with ADF Task Flow


1) Bounded task flow has only a single point of entry, whereas an unbounded task flow has multiple entry points.

2) Bounded task flow can be called by another task flow, whereas an unbounded task flow cannot be called by another task flow.

3) A new XML file is created every time you create a new ADF bounded or unbounded task flow.

4) XML file for an ADF unbounded task flow is by default called adfc-config.xml.This can be renamed as needed.

5) XML file for an ADF bounded task flow is by default called task-flow-definition.xml. This can be renamed as needed.


6) In both types, Bounded task flows, activities and control flow rules are defined inside the adfc-config metadata element.

7) Bounded task flows are identified within adfc-config by the <task-flow-definition> metadata element.

8) Activity defined within <default-activity> metadata element is the first activity to execute in an ADF bounded task flow. (Note: ADF unbounded task flows do not have default acitivities.).


9) The first view that gets added to ADF bounded task flow diagram automatically identified as default activity. Assuming you have multiple views/activities in your ADF bounded task flow, you can right click any view in the task flow diagram and choose "Mark Acitivity -> Default Acitivity" to change the default activity selection.

10) A single application can have mulitple ADF unbounded task flow XML source files and multiple ADF bounded task flow XML source files.

11) After you create a task flow, you can add activities, and configure the control flow between the activities by simply dragging them from the component palette. Activities defined under Components  are, Method Call, Router, Save Point Restore, Task Flow Call, URL View and View.




Things to remember when working with ADF Page Fragments



1) Page Fragments are nothing but reusable custom components.

2) Page Fragments are incomplete JSF pages. A complete JSF page must have "document" tag enclosed within a "view" tag ( <f:view><af:document>...</af:document></f:view). Whereas a page fragment represents a portion of a complete page, and does not contain the view tag and the document tag. The contents of the page framents are enclosed within a jsp:root tag.

3) The same Page Fragments can be used any number of times within a page(JSF page) or in multiple pages.

4) Page Fragments uses .jsff file extension.

5) Because Page Fragments uses a different file extension from regular JSF page, configuration entries are added to the web.xml file for recognizing and interpreting the page frament (.jsff) files within the JSF page in an application. Entries added to web.xml will look like this..

  <jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsff</url-pattern>
      <is-xml>true</is-xml>
    </jsp-property-group>
  </jsp-config>


6) You can include the reusable component (or page fragment) by dragging "Include" from component palette. This is how you can include a Page Fragment inside your regular view page.
 <jsp:include page="SampleFragment.jsff"/>



Saturday, April 27, 2013

Steps installing JDeveloper on Mac OS 10.8 +


Step 1:  Download & Install JDK

JDK contains the following
a)    Java Runtime Environment (JRE) – The runtime environment for use by the Java Development Kit (JDK). JRE includes a Java Virtual Machine (JVM) – a virtual machine that can execute java bytecode, supporting class libraries and other files that help the execution of code written in java programming language. Location: $Java_Home/jre/
b)   Development tools – Tools to support java programming. Location: $JAVA_HOME/bin/
c)     Java DB – A relational database management system based on java programming language and SQL. Location: $JAVA_HOME/db/
d)    Source Code – Source code that make up the core java. Location: $JAVA_HOME/src.zip



Step 2: Set Java_Home environment variable. To do so, follow the below steps
a)    Open terminal window, and type vi ~/.bash_profile

b)     enter "export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home"



c)     Save and Exit the terminal window.

d) Open the terminal again, type "echo $JAVA_HOME" to confirm the setting up the environment variable and type "java -version" to confirm the java version.


Step 3: Download & install JDeveloper

a   a)    To download, check out the below link –

Ps Note: Choose “Generic” studio edition for installing on a Mac OS.

b) To install, open the terminal, then elevate the current user to superuser of the local system by typing ‘su’ and for the password, enter your admin password. After authentication, type in the following command.

java -jar <path of downloaded jar file>/<jdeveloper.jar> file

In my case, I saved the  downloaded jdeveloper file in my desktop. so the command looked something like this...
java -jar /Users/RajVenugopal/Desktop/jdevstudio11123install-1.jar



 At this stage, you are all set. The installation should start and follow the installation instruction to complete the install process.












Step 4: Enjoy and have fun!.