Wednesday, December 28, 2011

Oracle ADF - Storing temporary values in PageFlowScope created at Run time

Greetings,

Some time you need to store temporary values on the page like a global variable. Oracle ADF provides various bean scopes like pageflow scope, session scope etc etc we can definitely use them

But can you create pageflow scope at run-time? the answer is YES


Lets explore a simple example

Example:
When you press the button on the screen it will count and display how many times you have pressed the button and counter will be different for each browser window or tab



Technical detail:

  • We have an input text component and its value using a page flow scope bean attribute called 'counter'
  • We got a button on screen which is calling an action listener method doCounting()

How Example works:

  • When we pressed the button on screen it creates a pageflow scope bean on runtime called 'myCounter' and increment this value on every button pressed.
  • The value of myCounter then assigned to pageFlowscope attribute in a managed bean called 'counter' which is visible on screen as output text

Following is the code on button with other helping methods

    //Method on the button
    public void doCounting(ActionEvent actionEvent) {
      
        Number value = (Number)getPageFlowScopeValue("myCounter");
        if (value.intValue() >= 0) {
            setPageFlowScopeValue("myCounter", value.intValue() + 1);
        }
        
        setManagedBeanValue("pageFlowScope.pFlowBean.counter",getPageFlowScopeValue("myCounter"));

    }
    //Method to set the value of page flow scope created on runtime
    public void setPageFlowScopeValue(String name, Number value) {
        ADFContext adfCtx = ADFContext.getCurrent();
        Map pageFlowScope = adfCtx.getPageFlowScope();
        pageFlowScope.put(name, value);
    }

   //method to get the value of page flow scope created on runtime
    public Object getPageFlowScopeValue(String name) {
        ADFContext adfCtx = ADFContext.getCurrent();
        Map pageFlowScope = adfCtx.getPageFlowScope();
        Object val = pageFlowScope.get(name);
    
        if (val == null)
            return 0;
        else
            return val;
    }

   //Methods used to get and set the values in a Managed bean
    public Object getManagedBeanValue(String beanName) {
        StringBuffer buff = new StringBuffer("#{");
        buff.append(beanName);
        buff.append("}");
        return resolveExpression(buff.toString());
    }

    public Object resolveExpression(String expression) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
        return valueExp.getValue(elContext);
    }

  
    public void setManagedBeanValue(String beanName, Object newValue) {
        StringBuffer buff = new StringBuffer("#{");
        buff.append(beanName);
        buff.append("}");
        setExpressionValue(buff.toString(), newValue);
    }

    public static void setExpressionValue(String expression, Object newValue) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
     
        Class bindClass = valueExp.getType(elContext);
        if (bindClass.isPrimitive() || bindClass.isInstance(newValue)) {
            valueExp.setValue(elContext, newValue);
        }
    }


Download the sample code

Note: There are many ways to do the same task one technique is demonstrated by Andrejus click here

Have a nice day,
Zeeshan Baig

Tuesday, December 13, 2011

ADF task flow webinar details - Repost


Hi,

I appreciate for all your amazing support for this session even i had to rescheduled it due to emergency.

This Thursday the show must go on.....

Here are the details i will cover much more than the description

December 15, 2011 3:00 PM - 4:00 PM EST
ADF Task Flows for Beginners
Zeeshan Baig


ADF Task flow is most important and essential feature of ADF development which makes ADF unique in the battle of frameworks. This session will help you to understand different components and techniques to build task flows as well as building static and dynamic regions on JSF pages.

During this session we will dive into the following:

1. Understanding different components to build task flows.
2. Building task flows templates.
3. Building static and dynamic regions.
4. Basic techniques to build reusable task flows.


Registration Web Link: https://www3.gotomeeting.com/register/133729022

Thursday, December 1, 2011

Today's webinar is rescheduled to December 15, 2011

Hi,

Due to some emergency we have rescheduled the webinar which was going to held today at 2 PM CST to December 15, 2011 to same time.

More info will post soon.

Zeeshan Baig

Thursday, November 17, 2011

How to Play / Embed Flash .swf file in Oracle ADF application

Greetings,

I got this questions couple of times so i decided to write another quicky here. You can play flash in 2 ways
  • Using af:inlineFrame component 
  • Using af:media component
As an example we have .swf file in your imgs folder as shown in the slide




The difference would be af:inlineFrame will show the flash on page



af:media will display it as a link (unless you have a video as source) clicking on the link will open flash file




The output would be similar as follows




Have a nice day,
Zeeshan Baig

Tuesday, November 15, 2011

Book Review: Oracle Weblogic Server 11g Administration Handbook By Sam Alapati

