Monday, January 18, 2010

ADF 11g: Define default UI for MDS user customization

JDeveloper Version: 11.1.1.2.0

Introduction

In this post I want to show how you can enhance the built-in feature “user customization accross sessions using MDS”. If you just activate this feature an define the default UserCC-class to be used, you typically will face the problem that for the first time the end users access your web application they will see the UI, layout, etc. as designed by the developer. Very often default values will be used so at the end someone might end up with fine tuning advises  like “Please expand this column by 5px and put column x in front of the others….” and so on. And in the end you will still be not sure if your layout meet the exact idea of the manager.

What managers actually want is, to define e.g. the width of columns, etc on their own and let that setting be the default for all the other end users. With ADF11g that requirement can be achieved with only a few lines of code + configuration.

How to do

Create a custom Customization Class like the following

package de.team.faces.mds;

import javax.faces.context.FacesContext;

import oracle.adf.share.config.UserCC;

import oracle.mds.core.MetadataObject;
import oracle.mds.core.RestrictedSession;

public class DefaultUserCC extends UserCC {

  private static final String DEFAULT_CC_VALUE_USERNAME =
    "de.team.faces.mds.DEFAULT_CC_VALUE_USERNAME";

  public DefaultUserCC() {
    super();
  }

  /**
   * Overrides the UserCC
   * @param sess
   * @param mo
   * @return
   */
  public String[] getValue(RestrictedSession sess, MetadataObject mo) {

    String[] value = super.getValue(sess, mo);
    if (value == null) {
      return null;
    }

    FacesContext context = FacesContext.getCurrentInstance();
    String valueUsername =
      context.getExternalContext().getInitParameter(DEFAULT_CC_VALUE_USERNAME);
    if (valueUsername == null) {
      return value;
    }

    return new String[] { valueUsername };

  }
}

and register it in your adf-config.xml file at the following position

image

It is important, to register the DefaultUserCC-class before UserCC class since that’s the precendence which will be evaluated by the MDS runtime.

Now edit the web.xml and add the following parameter to define the user whose mds runtime customization will be used as default customization for users that have not customized their UI yet.

image 

With that configuration sking will be able to define the default UI  for all the other users.

Further reading

Customizing Applications with MDS

Monday, January 11, 2010

JDeveloper 11g: Know the IDEs coding features to get more productive

JDeveloper Version: 11.1.1.2.0

Introduction

There are a couple of useful IDE features that may not be so obvious because those are not always accessible by the menu but only through shortcuts. So in this post I just want to show some of the cool features that makes one more productive while developing.

Tag-Documentation (Press Ctrl-D on a Tag)

0000@1800_0-412664a6bc091a2b

Javadoc-Documentation (Press Ctrl-D on a class or method in java source code)

0002@1800_1800-412664a6c00c22e4

Javadoc-Documentation (Press Alt and Mouse Over on a class or method in java source code)

0004@1800_1800-412664a6c1a740da

Quick Source View (Shift+ Mouse Over Sourcefiles in Application navigator)

0005@1800_1800-412664adda468acf

Quick View in Sourcecode Mode (Ctrl+Mouse Over on right indicator bar) 0001@1800_1800-412664a6be23a67f

This also works for Java Sourcecode of course:

0003@1800_1800-412664a6c127d27d

Block Coloring (new in JDev 11.1.1.2)

0006@1800_1800-412664adde8641fe

Quick Preview in Taskflow (Shift+Mouse Over view-activity)

0009@1800_1800-412664ade127d27d

Quick file switch (Strg+TAB)

0007@1800_1800-412664addf4cfd58

Go to Java Type (Ctrl+-)

0008@1800_1800-412664ade0308b91

Alternatively use the search box in the top right corner of the IDE

0012@1800_1800-412664adea894ab7

to quickly find the file you are looking for. In most cases you will be faster than searching manually in the application navigator.

Quick Outline/Method navigation (Ctrl+Shift+O)

0010@1800_1800-412664ade3f258bf

