Monday, January 18, 2010

ADF 11g: Define default UI for MDS user customization

JDeveloper Version:


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


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 =

  public DefaultUserCC() {

   * 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 =
    if (valueUsername == null) {
      return value;

    return new String[] { valueUsername };


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


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.


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

Further reading

Customizing Applications with MDS

No comments:

Post a Comment