Greetings,

Here is my first book review Oracle Weblogic Server 11g Administration Handbook by Sam R. Alapati.


Where to get the book:
You can buy the book from following suppliers
Introduction:
Oracle Weblogic Server is a huge subject and this book covers a lot about it from installation, configuration, managing, deployment to securing topics.
 
Book is almost 500 pages and has lot of detailed topic and sometimes it overwhelm the reader but that is the requirement of the handbook it has be to be in detailed.

Structure of the book:
Topics are mostly explained in detail first then provided step by step instructions to configure with screen shots.

Chapter wise Review:

Chapter 1: Installing Weblogic Server and using Management Tools
First chapter will take you through a journey with weblogic terminologies then installation, un-installation, re-instillation, upgrade of the product later it touches different sections of weblogic administrator console as well as using WLST (Weblogic scripting tool).

Chapter 2: Administering Weblogic Server Instances
This chapter starts with setting up weblogic environment, node manager configuration including how to setup node manager to run as windows service was a treat. The real deal of this chapter is it covers various ways to start and stop weblogic server instances in a great detail.

Chapter 3: Creating and Configuring Weblogic Server Domains
As title said this chapter covers creating and configuration of weblogic server domains. Author showed us various techniques to create a domain templates using command line as well as GUI covering Admin, Managed Servers with clustering. Later part of the chapter explains about configuring the environment including persistent store, HTTP server, weblogic proxy plug-in, virtual host and backing up the domain.

Chapter 4: Configuring Naming, Connections, Transactions and Messaging
With this chapter you moved into the day to day practical stuff for weblogic. Chapter covers JNDI, directory, data sources, JMS and java mail configurations.

Chapter 5: Configuring Weblogic Server Environment
This chapter touches topics with thread management and work managers mostly used for load distribution in weblogic environment.

Chapter 6: Monitoring and Troubleshooting Weblogic Server
This chapter explains through different diagnostic options weblogic provides, It covers JRockit flight control and new weblogic monitoring dashboard console. Later part of the expert explain troubleshooting with weblogic administration console, logging, thread and memory management. 

Chapter 7: Working with Weblogic Server Clusters
Weblogic clusters is the most important feature for real world projects and this chapter did a justice with it, as the title says it covers the clusters architectures, configuration, deployments and management. later part of the chapter covers weblogic load balancing and failover capabilities

Chapter 8: Understanding Weblogic Server Application Deployment
This chapter covers application deployments starts with application types. deployment tools like weblogic.Deployer, Admin console, WLST, wldeploy Ant. The chapter also covers the deployment plans and monitoring applications as well.

Chapter 9: Managing Weblogic Server Security
Weblogic security is a deep sea and with this chapter get ready to take a scuba dive. Chapter covers from basic info to security realm, providers, users, groups, roles, policies and at the end author explain in detail configuring SSL to trust between different weblogic domains and chapter ends with weblogic best practices.

Chapter 10: Weblogic Server Performance Tuning
The book ends with the encore weblogic performance tuning in detail like thread management, JVMs, garbage collections, persistent stores, JDBC datasource pools, JMS and little intro about Oracle Coherence.

About the Author:
Sam R. Alapati is an Oracle ACE and has written many books on Oracle technologies on different topics and have many years of experience in the industry. He blogs at http://www.miroconsulting.com/blog/ and have twitter account http://twitter.com/miroconsulting

Final Thoughts:
I think the book shares a valuable knowledge for professional who wants to get in to weblogic server admin chair as well as consultants, developer who likes to get familiar with typical concepts of weblogic world.

I have this is in my shelf and this book helped me to tune my current weblogic environment and i definitely this a recommend read and i hope you will get this too

Have a nice day,
Zeeshan Baig


Saturday, November 12, 2011

How to Right Align Column Data in af:table Footer

Hi,

Problem:

When you display any data in footer facet of  af:column (or af:table) in af:table by default the data aligns to left even you set the af:column align property to right as shown in the following slide.



Solution:

Solution is simple all you need is to wrap your data with af:panelgrouplayout

  • set Halign = "right"
  • layout="horizontal"


    
       
    
 
The output would be similar as shown in the slide



Thursday, November 10, 2011

User Lockout feature in Weblogic Server

Hi,

Problem:

In real life projects generally we use LDAP server possibly Microsoft Active Directory (AD) to authenticate and authorize Users security.

One common security policy is to lock the user account after few invalid attempts for some period of time. As a end user and system administrators you think that this is responsibility of  LDAP authentication provider which makes sense.

One should be aware of that in addition to LDAP authentication provider weblogic server also has a user lockout feature which actually locks the user at weblogic level as well when end user tries 5 invalid login attempts  for 30 minutes this is the default behavior.

