Tuesday, June 17, 2014

Change the webcenter portal default preferences based on a condition?

By default when the Oracle webcenter portal application is created, it comes up with the default navigation modal, default navigation registry, default skin etc...


If we would like to change then for example based on the security context of the user logged in, we can do so. All the default preferences are stored in adf-config.xml as below

<portal:preferences>
  <portal:preference id="oracle.webcenter.portalapp.navigation.model"
                     desc="Default Navigation Model"
                     value="/oracle/webcenter/portalapp/navigations/default-navigation-model.xml"
                     resourceType="navigation" display="true"/>
  <portal:preference id="oracle.webcenter.portalapp.resourcecatalog"
                     desc="Default Resource Catalog"
                     value="/oracle/webcenter/portalapp/catalogs/default-catalog.xml"
                     resourceType="ResourceCatalog" display="true"/>
  <portal:preference id="oracle.webcenter.portalapp.pagetemplate.pageTemplate"
                     desc="SPR Page Template"
                     value="/oracle/webcenter/portalapp/pagetemplates/MyAppTemplate.jspx"
                     resourceType="Template" display="true"/>
  <portal:preference id="oracle.webcenter.portalapp.navigation.renderer"
                     desc="Default Navigation Renderer"
                     value="/oracle/webcenter/portalapp/pages/navigation-renderer.jspx"
                     display="false"/>
  <portal:preference id="oracle.webcenter.portalapp.skin"
                     desc="Default Portal Skin" value="portal"
                     resourceType="Skin" display="true"/>
  <portal:preference id="oracle.webcenter.portalapp.sitemap"
                     desc="Default Sitemap EL"
                     value="#{navigationContext.defaultNavigationModel.defaultSiteMap}"
                     resourceType="Sitemap" display="true"/>
  <portal:preference id="oracle.webcenter.portalapp.baseresourceurl"
                     desc="Default Base Resource URL EL"
                     value="#{request.scheme}://#{request.serverName}:#{request.serverPort}#{request.contextPath}"
                     resourceType="BaseResourceURL" display="true"/>
</portal:preferences>


We can change/configure them based on an EL expression as shown below

<portal:preference id="oracle.webcenter.portalapp.navigation.model"
    desc="Default Navigation Model" resourceType="navigation" display="true"
    value="#{securityContext.authenticated ? /oracle/webcenter/portalapp/navigations/default-navigation-model.xml : /oracle/webcenter/portalapp/navigations/custom-navigation-model.xml"/>
   


No comments:

Post a Comment