Saturday, April 12, 2014

PreferenceBean in Webcenter - Store Custom Constants

Tip - There are multiple ways to store constants outside the context of application such as properties file, Database ,LDAP or MDS etc. There is one more simple way in webcenter where we could have it stored which is  preferences in adf-config.xml.

      <portal:preference id="oracle.webcenter.portalapp.navigation.model"
                         desc="Default Navigation Model"
                         resourceType="navigation" display="true"/>
      <portal:preference id="oracle.webcenter.portalapp.resourcecatalog"
                         desc="Default Resource Catalog"
                         resourceType="ResourceCatalog" display="true"/>
      <portal:preference id="oracle.webcenter.portalapp.pagetemplate.pageTemplate"
                         desc="Default Page Template"


These preferences are used by in webcenter to store the default navigations,resource catalog etc which can be accessed anywhere in the portal using preference bean 

Eg : Default Skin - #{preferenceBean.defaultPortalSkin}
         Default Template -  #{preferenceBean.defaultPageTemplate}

These preferences can also be used to store custom constants that can be used anywhere in the application and again as we store this in adf-config.xml which is editable through MDS, all these constants can be changed at runtime as needed:-)

Eg : Sample preferences in Adf-Config.xml

ELs to access this preference -

Hope this helps :-)