Wednesday, December 17, 2014

Customize the DB Constraint related messages in ADF

Sometimes we would like to customize the error messages displayed to the end user in Oracle ADF. We can do this by creating the custom DCErrorHandlerImpl Class and configuring it as the ErrorHnadler class in DataBindings.cpx

More details in the below blog
 
http://jneelmani.blogspot.com/2013/10/adf-11g-how-to-customize-default-adf-bc.html

Monday, November 24, 2014

Oracle ADF fix for the error The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.


Problem

The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.

Why it is occurring?

The error occurs because the underlying jsff has more than one root component in the <jsp:root> tag. 

Solution

We can fix this by wrapping the multiple root components into a single one by wrapping the multiple roots into one component such as <af:group>, <af:panelGroupLayout>, etc.

Tuesday, October 28, 2014

Best technique to bind the UI Components to the managed bean in JSF/ADF

Problem

Runtime exceptions saying can't serialize rich ui component class.

Why is it occurring?

Binding a JSF UI Component to a managed bean which is in a scope greater than requestScope or backingBeanScope. We should not do that because the UI components are not serializable and the application might not work properly in the clustered environment. We should bind the JSF components to the managed beans which are either in requestScope or backingBeanScope.

What is so special about requestScope and backingBeanScope?

For backingBeanScope or requestScope bean the class references need not be serialized. So inorder to avoid any serialization errors it is recommended to keep the UI component references in a backing bean scoped or request scope bean so as to avoid any serialization done on these class references.

But requestScope or backingBeanScope is not sufficient for my scenario, what to do?

  1. Configure the manged bean (MB1) to the taskflow in the backingBeanScope
  2. Configure another managed bean (MB2) in the required scope, pageFlowScope or viewScope
  3. Refer the UI Components of MB1 in MB2.
Example

BackingBean.java  (BackingBean scope/ Request scope)

import oracle.adf.view.rich.component.rich.layout.RichInputText;
public RichInputText getRichInputText(){
 // implement the getter method as needed
}

// Access these getters on your pageFlowScope Bean
PageFlowScopeBean.java implements Serialization (PageFlowScope)

import javax.faces.context.FacesContext;
public void uiCompRefFromBackingBean(){
    // get the backingbean instance   
    FacesContext facesContext = FacesContext.getCurrentInstance();
    BackingBean backingBean = (BackingBean)facesContext.getExternalContext().getRequestMap().get("BackingBean");
   
    // get the component instance
    RichInputText tree = backingBean.getRichInputText();
 }




Thursday, October 16, 2014

How to provide security to the imported taskflows in adf?

 Open the Jazn-data.xml and click the checkbox "Show task flows imported from ADF libraries".

In which case, we see all the imported taskflows in the resources section.
 


Sunday, October 5, 2014

Showing the error messages for both system validation and custom validaton at a time in Oracle ADF

Sometimes we have the requirement to show the custom error messages coupled with the framework related error messages simultaneously on the screen.

Using the FacesMessage will show the error message for just one component and if we don't put the immediate="true" for the button, then just the system validations/framework validations are shown on the screen. But we want to display both the system messages and custom error messages by setting the immediate="true" for the button.

The following code snippet will solve the problem

Command Button Code
 
    <af:commandButton text="Submit" id="cb1" immediate="true"
                      actionListener="#{pageFlowScope.ErrorBean.onClickSubmit}">
      <af:clientAttribute name="superImmediate" value="#{true}"/>
      <af:clientListener method="catchActionEvent" type="action"/>
      <af:serverListener type="customButtonAction"
                         method="#{pageFlowScope.ErrorBean.customButtonActionListener}"/>
    </af:commandButton>

Javascript code to be embedded in the Jsff

<af:resource type="javascript">  
   AdfActionEvent.prototype.isValidationNeeded = function () {
       return !this.getSource().getProperty("superImmediate");
   }

   // Action event will cause server-side validation at the 
   // Apply Request Values phase (for immediate button). 
   // So we'll get validation error even if the client-side validation is suppressed 
   // We need to catch the original Action event, cancel it and replace with our 
   // custom event customButtonAction. 
   function catchActionEvent(evt) {
       AdfCustomEvent.queue(evt.getSource(), 'customButtonAction', null, true);
       evt.cancel();
   }
</af:resource>

Backing bean Code

public void onClickSubmit(ActionEvent actionEvent) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while Saving","Error while saving");
    facesContext.addMessage(null,msg);
}

public void customButtonActionListener(ClientEvent clientEvent) { 
      UIXCommand cb = (UIXCommand) clientEvent.getComponent(); 
      cb.broadcast(new ActionEvent(cb)); 
  } 

Friday, October 3, 2014

Jdeveloper integrated weblogic server Unrecognized option: -jrockit issue

