Showing posts sorted by relevance for query oracle. Sort by date Show all posts
Showing posts sorted by relevance for query oracle. Sort by date Show all posts

Monday, December 31, 2012

My ADF Sample Apps Live in Oracle Java Cloud

With Oracle Java Cloud available for ADF PS5 deployments, I decided to deploy all my future ADF sample apps from the blog in Oracle Cloud, source code will be provided as well as it was up till now. ADF sample applications live will help to explain and present ADF functionality even better, blog readers will be able to test described functionality straight away and provide feedback without downloading and running on their machines. Currently I'm running trial instance of Oracle Cloud for database and Java, but in future I plan to purchase permanent account - let's see how it will go.

Read more about Oracle Database Cloud and Oracle Java Cloud from official documentation. Oracle Cloud right now supports ADF PS5 with certain limitations, please check documentation - however most of the sample apps will run without issues.

I have deployed in Oracle Java Cloud and tested one of the sample apps from my blog post - Tree Table Component in Oracle ADF. This app renders hierarchical data in different levels of the tree, Master-Detail relationship between two tree tables is implemented as well. Original sample app is deployed with minimal changes described below (datasource name and login config are optimized for Oracle Java Cloud). Here you can download source code for ADF app deployed in Oracle Java Cloud - TreeComponents_cloud.zip.

This app is deployed for public access, you can open it by clicking here - Tree Components in the Cloud. Sample app will be loaded and you should see two tree tables rendered with hierarchical data from sample HR schema (see URL pointing to Oracle Java Cloud instance):


We can use Oracle Cloud Service Control for Java to see a list of deployed apps - TreeComponentsApp is one of them. You can find here JNDI Location for Data Source, we will use it in Application Module - database. ADF Application Module will be using it to retrieve data from database Oracle Cloud:


We can review ADF performance for deployed apps - AM and ADF Task Flow usage:


You can deploy ADF app directly using Oracle Cloud Service Control for Java, but same is possible from integrated JDeveloper 11g PS5 environment. You should download latest JDeveloper 11.1.1.6.0 optimized for Oracle Cloud. Apparently Oracle released two JDeveloper versions under the same release number 11.1.1.6.0, Oracle Cloud release was made public around October. So, if you have old 11.1.1.6.0 - remove it and download new one. You should see OCLOUD name in JDeveloper 11.1.1.6.0 build:


I will describe now, what changes I have made to original ADF sample app in order to be able to deploy it and run in the cloud. Firstly you should change JDBC Data Source name for AM configuration, it must be set to database JNDI name, same as it is defined for us in Oracle Cloud Java. This allows to fetch data from Oracle Cloud for database:


Next Application Server connection pointing to Oracle Cloud Java instance must be defined in JDeveloper. Choose connection type - Oracle Cloud:


Provide connection details as per Oracle Cloud documentation and you are almost done.

Almost - because there is just one additional config - ADF application login method handling. By default ADF app is protected by Oracle Cloud security, but I want to make my ADF sample apps public and accessible to everyone. For this reason, I need to include empty login configuration into web.xml - the rest will be handled by Oracle Cloud and ADF app will be public accessible:


This config was suggested by Oracle Cloud automatically, when I was trying to deploy sample app. Deployer creates optimization suggestions and lists them in the deployment log accessible from JDeveloper:


Thats all about ADF deployment to the cloud - very straightforward. Now few words about database schema in the cloud. As usual - I'm using sample HR schema for my sample ADF apps. You can access Oracle Cloud database instance directly from JDeveloper, read this white paper - Data Movement and the Oracle Database Cloud Service. Data can be imported and exported from JDeveloper. However, there is another quick way to populate Oracle Database Cloud - using SQL scripts. Open Oracle Database Cloud instance and go to SQL Scripts section:


I was using HR schema SQL scripts and generated all required tables and populated data:


HR schema data is in the cloud and ready to be accessed from ADF app deployed in Oracle Java Cloud:


I was testing ADF passivation/activation to see if PS_TXN table is automatically created in Oracle Database Cloud. Yes, table was created automatically - perfect:

Friday, November 13, 2015

Oracle JET and ADF Faces Integration in ADF

Method and information outlined below describes my personal research and doesn't define best practice. Such approach is not recommended/supported by Oracle and should be used at your own risk. Oracle is working on JET Composite components for ADF, to be available in the future. Limitations and caveats for this approach are described by Duncan Mills:

1. No session sharing between ADF and JET 
2. ADF and JET can’t use the same cache 
3. No shared transaction 
4. Separate timeouts 
5. Geometry management 
6. Drag&drop not possible between ADF and JET 
7. Different maintenance and different libraries 
8. Different popup’s and glasspane

Oracle JET provides a set of UI components, based on a combination of HTML and JavaScript. ADF Faces is an Ajax-enabled rich JavaServer Faces component framework that uses JavaScript to render client-side components, implement rich component functionality, validate user input and convert user data input. Although it is not officially documented, but obviously Oracle JET components can be integrated into JSF pages implemented with ADF Faces. I think such integration provides many benefits to ADF Faces. Use cases where performance is critically important can be implemented with Oracle JET client components and rich functionality can be implemented with ADF Faces, all in the same ADF application. Probably I would not create dependencies between Oracle JET and ADF Faces components rendered on the same page. Oracle JET should render data coming from REST services, while ADF Faces should work with data obtained from ADF Bindings layer.

I have managed to implement Oracle JET component and ADF Faces UI in the same physical ADF page. Oracle JET group renders input text, user types text and this text appears in the output below (use case is described here - Getting Started Quickly without the JET QuickStart). ADF Faces UI group renders regular ADF data entry form with navigation and save/cancel buttons. It all works together on the same page:


Download sample application implemented with JDeveloper 12.2.1 - SimpleADFApp.zip. I did not delete Oracle JET libraries from the sample application, so you could download and directly run it. Download size is a drawback, Oracle JET is part of application and it occupies around 11 MB.

Some text is entered into Oracle JET field, on enter it is copied into output below:



ADF also works as expected, for example I can change Salary value and commit changes with Save button:


ADF validation also works fine, I remove value for mandatory field and try to save. Required validation message will popup:


Take a look into ADF application structure with Oracle JET elements inside. Basically I just copied Oracle JET files into ADF ViewController public_html folder:


There is Oracle JET JavaScript file, where function is implemented to handle text entry and output update, pretty simple one:


Here it comes the most important part - ADF page. Instead of using HTML page to implement Oracle JET, I'm using regular ADF page based on JSF and ADF Faces. Oracle JET CSS and RequireJS script for Oracle JET are defined in the top of the page, just above the form - this will make sure correct initialisation for Oracle JET:


Oracle JET UI (input text, together with output text) is defined inside ADF Faces Panel Header with HTML div. This is how Oracle JET is rendered inside ADF page, using HTML:


Stay tuned and I will be posting more use cases on Oracle JET integration topic.

Sunday, April 15, 2007

Oracle Maps portlet in Oracle WebCenter

Oracle WebCenter is a framework, that allows using standard portlets in your Oracle ADF application. Oracle Maps product is a part of Oracle MapViewer, Oracle Maps functionality can be used by provided JavaScript API. It was interesting for me - how it is possible to integrate both? I mean - develop portlet with Oracle Maps functionality and integrate it into Oracle ADF application JSPX page. It seems, this is possible and it works perfectly. So, with Oracle WebCenter you can use spatially enabled portlets directly in Oracle ADF. Download developed sample - MapViewerPortlet.zip.

If you are new to Oracle Maps, it would be helpful to review my previous post - JavaScript in ADF Faces - Oracle Maps. For this sample is used the same spatial datasource - MVDEMO. However, instead of Oracle MapViewer Quickstart Kit, I'm using mapviewer.ear application deployed to WebCenter Preconfigured OC4J. Everything you may need for developing spatially enabled applications can be downloaded from OTN. Detailed information about how to use Oracle WebCenter framework you can find in Oracle WebCenter Framework Tutorial.

Oracle Maps functionality is implemented in portlet view.jsp file using JavaScript code. In view.jsp Oracle Maps JavaScript API file is included, style for map window and it's ID is defined, and lastly map creation code is provided. When those steps are done, developed portlet is integrated and created on map.jspx in standard way, like any other portlet used in Oracle WebCenter framework. Oracle Maps API used in this sample is really simple:


When deploying and running developed application, you should carefully follow steps described in Oracle WebCenter Framework Tutorial - 9 Deploying Your WebCenter Application.

Developed spatial portlet used in Oracle ADF should look similar:


It is possible to refresh or hide it. This functionality is provided by Oracle WebCenter framework.

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

Sunday, August 22, 2010

Applying Personalization and Customization in Oracle ADF 11g and Oracle WebCenter 11g