Example:



  • We have default weblogic User lock settings enabled


  • User zbaig tries 5 invalid login attempts and got "Invalid username or password" message in the application



Solution 1 Unlock the user in Weblogic Server:

  • To allow zbaig to login again we need to either wait 30 minutes or unlock the user (default behavior or you can change the settings as per your requirement)
  • To unlock user from weblogic server 
  • Click on your domain name on the left pane in domain structure
  • Go to security tab then unlock user tab 
  • Enter username you want to unlock and press save

  • Try again with user zbaig you will see the welcome page of the application

Solution 2 Disable weblogic locking feature:


  • To allow Active directory to control user account lock and unlock you can disable this feature as shown in the following slide
  • Remove Locked Enabled check box and restart all managed servers including AdminServer


Final thoughts:
Personally i would go for solution 2 for ease of administration in large numbers of users this solution also helps if you have other single sign on solutions for many domains like Oracle access manager OAM.

If you are using embedded LDAP server of weblogic then solution 1 is your only choice :)

Have a nice day,
Zeeshan Baig








Tuesday, November 8, 2011

Configuring Oracle Forms11gR2 for Development Environment

Hi,

In this video we will see how to configure the latest and greatest Oracle Forms11gR2 for development environment.

To follow this video you first must install products in following order

  1. Oracle Weblogic 10.3.5
  2. Oracle Forms11gR2 (Do not configure Just install)
I will post the videos of above steps later.




Hope you like the video,
Zeeshan Baig

Thursday, November 3, 2011

Oracle ADF How to get Managed Server name in Java

Hi,

A little quicky here. If you want to know which managed server is your application currently running at you could use the similar code.

This code could be useful in cluster environment fail-over test. (I will cover in separate post)

1. Create a backing bean with request scope with following methods

    public String retrieveManagedServerName()
       {
           String instance = System.getProperty("weblogic.Name");
           return instance;
       }

       public String getManagedServer()
       {
           return retrieveManagedServerName();
       }


2. Use the method as value of af:output text



Have a nice day,
Zeeshan Baig

Friday, October 28, 2011

Free Webinar 'ADF Task Flows for Beginners'

Hi,


I am presenting a free webinar "ADF Task flows for Beginners" for ODTUG on December 1, 2011. The details are as follows. Feel free to register and spread the message


I hope that this session will answer lot of questions for up ADF newbies as well as help ADF community to grow.



December 1, 2011 3:00 PM - 4:00 PM EST
ADF Task Flows for Beginners
Zeeshan Baig, Northwestern Memorial Hospital


ADF Task flow is most important and essential feature of ADF development which makes ADF unique in the battle of frameworks. This session will help you to understand different components and techniques to build task flows as well as building static and dynamic regions on JSF pages.

During this session we will dive into the following:

1. Understanding different components to build task flows.
2. Building task flows templates.
3. Building static and dynamic regions.
4. Basic techniques to build reusable task flows.


Registration Web Link: https://www3.gotomeeting.com/register/133729022

 

Tuesday, October 25, 2011

I am Oracle ACE now !!!!

Hi all,

I would like to share the news with you all that I have become Oracle ACE Member now. John Stegeman (ADF OTN forums fame) nominated me. Check this link

I would like to thank all of you who supported me through out my career and keep motivating me by liking my blog and YouTube channel :D

Soon i will be presenting some online webinars and presenting sessions in conferences.

I am really excited and looking forward to see you all

Thank you Oracle,
Zeeshan Baig

Monday, October 24, 2011

How to find out which weblogic server version installed on the machine

Hi,

There are couple of ways you can check which version of weblogic server installed on the machine.

Note: this may vary on your machine.

1. In Middleware home $MW_HOME/registry.xml file look for entry as follows

component name="WebLogic Server" version="10.3.3.0" InstallDir="/u01/Oracle/Middleware/wlserver_10.3"

2. Check AdminServer's log file at $DOMAIN_HOME/servers/AdminServer/logs/AdminServer.log

Run the following command you will see something similar

$ grep "WebLogic Server" AdminServer.log

<WebLogic Server "AdminServer" version:
WebLogic Server Temporary Patch for 9893068 Wed Jul 21 16:53:44 EDT 2010
WebLogic Server 10.3.3.0  Fri Apr 9 00:05:28 PDT 2010 1321401  Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.>


3. Go to $WL_HOME/server/lib

Run the following command

$ java -cp weblogic.jar weblogic.version

You will see the similar info

WebLogic Server 10.3.3.0  Fri Apr 9 00:05:28 PDT 2010 1321401