When you try and run your web application and the embedded WebLogic tries to start you might run into an error like:

Unrecognized option: -jrockit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit. 

This is most likely due to the fact that JDeveloper is trying to use the wrong JVM to run your WebLogic.

Solution

Edit the file: /users/vinay/.jdeveloper/system11.1.1.7.40.64.93/DefaultDomain/bin/setDomainEnv.sh

Add the following lines

JAVA_VENDOR="Sun"
export JAVA_VENDOR 

By doing this you'll instruct WebLogic to start with a regular JVM and not the JRockit variant which isn't on your mac.

More details here

Wednesday, October 1, 2014

Programmatically populate the af:selectOneChoice component in Oracle ADF?

Step1

Create a Java List of SelectItems and create getter setter for that as below

    List<SelectItem> customList;

    public void setCustomList(List<SelectItem> customList) {
        this.customList = customList;
    }

    public List<SelectItem> getCustomList() {
        return customList;
    }
 

Step2

 

Modify the getter method with the logic to return the list of items

 

    public List<SelectItem> getCustomList() {
        if (customList == null) {
            customList = new ArrayList<SelectItem>();
            customList.add(new SelectItem("Value 1","Label 1"));
            customList.add(new SelectItem("Value 2","Label 2"));
            customList.add(new SelectItem("Value 3","Label 3"));
            customList.add(new SelectItem("Value 3","Label 4"));
            customList.add(new SelectItem("Value 5","Label 5"));
        }
        return customList;
    }
 

Step3 

 

Configure the jsff/jspx as below to refer the select items from the bean getter method created above


 <af:selectOneChoice label="Custom List" id="soc1">
     <f:selectItems value="#{CustomerBean.customList}" id="si1"/>
</af:selectOneChoice>

Wednesday, September 24, 2014

Disable the af:column reordering in Oracle ADF af:table

Setting the following property in af:table will not allow the end user to reorder the columns of the af:table

 disableColumnReordering="true"

Tuesday, September 23, 2014

Check Equals Ignore case in EL expression in JSF/ADF


Step1: Add the below highlighted library

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xmlns:c="http://java.sun.com/jsp/jstl/core">
        

Step2: Check the condition as below
         
<af:image shortDesc="Status Open"
        id="i7"
        rendered="#{fn:toLowerCase(sessionScope.status) == fn:toLowerCase('open')}
        source="/images/status-open.png"/>

Monday, September 22, 2014

Get the hostname and context root in managed bean in ADF

    public FacesContext getFacesContext() { 
      return FacesContext.getCurrentInstance(); 
    } 
   
    public ExternalContext getExternalContext() { 
      return getFacesContext().getExternalContext(); 
    }
   
    public void getRequestAPartURL() {
        HttpServletRequest request =
            (HttpServletRequest)getExternalContext().getRequest();

        // Get the current URL
        String requestUrl = request.getRequestURL().toString();

        // Get the context root
        String contextRoot = getExternalContext().getRequestContextPath();
       
       // Get host and port number
       requestUrl = requestUrl.substring(0, requestUrl.indexOf(contextRoot))
    }

JBO-25058: Definition RowNum of type Attribute not found in VO Exception - ADF Solution


 Sometimes we run into the following error. This error occurs because of the corrupted Iterator in the page definition file. Re-creating the iterator will solve the issue

Complete Error message

oracle.jbo.NoDefException: JBO-25058: Definition RowNum of type Attribute is not found in VO.
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:598)
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:568)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding.__setSortCriteria(FacesCtrlRangeBinding.java:249)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setSortCriteria(FacesCtrlHierBinding.java:406)
    at org.apache.myfaces.trinidad.component.UIXTable.postCreateCollectionModel(UIXTable.java:473)
    at org.apache.myfaces.trinidad.component.UIXCollection.__flushCachedModel(UIXCollection.java:1443)
    at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1060)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1539)
    at org.apache.myfaces.trinidad.component.UIXDecorateCollection.invokeOnComponent(UIXDecorateCollection.java:121)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1539)
    at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:622)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at oracle.adf.view.rich.component.rich.RichDocument.invokeOnComponent(RichDocument.java:168)
    at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._fixClientIds(LifecycleImpl.java:1199)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:534)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

Friday, September 19, 2014

Change the weblogic server admin password from command line of console is not starting?

1.    Go to this path: SYS_DIR\DefaultDomain\bin,  where SYS_DIR is the path we defined above.
2.    Execute the setDomainEnvironment.cmd
3.    Go to this path: SYS_DIR\DefaultDomain\security
4.    Rename the DefaultAuthenticatorInit.ldift file to something like oldDefaultAuthenticatorInit.ldift
5.    Execute the following command in order to create the new password.
  •       Notice that the command has a dot at the end, this is necessary so the new password is created in the current directory.
  •       Change NEW_PASSSWORD for the new password of the weblogic user:
  •        We should have the weblogic.jar in the classpath

                 java weblogic.security.utils.AdminAccount weblogic NEW_PASSWORD .