Let me start with simple definition of personalization and customization. Term personalization means user can perform changes visible only to that user. Term customization means user with admin privileges can perform global changes, visible to all users. I decided give you this simple explanation, because while browsing Oracle resources and related blogs, I saw many confusing statements. For example, something similar like - we can apply personalization by customizing. In this blog post I'm not describing predefined seeded customizations, but focusing on user performed runtime personalization and customization. You can achieve personalization functionality within standard ADF framework enabled with MDS. For customization functionality need to use Oracle WebCenter component - Composer. Today I will describe how to use these two together.

First we should take a look, what we can get from Oracle documentation:
My goal today is to join all this information together and provide more hints not described in documentation. Download sample application - PersonalizationCustomization.zip. All examples from this post are based on this sample, you need to have Oracle WebCenter JDeveloper extension installed to run this application.

UserCC class from Oracle documentation contains static user reference scott. I have modified this to retrieve current user name from security context:


As per documentation, I have created all required Java classes to support Edit and View layers:


User customizations and personalizations are enabled to be stored across sessions with MDS. This option is needed to store changes for ADF components, Oracle WebCenter Composer is working without this option as well:


I have change customization class from SiteCC to UserCC, this enables personalization:


Session options factory is class must be configured in adf-config.xml to enable customization:


As per documentation, additionally you need to declare Oracle WebCenter Composer servlet in web.xml.

ADF Security defines two application level roles - admin and customer. Admin role is granted with Customization permission:


Customer role is granted with Personalization permission only:


Session options factory class as per documentation, defines two layers - Edit and View. You can see that Edit layer is applied on global level (its when Oracle WebCenter Composer is invoked to perform customization). View layer is applied on global and user levels (this means each user will see global customizations and their own personalizations):


If Oracle WebCenter Composer is On, Edit layer is enabled, otherwise - View layer:


I have declared two users - scott (admin role) and john (customer role). Now I open application with admin role user scott - it brings blank screen and option to invoke Oracle WebCenter Composer (Edit):


Oracle WebCenter Composer invoked to perform customization visible to all users:


I can add my custom ADF Task Flow with Employees data from extended Resource Catalog:


Through composer we can change visual and layout properties:


Customization is done, user scott can close Oracle WebCenter Composer. Now the same user performs personalization - removes PhoneNumber column from Employees table. This change will not be visible to other users, because it is personalization:


In order to perform personalization on table and column components, you must declare them in tag configuration:


We can see two folders in MDS repository - site and user. All customizations are stored inside site and personalizations inside user. This means customizations will be visible to all users and personalizations per specific user only:


I login as user john and can see Employees table added by user scott (customization), I can see PhoneNumber column as well (because it was user scott personalization):


User john is not allowed to perform customization, only personalization - Oracle WebCenter Composer is disabled for this user. User removes all columns, except FirstName, LastName and PhoneNumber:


As we can expect, this personalizations are not visible for user scott:


Now we take a better look, what Personalize permission means. Let's revoke it from customer role:


We can't personalize anymore elements created by Oracle WebCenter Composer - WebCenter Customizable Components (in a Panel Customizable or Show Detail Frame). There is no option to disclose, resize or delete:


I enable Personalize permission again:


Now user with customer role is able to do personalization and remove Employees table added through Oracle WebCenter Composer customization:


Personalization is successful, however user granted with Personalize permission only is not allowed to invoke Oracle WebCenter Composer and add custom ADF Task Flow from Resource Catalog:


Only user scott, who is granted with Customize permission can do this:


Now I will describe how to apply personalization through Oracle WebCenter Composer, so user who is not granted with Customize permission will be able to invoke Composer as well.

We need to add one more customization layer, this time only UserCC:


I gave Edit Personal Layer name for this layer. Now we need to modify layer switch logic. Edit layer will be initialized only in that case, when current user is granted with admin role. In all other cases, Oracle WebCenter Composer will be opened in Edit Personal Layer - this means personalization will be applied:


In order to open Oracle WebCenter Composer, in addition to Personalize permission, we need to grant Edit permission:


User john, with Personalize and Edit permissions is able to open Oracle WebCenter Composer and perform personalization:


Personalization - Employees table:


John Employees List personalized table:


Because user john was allowed to do only personalization, another user scott will not see any changes:


We know that user scott is allowed to perform customization, let's test how it works. User scott will add the same Employees ADF Task Flow and name it - Global Employee List:


It should be visible for user john as well, because it is customization. Yes, user john can see both tables now - one comes from personalization and another from customization:


If user john, don't want to see global list of employees, he can perform personalization further and remove this customization. It will be removed only for this specific user:


Now user john can see only his personalizations, no global customizations:


As expected, another user scott, can see customizations (even they were removed by user john - personalized):