Added on October 25, 2011
With latest weblogic server 10.3.5 i see the version no is displayed on weblogic console as well
http://myserver:myport/console



Have a nice day,
Zeeshan Baig

Sunday, October 23, 2011

Oracle ADF setting Task flow to use same page definition file of caller page

Hi,

In this post i will show a little technique which i learn from Steve Davelaar session 'Building Highly Reusable task flows' at Oracle open world.

If you want to pass parameter from one page to bounded task flow generally you would use a pageFlowScope variable and then use that variable as input parameter to the task flow.

In this trick or technique we will setup a task flow so it will use the same Page definition file of calling page. With this we can use the all bindings on the caller page inside our bounded task flow.

Note: This is not recommended solution for beginners (There is a chance you could mess up the ADF project). This is just another way to do things Steve said that he had open an enhancement request with ADF development team.

Lets get into the example Download the complete example 

Application Flow:

Page 1 is displaying a list of departments along a button Show Employees with each record. By Pressing Show Employees a bounded task flow will be called which takes an input parameter of current department Id and pass to employees BTF which executes the query of the current department id





Preparing Model project


There is nothing special to setup model project except the Employees View object query using a bind variable of department id to filter records.



There is NO relation between departments and employees view objects in Application Module data model because we don't need dependency between collections



Preparing Employees Task flow

Employees task flow is as shown in the slide


Employees task flow will take one single input parameter



Drag and drop ExecuteWithParams operation from data control to task flow and set the input parameter as similar to the value of input parameter

Call task flow from departments page

the unbounded task flow contains a departments page the task flow is as shown in the slide



Prepare Employee Task flow to share page definition of Department page

1. Right click the Task flow and choose Create Page definition.



2. Now you can see the page definition file has been created



3. Double click the DataBindings.cpx file click on Source. Under pageMap entries you can see the list of pages. every page id every one has unique reference to its page def file


4.  Copy the usageId of deptList page to showEmps task flow also change under Page Id and replace the path of page definition file as shown in the slide Save the file later on


5. Delete the old page definition file of showEmps we don't this file anymore. make sure when you delete it says '0 usages found' as shown in the slide



6. Now go to unbounded task flow which contains the departments page and bounded task flow
click on the showEmps task flow go to properties and use EL expression to set the value of input parameter as binding of departmentId as shown in the slide (we can only see this because now task flow is sharing the same page definition file as department page)


Note: I have attribute binding called departmentId in department Page






Now we are all set. Run the example and see

Happy Jdeveloping,
Zeeshan Baig



Saturday, October 22, 2011

My Oracle Open World 2011 Experience

Hi,

As you know that Oracle open world conference 2011 held between October 2 to 6 in San Francisco. I am late to write a follow up blog on that so now its my turn to summarize the experience of the whole event. I already posted about how i would spend my days at OOW which i changed a little during the conference as expected.

Sunday October 2, 2011
Whole Sunday was with ADF EMG I met some legendary ADF experts and had a great time.

Monday October 3, 2011
Monday started with Webcenter Content integration session by my buddies George maggessy, Stefan Krantz supported by Yannick Ongena (Author of Webcenter Admin cookbook) it was much technical than my expectation. George and stefan presented demo of webcenter portal site that they build in 4 hours. Later i joined sessions Fusion middleware deployment patterns from Simon Haslam and Oracle WebCenter Performance, Scalability, and Administration which was whole webcenter deployment guide in 1 hour pretty good.

Tuesday October 4, 2011
The main highlight for the day was ADF Mobile session and Session by Tom kyte (asktom.oracle.com)

Wednesday October 5, 2011
Highlights of the day was Steve davelaar session Building highly reusable task flows was much technical and he presented some great ways to build your task flows reusable later ADF Rockstar Chris muir presented session Angels in the Architecture which discussed different development patterns with pros and cons of them in ADF.

Thursday October 6, 2011
Thursday started with a great session from Duncun Mills about ADF tuning and from my friend Andrejus presented a demo of Texas A&M project technical details.

Other than that the main announcements at the events were

Oracle Fusion Applications
Finally wait is over and Oracle fusion applications are now available for public. It took Oracle 6 years to develop best features of Siebel, PeopleSoft, JDE Edwards, EBS and many more into a completely single integrated, standard based, cloud oriented solution. I cant wait to get hands on it.