6.    Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer\data\ldap
7.    Rename the ldap directory to something like ldap_old
8.    Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer\security
9.    Rename the boot.properties file to something like oldboot.properties
10.    Create a new boot.properties file in the same directory. This is necessary if you want autologin when launching the Weblogic server from within JDeveloper. The content of the file should be something like the following (change NEW_PASSWORD for the password you defined in previous steps):

username=weblogic
password=NEW_PASSWORD

11.    Start the integrated weblogic server from  jdeveloper
12.    Open a new browser and enter the following URL (the port may be different for you):
http://localhost:7101/console
13.    The Weblogic server console application should display and you can login with your new credentials.

Monday, September 15, 2014

How to turn off the default features of af:panelCollection in Oracle ADF?

By default whenever we surround af:table component with af:panelCollection we get a lot of features to reorder the columns, show only particular columns, free particular columns etc..

If we would like to disable them we have to use the featureOff property of the panelCollection. That featureOff property manages the visibility of certain controls / features of panelCollection to the end user.

 Comprehensive list of the features that can be turned off are

Value Turns off
statusBar Status bar
viewMenu 'View' menu
formatMenu 'Format' menu
columnsMenuItem 'Columns' sub-menu item
columnsMenuItem:col1,col20 Columns with column ID: 'col1' and 'col20' inside 'Columns' sub-menu
freezeMenuItem 'Freeze' menu item
detachMenuItem 'Detach' menu item
sortMenuItem 'Sort' menu item
reorderColumnsMenuItem 'Reorder Columns' menu item
resizeColumnsMenuItem 'Resize Columns' menu item
wrapMenuItem 'Wrap' menu item
showAsTopMenuItem Tree/TreeTable 'Show As Top' menu item
scrollToFirstMenuItem Tree/TreeTable 'Scroll To First' menu item
scrollToLastMenuItem Tree/TreeTable 'Scroll To Last' menu item
freezeToolbarItem 'Freeze' toolbar item
detachToolbarItem 'Detach' toolbar item
wrapToolbarItem 'Wrap' toolbar item
showAsTopToolbarItem Tree/TreeTable 'Show As Top' toolbar item
wrap 'Wrap' menu and toolbar items
freeze 'Freeze' menu and toolbar items
detach 'Detach' menu and toolbar items

In this article, we will find out what happens at runtime when different values are specified for this attribute (Note : This attribute takes a space-separated list of default features to be turned off for the panelCollection - as mentioned above)

More details can be found here

Thursday, September 4, 2014

Everything about Oracle ADF Shared Application Module

I have found a good documentation about the shared application module and their effective use, refer to the below link for the same

http://docs.oracle.com/middleware/1212/adf/ADFFD/bclookups.htm

Display watermark on af:inputText in ADF 11g using javscript


Sometimes we would like to display the watermark on the af:inputText component in oracle ADF and remove the text on mouse click or focus on that input text. We can achieve this using the Java script code as below. The snapshot of look and feel is also added.

Look and Feel Snapshot




  Step1: Add the following code to the application javascript file

<af:resource type="javascript">
    function adf$noValueText$intialize(event) {
        var component = event.getSource();
        component.visitChildren(adf$noValueText$replaceEmptyWithText, null, false);
    }
   
    function adf$noValueText$onFocus(event) {
        adf$noValueText$replaceTextWithEmpty(event.getSource());
    }
   
    function adf$noValueText$onBlur(event) {
        adf$noValueText$replaceEmptyWithText(event.getSource());
    }
   
    function adf$noValueText$replaceTextWithEmpty(component) {
        var noValueText = component.getProperty("noValueText");
        if (typeof noValueText != 'undefined') {
            var domNode = document.getElementById(component.getClientId() + "::content");
            if (domNode.value == component.getProperty("noValueText")) {
                domNode.value = "";
            }
        }
    }
   
    function adf$noValueText$replaceEmptyWithText(component) {
        var noValueText = component.getProperty("noValueText");
        if (typeof noValueText != 'undefined') {
            var domNode = document.getElementById(component.getClientId() + "::content");
            if (domNode.value == "") {
                domNode.value = component.getProperty("noValueText");
            }
        }
    }
</af:resource>


Step2: Add the following code to your jsff

<af:clientListener method="adf$noValueText$intialize" type="load">

<af:inputText label="" value="WaterMark" id="it" />
       <af:clientAttribute name="noValueText" value="WaterMark Text"/>
       <af:clientListener method="adf$noValueText$onFocus" type="focus"/>
       <af:clientListener method="adf$noValueText$onBlur" type="blur"/>
