Pages

Wednesday, September 7, 2016

Issue with LOV performance in ADF 12.1.3

I have an LOV defined on an attribute of a view object. The view accessor that fetches data for this LOV is not filtered and queries data from a large table. With LOV created in ADF 12.1.3, I was seeing performance issue while selecting any value in the LOV. 

Also I was seeing the below logs in the Jdeveloper console.

[142211] Evaluating Script with name:null, Type : Groovy. Expression:
[142212]  ( (FormatDesc = :vc_temp_1 ) )
[142213] Evaluation result:false

After debugging for some time, I have found a resolution for this. I need to modify the ListRangeSize parameter to a positive value eg: 10 whose value is by default set to -1 in ADF 12.1.3.

 <ListBinding
    Name="LOV_DrugName"
    ListVOName="DrugDescSearchVA"
    ListRangeSize="10"
    ComboRowCountHint="10"
    NullValueFlag="none"
    MRUCount="0">
    <AttrArray Name="AttrNames">
      <Item Value="DrugName"/>
    </AttrArray>
    <AttrArray Name="AttrExpressions"/>
    <AttrArray Name="DerivedAttrNames">
      <Item Value="ChemicalName"/>
      <Item Value="DrugSerial"/>
    </AttrArray>
    <AttrArray Name="ListAttrNames">
      <Item Value="Drug"/>
      <Item Value="Chem"/>
      <Item Value="DrugSerial"/>
    </AttrArray>
    <AttrArray Name="ListDisplayAttrNames">
      <Item Value="Drug"/>
    </AttrArray>
    <DisplayCriteria
      Name="findByDrugDesc"/>
  </ListBinding> 

How to execute code after a popup is launched

In one of my project, I had a requirement to execute some code after a popup is launched. After struggling for some time, I found a way to implement it. In this post, I will describe you one of the popup client events which can be used to execute a code after a popup is made visible.

Out of many client events that a popup supports, there is an event called popupOpened which is fired once a  popup becomes visible. You can use this event for handling custom code that should be executed once the popup is launched.

Use the below code to implement such behavior.

<af:popup id="p1">
    <af:dialog type="none" closeIconVisible="true"
               resize="off" id="d3">
        <af:panelGroupLayout id="pgl12" layout="vertical">
            ......
            ......
        </af:panelGroupLayout>
    </af:dialog>
    <af:clientListener method="<custom method>" type="popupOpened"/>
</af:popup>

Here <custom method> is the custom method name that needs to be executed.

Wednesday, July 27, 2016

Add/Remove af:messages on a component using javascript

In one of my project, I had a requirement to add & remove af:messages from input components. In this post, I will show the javascript code used to achieve it.
 

For adding af:message to an input component using java script, use the following code.

function customJSMethod(evt){
       var source = evt.getSource();
       var inputComponent = source.findComponent('inputcompId’);
       var message = “Valiation Failing…”;...//Custom message to be added on component.
       AdfPage.PAGE.addMessage(inputComponent.getClientId(), new AdfFacesMessage(AdfFacesMessage.TYPE_ERROR, null, message));
       AdfPage.PAGE.showMessages(inputComponent.getClientId());
}

For removing af:message from an input component using java script, use the following code.

function customJSMethod(evt){
    var source = evt.getSource();
    var inputComponent = source.findComponent('inputcompId’);....
    AdfPage.PAGE. clearMessages (inputComponent.getClientId());
    AdfPage.PAGE.showMessages(null);
}

Thursday, May 19, 2016

Issue with groovy expresssion in ADF 12.1.3

I was trying to define a groovy expression for creating a sequence for one of my entity object attribute.
(new oracle.jbo.server.SequenceImpl("SEQ_NAME", adf.object.getDBTransaction())).getSequenceNumber()

But while trying to create a new record using BC Tester I am getting the following exception.

General error during semantic analysis: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.

oracle.jbo.ExprSecurityException: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.



After debugging for some time, I have found a resolution for this. While defining a groovy expression for an entity object attribute, the source code is generated as below.

<TransientExpression trustMode="untrusted"><![CDATA[(new oracle.jbo.server.SequenceImpl("SEQ_NAME", adf.object.getDBTransaction())).getSequenceNumber()]]></TransientExpression>


In order to resolve the above issue we need to make the trustMode attribute to trusted or remove the attribute trustMode as the default value for this attribute is trusted. 

<TransientExpression><![CDATA[(new oracle.jbo.server.SequenceImpl("SEQ_NAME", adf.object.getDBTransaction())).getSequenceNumber()]]></TransientExpression>
  

Thursday, March 24, 2016

Clearing cookies on browser close

In one of my project I had a requirement to clear all the session cookies set in my application on browser close. After exploring for a while I found out a simple configuration in WebLogic Server-specific deployment descriptor, weblogic.xml which will clear all the cookies on browser close. 

In session-descriptor section of weblogic.xml, there is a parameter, cookie-max-age-secs which sets the life span of the session cookie in seconds, after which it expires on the client. Setting this value to -1 expires the cookie on browser close.  Set this value as mentioned below.


Friday, October 23, 2015

How to install Apache Ant and run build script from command prompt

In this post, I will explain you the steps to install Apache Ant and run ant build script from command prompt.

Following are the steps to be followed to install Apache Ant.

1. Download Apache Ant's zip file from Apache Ant official website.
For example : apache-ant-1.9.5-bin.zip, unzip it to the folder where you want to store Apache Ant.


2. Make sure JDK is installed. And configure JAVA_HOME as environmental variable.


3. Configure ANT_HOME environmental variable as shown. In my case C:\apache-ant-1.9.5 stores Apache Ant.

 

4.  Set ANT_Home's path.


After the above steps, when you run the command ant -v from command prompt it should show you the following details:

 which means ant is setup successfully.

Follow the steps to run build script from command prompt.

1. Open command prompt and run the following command.

ant -f C:\Umesh\Code\Device.com\Portal\build.xml build 

Here C:\Umesh\Code\Device.com\Portal\ is the folder location where my build script exists.

2. Once you hit the above command, the script start executing as shown:


Once the script is run successfully, it will display confirmation message in command prompt.

Friday, April 10, 2015

How to generate HTML Javadocs using Jdeveloper

In this blog, I will explain the steps to create HTML Javadocs using Jdeveloper.

First add Javadocs for all the classes and its methods using  /** */.

Then follow the below steps to create HTML Javadocs.

1. Select the folder/file for which you want to create HTML Javadocs.

2. Go to Build menu and select Javadoc com.test to create HTML Javadoc.

3. Once the Javadoc is created, you should see the below message in the logs.


4. To view generated Javadoc for a specific class, Go to Java Doc in Navigate menu and search for the file.

 

5. Alternatively, you can go to the folder where Javadoc HTMLs are created.
In my case: C:\Jdeveloper\mywork\TestJavaDocApp\Javadoc\javadoc.
Click on index.html to view HTML javadocs.