Oracle Public Cloud
Most anticipated announcement (at least for my point. i won't be surprised if Oracle start building laptops specially for developers).

OPC is subscription based, self-service and elastic cloud give your enterprise to get access Oracle applications, database and middleware services. This will definitely help developers to get hands on big enterprise softwares like Oracle fusion applications as well.

Oracle Social Network
Probably a SalesForce.com killer. Combines best of Facebook, twitter and other social networks and bring them to enterprise level. With Oracle Social Network you can collaborate, keep tracks of corporate activities, share documents and search content.

Oracle ADF mobile
The best one for me i love the session and demos of ADF mobile. Oracle ADF mobile allows you to build iOS, Android, Blackberry RIM and other mobile platform applications with same ADF learning and YES you don't have to code for specific platform. It uses PhoneGap and HTML5 to render the app. Aino Andriessen sums up quite well ADF mobile here . One thing could affect this product IMO is 'Adobe buys PhoneGap, TypeKit for better Web tools'

Other than that there were few big announcements related to database and hardware were
Oracle Exalytic (the In-memory machine), Oracle Big Data, Oracle NoSQL Database, Oracle Enterprise Manager 12c

This blog provides a complete list of best announcement at Oracle open world 2011


Have a nice day,
Zeeshan Baig

Sunday, October 16, 2011

Using DVT Component in ADF table

Hi,

Today i will show you just a simple post about using DVT (Data visualization component) in af:table.

The primary purpose of this post is to spread a little awareness of utilization of DVTs components hopefully this will generate some ideas.

Download the sample code

More details in this quick video



Happy Jdeveloping,
Zeeshan Baig

Thursday, October 13, 2011

What is ECID in weblogic server?

Hi,

ECID stands for Execution Context ID which is a unique identifier to group of events happened accross weblogic domain environment and as per documentation

"The value of the ECID is a unique identifier that can be used to correlate individual events as being part of the same request execution flow"

So what could be the use of ECID? as per following screen shot of weblogic managed server log file if you click on the ECID id you will get the all related events that caused that error this will really useful to debug the issues happening in the environment.

How to find the ECID?

Log in to enterprise manager

Right click on your managed server or application choose Logs > View Log messages

Click on the ECID value to filter all related events



Explore on your own the logs for useful info




Next time don't forget to track ECIDs

Hope you find this useful,
Zeeshan Baig

Thursday, September 29, 2011

My Plans for Oracle Open World 2011

Hi,

This year is lucky for me so far and i am attending Oracle open world 2011. I am really excited and looking forward to meet some of the greats in Oracle technologies.

Here how i would be spending my time at OOW. that is just a plan but you never know :)

Sunday
  • Oracle ADF EMG: Starting an Enterprise Oracle ADF Project
  • Oracle ADF EMG: Learn Oracle ADF Task Flows in Only 60 Minutes
  • Oracle ADF EMG: A+-Quality Oracle ADF Code
  • Oracle ADF EMG: Transitioning from Oracle Forms to Oracle ADF
  • Oracle ADF EMG: Empower Multitasking with an Oracle ADF UI Powerhouse
  • Oracle ADF Enterprise Methodology Group: Gold Nuggets in Oracle ADF Faces
  • Oracle OpenWorld Welcome Keynote

Monday
  • Oracle OpenWorld Keynote: Oracle and EMC
  • A Deep Dive into Oracle WebCenter Content Integration
  • Unified Management of Healthcare Data with Oracle Content Management
  • Deployment Patterns for Oracle Fusion Middleware 11g
  • Oracle WebLogic Server Security
  • Oracle WebCenter Performance, Scalability, and Administration
  • Getting Started with Oracle ADF: What You Need to Know
  • Oracle ADF: What's Missing and What's Next

Tuesday
  • Oracle OpenWorld Keynote: Oracle and Dell Inc.
  • Securing Oracle Applications with Oracle Identity Management
  • Oracle Business Intelligence/Oracle ADF Integration Using the Action Framework
  • Maximize Team Productivity with Hudson, Maven, and Team Productivity Center
  • Develop Mobile Apps for iOS, Android, and More: Converging Web and Native Applications
  • Five Things You Didn't Know About SQL

Wednesday
  • Oracle OpenWorld Keynote: Oracle and Cisco
  • Building Highly Reusable Oracle ADF Task Flows
  • SQL Tuning Expert Roundtable
  • Angels in the Architecture: An Oracle Application Development Framework Architectural Blueprint
  • Oracle OpenWorld Keynote: Oracle and Infosys Limited
  • Push to the Limit: Rich and Proactive User Interfaces with Oracle ADF

Thursday
  • Real-World Performance Tuning for Oracle ADF Applications
  • Implementing Oracle Access Manager 11g: Oracle Case Study
  • Texas A&M University System Architecture: Oracle ADF, Oracle WebCenter Portal and Content
  • Fast, Complex BI Analysis with Oracle OLAP
 I am really excited to learn from the experts. If anyone like to meet me at OOW feel free to email me at zeeshan dot baig 82 @ gmail dot com