</af:inputText>

Tuesday, September 2, 2014

Oracle ADF RichInputText setValue/getValue issue and the solution

Sometimes we observe that the value entered in the Oracle ADF af:inputText component doesn't get refreshed and the previous value is stored as it is. We can get rid of this using the following code

import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.context.AdfFacesContext;

RichInputText rit = (RichInputText)JSFUtils.findComponentInRoot(id);
rit.setSubmittedValue(null);
rit.resetValue();
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(rit);

Wednesday, August 27, 2014

Retrieve the blob images from database and display them on screen in Oracle ADF?

When we store the images in database using blog type, we would like to retrieve them and display them on the screen. This can be done by creating a servlet and configuring it in the web.xml using the following steps

Step1 Create jsff with the af:image component and configure the source as below. The parameters that we send to the servlet should be enough to send as bind parameters to the image table and retrieve the image


Step2 Create the servlet to retrieve the image from the database as below

























Step3 Configure the web.xml as shown below



Notes

1. Parameters passed to the servlet via af:image source tag should change then only the image on the screen will be refreshed, so better to pass the version number

2. If this application is deployed as library and used as dependency in another application, configure the servlet in the application from where this library is being referenced

Replicate the Wndows/Unix folder structure using af:tree component in ADF

Sometimes we would like to display the windows or unix folder structure directly to the user. We can achieve this using the af:tree component in ADF. We have to programmatically construct the af:tree component to achieve the same

Step 1: Create a POJO class with the members you wish to display on the screen

















    Step2   Construct the tree model as below


 Step3   Refer the folderTree Tree model in the jsff as below






Wednesday, June 18, 2014

What is save point restore and how to configure it and use it in Oracle ADF?

Save point restore is a mechanism to save a particular state of the current ADF application transaction state and return to it after a certain amount of time (not more than 24hrs)

We can use the save point restore facility in the ADF taskflows to return to that particular state. If we use this, the application will store the following information temporarily to the database and retrieves it when we require.

The information stored at the save point is
  1. Current ADF model transaction state of the application
  2. Memory states of the ADF Controller specific scopes - Page flow scope and View scope
  3. ADF controller navigation state, all the taskflow calls to come to this state
  4. UI state of the current page like the tabs opened, rows of the table selected, choices selected in the Boolean checkbox 
By default, the saved information is active in the database for 24 hours and is deactivated after that.

Steps to configure and use the save point restore

Step1: Indicate the database connection that will be used to save the state in the adf-config.xml file which can be found in application resources -> Descriptors -> ADF META-INF -> adf-config.xml

Select the data source of the database where the framework can store the application state as below

 


Clicking the check box enable implicit savepoints will save the application state automatically when the taskflow is marked as critical

Step2:

Decide the step in the taskflow where you want to save the state and invoke the controller method just before that to save the state as below.



The properties of the method to be executed are as below


The managed bean property configured in the return value of the method is a string and looks as below









Step3

Drag and drop the save point restore activity on to the current taskflow as shown in the tasflow. The properties of the activity are as below










Step4

Configure the command button/command link on clicking which the last change will be undone. Point the action property of the button to invoke the save point Restore activity

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"/>
   


Preserve runtime customizations of webcenter portal application?

Scenario:

Let is say we have developed a webcenter application using JDeveloper and made some runtime customizations from the webcenter portal administration console. Running the application again from the Jdeveloper removes all the customizations made.


Background

All the runtime customizations made are stored in a component called MDS but not in the physical folder location of JDeveloper application. And by default on running the portal application, all the runtime customizations are deleted.

Solution

To avoid this we have to override this default behavior from the portal application properties settings by clicking the preserve customizations across application runs as shown below.



Monday, June 16, 2014

How to customize the administration console URL in wecenter portal

By default, we can access the webcenter portal administration console from the following URL
http://www.app-server:port/applicaiton-context_root/admin.

We can customize it by making the following changes to the web.xml

  <servlet>
    <servlet-name>PortalAdminServlet</servlet-name>
    <servlet-class>oracle.webcenter.portalwebapp.servlet.PortalAdminServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>PortalAdminServlet</servlet-name>
    <url-pattern>/desired-url</url-pattern>
  </servlet-mapping>

Thursday, June 12, 2014

Introudction to JDeveloper 12c and effective ways to use it?

Apply a template at runtime in Oracle webcenter portal

We might need to change the application template at runtime from the Oracle Webcenter portal administration console. This can be done as shown below

Step1: 
  1. Make sure that template is available and not hidden
  2. If not available, select a particular template and click the edit button and select "Show"  















Step2:

Choose and apply the template from the configuration tab as shown below