Customize and explore

And of course you can customize your IDE shortcuts under Preferences>Shortcut keys

0011@1800_1800-412664ade4901e57

And of course it is good place to explorer new CodeEditor features.

Observation

There are still some features I am missing. used from e.g. Eclipse. This is

  • Ctrl+D: Delete current line
  • Alt+Arrow Up/Down: Move current line/block up down. This is really cool once you get used to it!

Friday, January 8, 2010

JDeveloper 11: Incomplete ViewObject information after IDE restart

Status: open
JDeveloper Version: 11.1.1.2.0

Issue

Last time I often face the following issue:

  1. Have a ViewObject-Definition file in Overview mode openedimage
  2. Close JDeveloper.
  3. Restart JDeveloper
    image
  4. Not every time but somtimes the ViewObject-Definition file seems to be incomplete!
    image
  5. Sometimes information shows up, but the two Overview tabs are confusing…
    image
  6. Any explanations for that behaviour?

Solution

First keep cool;-), your ViewObject-Definition content is still there! It just does not show up correctly in Overview Mode. Close the file and reopen it.

Update

Seeems like the two overview tabs show up everytime.

Saturday, January 2, 2010

Oracle TPC: Possible upgrade issue from 11.1.1.1 to 11.1.1.2

Status: resolved
Oracle Team Productivity Center: 11.1.1.2.0
Oracle WebLogic Server: 10.3.2
Environment: TELDE

First of all I wish all my readers out there a HAPPY AND SUCCESSFUL NEW YEAR 2010!

In a previous post I have blogged about setting up (a clean) Oracle Team Productivity Center Server. In this post I want to share my experience if you upgrade an existing OTPC database repository to 11.1.1.2 but want to install the otpc.war on a clean WLS 10.3.2 domain.

Issue

Tool/Area
Action
Client Start Xming
Putty Login as oracle
{setup your environment}
[oracle@telde ~]$ cd /u01/product/oracle/middleware/11.1.1/tpc/ [oracle@telde tpc]$ java -jar tpcinstaller.jar
Installer 1.Provide the database connection properties to the existing OTPC repository
2.Choose the autodeploy directory of a clean WLS 10.3.2 domain
3.Start installation
  You will encounter the following error
image

So how to solve the installation error if you want to install on a clean WLS 10.3.2 domain?

Solution

Tool/Area
Action
 
Putty Login as oracle
{setup your environment}

OK so now we need to manually install the otpc.war into weblogic domain.

1) We first verify that it is included in the tpcinstaller:

[oracle@telde tmp]$ jar -vft tpcinstaller.jar | grep otpc
16485122 Fri Oct 30 01:33:40 CET 2009 lib/otpc.war

2) Now we extract it and copy otpc.war to the domain home/autodeploy

[oracle@telde tmp]$ jar -xf tpcinstaller.jar lib/otpc.war
[oracle@telde tmp]$ cp -p lib/otpc.war $DOMAIN_HOME/autodeploy

3)Run the tpcinstaller once again!!!!

4)Start the WebLogic server

[oracle@telde tmp]$cd $DH
[oracle@telde fusion_domain]./startWebLogic.sh

 
   

Background information

During installation of OTPC the otcp.war is modified so that it contains the correct database connection information.

[oracle@telde autodeploy]$ cd /u01/app/oracle/product/11.1.1.2/middleware/user_projects/domains/base_domain/autodeploy/
[oracle@telde autodeploy]$ ls -l
total 24252
-rw-r--r-- 1 oracle oinstall  8309132 Nov  5 07:43 otpc.war
-rw-r--r-- 1 oracle oinstall 16485122 Oct 30 01:33 otpc.war-1257402576730
-rw-r----- 1 oracle oinstall     2131 Nov  4 02:07 readme.txt

Those connection properties are stored in persistence.xml which itself is contained in _wl_cls_gen.jar file.

image

So if you encounter connection problems persistence.xml in the exploded app directory is the file you should first look to verify the connection properties.