See you there,
Zeeshan Baig

Thursday, September 1, 2011

Things to remember when exporting/importing metadata into MDS in Weblogic cluster

Hi,

I wasted a few hours (and i hope you will not) to use WLST command to import metadata into WebCenter spaces PS2 application in a cluster environment.

The weblogic server topology was as follows, each of them running 2 managed servers for WebCenter.

Note: Server 1 and 2 were different physical machines

  • Server1 had WLS_Spaces1 and WLS_Spaces3
  • Server2 had WLS_Spaces2 and WLS_Spaces4

Problem:

I tried to export meta-data using following command from MDS after connecting to AdminServer, replaced the page in export directory and import back.

   1: exportMetadata('webcenter','WLS_Spaces1','/home/oracle/mds','/oracle/**/Login.jspx')
   2: importMetadata('webcenter','WLS_Spaces1','/home/oracle/mds','/oracle/**/Login.jspx') 
   3:  
   4: exportMetadata('webcenter','WLS_Spaces2','/home/oracle/mds','/oracle/**/Login.jspx')
   5: importMetadata('webcenter','WLS_Spaces2','/home/oracle/mds','/oracle/**/Login.jspx') 
   6:  
   7: exportMetadata('webcenter','WLS_Spaces3','/home/oracle/mds','/oracle/**/Login.jspx')
   8: importMetadata('webcenter','WLS_Spaces3','/home/oracle/mds','/oracle/**/Login.jspx') 
   9:  
  10: exportMetadata('webcenter','WLS_Spaces4','/home/oracle/mds','/oracle/**/Login.jspx')
  11: importMetadata('webcenter','WLS_Spaces4','/home/oracle/mds','/oracle/**/Login.jspx') 

I received a message that 1 document has imported into MDS successfully, but somehow my changes were not visible.


Lesson learned:


When you export the documents from MDS in a cluster it creates a export directories (in my case /home/oracle/mds) on the same machine where managed server is running i.e. Server1 and Server2 machines.


So, my import statement was importing the same export page which was already in the repository.


Solution:


For easy understanding i created a separate directories for all managed servers and replaced the page on both machines then imported into MDS.


Here is the complete command list.



   1: exportMetadata('webcenter','WLS_Spaces1','/home/oracle/mds1','/oracle/**/Login.jspx')
   2: importMetadata(application='webcenter',server='WLS_Spaces1',fromLocation='/home/oracle/mds1',docs='/oracle/**/Login.jspx') 
   3:  
   4: exportMetadata('webcenter','WLS_Spaces2','/home/oracle/mds2','/oracle/**/Login.jspx')
   5: importMetadata(application='webcenter',server='WLS_Spaces2',fromLocation='/home/oracle/mds2',docs='/oracle/**/Login.jspx') 
   6:  
   7: exportMetadata('webcenter','WLS_Spaces3','/home/oracle/mds3','/oracle/**/Login.jspx')
   8: importMetadata(application='webcenter',server='WLS_Spaces3',fromLocation='/home/oracle/mds3',docs='/oracle/**/Login.jspx') 
   9:  
  10: exportMetadata('webcenter','WLS_Spaces4','/home/oracle/mds4','/oracle/**/Login.jspx')
  11: importMetadata(application='webcenter',server='WLS_Spaces4',fromLocation='/home/oracle/mds4',docs='/oracle/**/Login.jspx') 

Hope you find it useful,


Zeeshan Baig

Monday, August 29, 2011

Call multiple URLs on single click of af:goLink in Oracle ADF

Hi,

Last week i experienced a challenging task to forcefully logout from UCM when user logouts from WebCenter application without using Single Sign-on solution.

Note that the application was Extended WebCenter Spaces 11g PS2 so there was no other alternate solution for current environment. i will cover the whole topic in different post sometime soon.

In this post i will cover a simple tip how to call multiple URLs on a single click of af:goLink component in Oracle ADF.

Solution:

