Wednesday, July 27, 2011

Manipulating MDS Customizations In Java

In ADF,we have various Customization layers such as RolesCC,SiteCC,UserCC etc defined in adf-config.xml.This decides in which TIP layer the customization would go.

      <cust-config>
<match path="/">
<customization-class name="oracle.adf.share.config.SiteCC"/>
<customization-class name="oracle.adf.share.config.ADFRolesCC"/>
<customization-class name="oracle.adf.share.config.ADFUserCC"/>
</match>
</cust-config>


But there are scenarios, when we want a particular customization should be in base only, not specific to any TIP layer.

Here is how you can achieve the same.This example is to apply NO_CUSTOMIZATIONS at runtime.

Create a class that implements oracle.adf.share.mds.SessionOptionsFactory interface.
import java.util.List;

import oracle.adf.share.ADFContext;
import oracle.adf.share.mds.SessionOptionsFactory;

import oracle.mds.config.CustClassListMapping;
import oracle.mds.config.CustConfig;
import oracle.mds.config.MDSConfigurationException;
import oracle.mds.core.MDSInstance;
import oracle.mds.core.SessionOptions;
import oracle.mds.cust.CustClassList;
import oracle.mds.cust.CustomizationClass;
import oracle.mds.exception.InvalidNamespaceException;
import oracle.mds.naming.InvalidReferenceException;
import oracle.mds.naming.InvalidReferenceTypeException;
import oracle.mds.naming.Namespace;
import oracle.mds.naming.NamespaceRestriction;
import oracle.mds.naming.PackageName;
import oracle.mds.persistence.PManager;
import oracle.mds.sandbox.IncompatibleSandboxException;
import oracle.mds.sandbox.SandboxHelper;
import oracle.mds.sandbox.SandboxNotFoundException;
import oracle.mds.sandbox.SandboxNotSupportedException;
import oracle.mds.sandbox.SandboxUsage;
import oracle.mds.versioning.LabelNotFoundException;
import oracle.mds.versioning.MultipleLabelsException;
import oracle.mds.versioning.VersionContext;
import oracle.mds.versioning.VersioningNotSupportedException;

/**
* A factory that subtitute the <code>CustConfig</code> object with
* <code>CustConfig.NO_CUSTOMIZATIONS</code> in the default
* <code>SessionOptions</code> object.
*/
public class MyADFSessionOptionsFactory implements SessionOptionsFactory
{

/**
* Gets the instance of the factory for creating base documents.
*
* @return the instance of the factory for creating base documents
*/
public static ModelerSessionOptionsFactory getBaseInstance()
{
return _INSTANCE;
}

private static final ModelerSessionOptionsFactory _INSTANCE =
new ModelerSessionOptionsFactory(CustConfig.NO_CUSTOMIZATIONS, null);
}


Use this class in your AMImpl or somewhere the session starts

    ConfigUtils.setSessionOptionsFactory(_currentContext,
ModelerSessionOptionsFactory.getBaseInstance());

8 comments:

Anonymous said...

These fitness tips in above some basic ideas for keeping fit and healthy body.
My grandma can really feel vindicated at such a claim,she's been saying this all my life. The problem is that many do not follow through with their fitness plans and thus fail within the first 3 months of starting a new fitness plan or routine.

My blog post Http://Startersmkb.nl/
my webpage: http://Sisec.Wiki.Irisa.fr/

Anonymous said...

Hello to all, for the reason that I am truly keen of
reading this blogĂ­s post to be updated daily. It includes
pleasant stuff.

Feel free to visit my blog: please click the next web page

Anonymous said...

If you are exercising every day, the fat you burn
will be harnessed into muscle. Protein has a number of benefits, including increasing your metabolism.

Take note also that you know how to perform the exercise well to avoid sickness and injuries in the
future.

Here is my webpage: fitness tips and quotes

Anonymous said...

Hi there, how are things? I just now shared this page with
a colleague, there was a healthy laugh.

Feel free to visit my homepage: http://greatexploits.com/TillyElls

Anonymous said...

A lot of us who are under constant pressure tend to eat too much and do not take good care of their bodies.
We know because they have done so for millions of other people.
Nothing is more motivating than seeing physical proof of results.


Also visit my blog post fun fitness tips and facts

Anonymous said...

It is considered to the start of the Arab Spring and
would go a long way in forcing the politicians to effectively govern the country.
He tells the tale of a young boy, a tot, who was riding a toy car near the railroad crossing.
Above all the Hindi news websites is a real boom for the world.


Also visit my weblog ... just click the next article

Anonymous said...

you are truly a excellent webmaster. The site loading speed is amazing.
It sort of feels that you are doing any distinctive trick.
In addition, The contents are masterpiece. you've done a excellent process in this subject!

My homepage :: wastedbook.com

Anonymous said...

So, before you play, make sure you stretch the muscles used in swinging your
golf club. Don't jump cold, warm up first until you break a light sweat. Most of us love it; going to Mac - Donald or Burger King from time to time.

Here is my page :: fitness tips and quotes