I created a simple JavaScript function to call a URL

   1: <af:resource type="javascript">
   2:     function LogoutFromUCM(){    
   3:       hostname = window.location.hostname;
   4:       document.location.href="http://"+ hostname + "/cs/logout.htm";
   5: </af:resource> 

Later call that JavaScript method on af:goLink using af:clientListener



   1: <af:goLink text="Logout"
   2:            id="logoutLink" 
   3:            inlineStyle="white-space:nowrap"
   4:            rendered="#{security.authenticated}"
   5:            shortDesc="Click here to logout"
   6:            destination="/adfAuthentication?logout=true&amp;end_url=/webcenter/faces/custom/oracle/webcenter/webcenterapp/view/templates/LogoutPage.jspx">
   7:   <af:clientListener method="LogoutFromUCM" type="mouseUp"/>
   8: </af:goLink>
The Destination attribute of af:goLink is calling a logout for WebCenter application and method attribute in af:clientListener is calling a JavaScript function to perform logout from UCM.



Using similar technique you can open any URL in a popup as well.


Hope you like this,


Zeeshan Baig

Tuesday, August 23, 2011

List of Common HTML / HTTP Error Codes

Hi,
I found a good list of HTML / HTTP error codes. This will definitely help you to debug ADF/ WebCenter / APEX or in general Web application issues.

Source = Indiana university



Code Description Comment
100 Continue
101 Switching Protocols
200 OK Action completed successfully
201 Created Success following a POST command
202 Accepted The request has been accepted for processing, but the processing has not been completed.
203 Partial Information Response to a GET command, indicates that the returned meta information is from a private overlaid web.
204 No Content Server has received the request but there is no information to send back.
205 Reset Content
206 Partial Content The requested file was partially sent.   Usually caused by stopping or refreshing a web page.
300 Multiple Choices
301 Moved Permanently Requested a directory instead of a specific file.   The web server added the filename index.html, index.htm, home.html, or home.htm to the URL.
302 Moved Temporarily
303 See Other
304 Not Modified The cached version of the requested file is the same as the file to be sent.
305 Use Proxy
400 Bad Request The request had bad syntax or was impossible to be satisified.
401 Unauthorized User failed to provide a valid user name / password required for access to file / directory.
402 Payment Required
403 Forbidden The request does not specify the file name. Or the directory or the file does not have the permission that allows the pages to be viewed from the web.
404 Not Found The requested file was not found.
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Time-Out
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URL Too Large
415 Unsupported Media Type
500 Server Error In most cases, this error is a result of a problem with the code or program you are calling rather than with the web server itself.
501 Not Implemented The server does not support the facility required.
502 Bad Gateway
503 Out of Resources The server cannot process the request due to a system overload.  This should be a temporary condition.
504 Gateway Time-Out The service did not respond within the time frame that the gateway was willing to wait.
505 HTTP Version not supported

Have a nice day,
Zeeshan Baig

Some Tips on IIS server Configuration for Oracle Webcenter11g

Hi,

Last week i faced some challenging issues with Microsoft IIS server configuration which was the entry point for a Oracle WebCenter application.

After configuring IIS as per Oracle docs and our environment we were facing  issue with only one specific Portlet in the environment.

Issue:
When i click on the Radio button in the portlet we experienced following error message
“A connection to the server has failed”
clip_image001

When i access application by skipping IIS server i.e. directly accessing the weblogic server address then portlet works normal. (This action could work for you as debug step no 1 )

Findings:

We had some tuning parameters in IIS server’s windows registry as shown in the slide

Location: HKEY_LOCAL_MACHINE / System / CurrentControlSet / Services / HTTP / Parameters

 image

I used HTTP watch to debug the issue. When i clicked on Radio button I got HTTP error code 400 which is Bad Request. Here is the list of common http error codes

The URL was generating in the background had bigger length then it the IIS registry setting parameter UrlSegmentMaxLength which was set to 800 characters and the resulted URL was coming approx 1500.

 httpwatch

Solution:

Increasing this parameter UrlSegmentMaxLength from 800 (value 320) to 2000 (value 7d0)  fixed the issues.
 registry

Hope you like this,
Zeeshan Baig

Sunday, August 14, 2011

Writing Custom JSF validator in Oracle ADF

Hi,

In this post we will see how to write custom JSF validator in ADF as well as how to validate the user input from Model layer.

Download the sample code

Watch this video for detail



Happy Jdeveloping,
Zeeshan Baig

Thursday, August 11, 2011

Share ideas for ADF related tutorials

Hi,

Just wanted to ask you guys that if you want me to write for any specific topic then feel free to let me know using contact me page. I would be more than happy to post ADF related tutorials of your choice on this blog.

I have couple of request for calendar application in ADF so i would be posting that very soon.

Happy Jdeveloping,
Zeeshan Baig

Tuesday, August 2, 2011

How to edit web.xml file for WebCenter Spaces11g

Hi,

You might be aware of how to configure session timeout setting in ADF application which resides in web.xml file (in case you don’t then check this post). Then you might be wondering why this guy keep talking about session timeout these days? :)

Well the reason for this is if you are working with ADF application or WebCenter portal application the location of web is /META-INF folder of your application. But if you are extending webcenter spaces application (like we do) then the location of web.xml file for webcenter spaces is packed in webcenter.ear file on weblogic server.

In order to make any change to this file you have to follow these steps as described in the documentation.

Note: These steps are also eligible for webcenter portal application In case you don't want to change settings at design time.

All you need to do is

  1. Open webcenter spaces ear file.
  2. edit web.xml
  3. re-pack the .ear file and the steps are as follows

Steps (Copied from docs):

1. Navigate to your WebCenter Oracle home directory.

2. Open the WebCenter Spaces .EAR file:

$ mkdir -p /tmp/my_ear

$ cd /tmp/my_ear

$ jar -xvf $WEBCENTER_HOME/archive/applications/webcenter.ear

$ mkdir war

$ cd war

$ jar -xvf ../spaces.war

3. Edit WEB-INF/web.xml and save the changes.

4. Create a modified .EAR file with the required web.xml properties

$ cd /tmp/my_ear/war

$ jar -cvf ../spaces.war *

$ cd ..

$ rm -rf war

$ jar -cvf ../webcenter.ear *

5. Copy /tmp/webcenter.ear to $WEBCENTER_HOME/archive/applications/webcenter.ear.

6. Restart the WC_Spaces managed server.

At startup, this automatically deploys the newer application with the modified web.xml.

Hope you find this useful,

Zeeshan Baig

Sunday, July 31, 2011

How to Automatically Redirect to Different Page on session timeout in Oracle ADF

Hi,

You might be aware of my previous Session Timeout Post in Oracle ADF.

By default if timeout happens ADF don't give you any warning message unless enable it (Post by Frank Nimphuis explained)  you send some request to server (like click on page) after timeout. Our requirement was to redirect the page to default home page automatically after 15 minutes of inactivity.

Note: We had Webcenter 11g PS2 Spaces application.

The solution we implemented is to write a JavaScript code on PagePhaseListener which integrate code on every page as similar to this blog post

Download the sample code

More details in this video



Happy JDeveloping,
Zeeshan Baig

How to execute Java code before and after Task flow

Hi,

Its been a while i posted some video tutorials so finally i have recorded couple of videos which i will be posting regularly from now.

If you want to execute some logic when entering or exiting (or on exceptions) on bounded task flow (yes for only bounded task flows) you can call some manage bean method on Initializer and finalizer properties of the task flow.

Common use cases for these properties are as follows:

Initializer:

1. Validate some task flow inputs

2. default values setup

Finalizer:

1. Releasing resources

2. Perform some cleanup of data

Download the sample code 

Watch this video on how to use these properties.




Happy Jdeveloping,
Zeeshan Baig

Getting HTTP session timeout max value in Java

Hi,

If you want to know in Java the value of HTTP session timeout in ADF application. You can use the following code snippet.


        FacesContext facesCtx = FacesContext.getCurrentInstance();
        ExternalContext extCtx = facesCtx.getExternalContext();
         
        HttpSession session = (HttpSession)extCtx.getSession(false);
        int val = session.getMaxInactiveInterval();




Note that this value is coming from web.xml file you can see how to set this value by clicking here

Happy Jdeveloping,
Zeeshan Baig

Monday, July 11, 2011

Working with Domain Type in ADF Business Components

Hi,

What are domains type in ADFBC?

The answers is “Whenever you are in a situation where you want to standardized the validations and checks on special type attributes  e.g.  email field must be complete email address or number must be odd or even etc etc. In that case you can create a domain of that type and link with the entity objects or view objects attributes”.

In simple words domains will save a lot amount of time in your development and helps you to make standards.

Note: You can create domains on Oracle object types as well

How to create domain types? 

This is a 3 step process which is as follows

1. Create a domain of some type e.g String, Number, Date

2. Override the validate() method in Domain’s java class. In case of fail validation your method must throw DataCreationException in the oracle.jbo package.

3. Choose the Attribute type as your new domain in entity or view object

Steps:

1. Right Click on model and choose New Domain as shown in the slide

1

2

Choose the data type for domain

3

Under java tab of domain’s properties click on the class name appearing

4

Override the validate method as shown in the slide. Note that there is a string mData is declared automatically which is reference to the type of domain.

5

Link the Domain to your attribute in entity object in our case i use First Name note that our domain name is appearing in Type List

6

Right click application module and Choose run and enter more than 30 characters in First name and navigate outside you will see the similar error. it is the validation of domain that causing this…….

7

Feel free to add this domain to any String attributes you like.

Download the sample code

More info at http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcentities.htm#sm0326

Happy Jdeveloping,

Zeeshan Baig