Sunday, February 23, 2014

How to Display Hints on disabled field in ADF

This blog explains about How to display 'Hints' on a disabled field. Normally if you set tool tip message at attribute level for any inputtext, By placing mouse cursor on any editable inputText field, you will see corresponding tool tip message, But if you have 'Disabled' field, this approach won't work

Define a face with 'Context' as shown below.

<af:inputText value="#{bindings.ProjCoopFund.inputValue}"
                          label="#{tireprouiBundle.TOTAL_PROJ_COOP}"
                          autoSubmit="true" columns="20" disabled="true"
                          maximumLength="#{bindings.ProjCoopFund.hints.precision}"
                          shortDesc="#{bindings.ProjCoopFund.hints.tooltip}"
                          id="projcoops" rows="1"
                          contentStyle="text-align:right">
              <f:validator binding="#{bindings.ProjCoopFund.validator}"/>
              <af:convertNumber groupingUsed="false"
                                pattern="#{bindings.ProjCoopFund.format}"
                                minFractionDigits="2"/>
              <f:facet name="context">
                <af:contextInfo shortDesc="Sample Tool Tip"
                                id="ctx1"/>
              </f:facet>
            </af:inputText>


How to dynamically create View Criteria and execute in ADF ?


This blog explains about how to create 'View Criteria' dynamically



       

  EmployeeVOImpl empVO =
                getEmployeeVO();
            ViewCriteria vc =empVO.createViewCriteria();
            ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
            if(employeeID != null){
                ViewCriteriaItem vci=vcRow.ensureCriteriaItem("EmployeeId");
                vci.setValue(new Number(employeeID));
                vc.addElement(vcRow);
                empVO.appendViewCriteria(vc);
            }
            empVO.executeQuery();
            
            Row[] filterRows =
                empVO.getFilteredRows("EmployeeId", new Number(employeeID));
       
 

How to load long runing Taskflows in a Page or Page Fragment using inlineFrame & How to embed taskflow into inlineFrame ?


This blog explains about loading running taskflows onto a page or page fragment. So that when page getting loaded we don't need to wait until all the long running taskflows get loaded.

- Create a taskflow as shown below,  This approach will work only with pages and not with fragments.       unselect 'Use Page Fragments' and  set 'url-invoke-allowed' value to 'URL Invoke' attribute as shown below.



- Drag '<af:inlineFrame"' component from the component pallet, and set 'src' attribute value as shown below. In this example, I used above taskflow as 'src'

- Run you page, and you can notice rest of all the components will be rendered though <af:inlineFrame> associated taskflow takes time to load, and user can click any command button/link while 'inlineFrame' is being loaded.



Tuesday, February 18, 2014

How to install patches to Jdeveloper using opatch utility tool ?


This blog explains about applying patch to Jdeveloper using 'opatch' utility

- Download the correct version of OPatch utility software from the Oracle site.
- Take a backup of your existing 'Opatch' folder in your FMW-HOME directory.


- Unzip and copy the downloaded 'OPatch' folder to your FMW_HOME folder. for instance : C:\Oracle\Middleware\jdeveloper
- Download the respective patch, Unzip
- Create ORA_HOME environment variable as shown below.

- Append 'Opatch' direct to 'Path' Environment variable

- CMD to respective Patch folder and verify the version of the 'Opatch' that you have installed

- Apply the patch as shown below

- Follow the steps, This should install the patch


If you encounter below error while applying patch, that indicates clearly you are having wrong version of 'Opatch' s/w, Try to download the correct version of Opatch s/w

OPatch was not able to find OUI jars to load them runtime. Please provide valid
oui location using 'oui_loc' option.

OPatch failed with error code = 255

Monday, February 17, 2014

How to display content based on attribute value ?


This blog explains about how to display/refresh <af:table> data based on specific attribute value

Scenario  : Display only rows where 'isDeleted' attribute value is 'N'

Implementation

1 Create 'Tree Iterator Binding' for the view object which is dragged on to the page/fragment as <af:table> component , and select the 'Filter Attribute' and 'Filter Value' as shown below


Below is how the pageDef.xml looks like


You will see results in <af:table> component only 'isDeleted' attribute value equals 'N'.

Friday, February 14, 2014

Most Commonly Used UNIX command


change directory - cd /u02/oracle/admin
open a specific file - vi Employee.txt
List all the files and directories - ls -ltr
To get the Present working directory - pwd
To search all the files for a specific string - grep 'Echo' *.*
Issue Sudo command - sudo su - adfadmin
Clear the screen - clear
Remove specific file - rm Employee.log
How to tail specific file - tail -f Employee.log
How to close a file in VI mode without saving - Esc :q!
How to save a file in VI mode - Esc:wq!
How to reach last line of file in vi Mode - Esc : $ Enter

How to search from bottom of the file to Top of the file ?
Answer : open file in vi mode, Hit 'Esc : $' and press enter - enter '/<search string>' hit enter - Hold Shift +n

How to find a specific file in by file name ?
$ find . -name 'config.cmd'

How to find a specific directory/folder in linux by name
Answer : $ find / -type d -name 'foldername'

How to Monitor performance of CPU, Memory
Answer : $ top
How to find Virtual Memory statistics ?
Answer : $ vmstat

How to change permissions to a specific file ?
chmod 644 ravi.txt

Below is the description for each file
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)

chmod 666 ravi.txt read/write by anybody! (the devil loves this one!)
chmod 755 ravi.txt rwx for owner, rx for group and rx for the world
chmod 777 ravi.txt read, write, execute for all! (may not be the best plan in the world...)

How to telnet a specific port 
Eg : telnet <server_name> <portNum> eg : telnet uxunt540 4444

- Follow below command to see all the properties and configuration parameters for a specific server instance

       ps -eaf | grep WC_CustomPortal1

- Follow below command to grep for specific string
      find . -type f -exec grep "=jdk" {} \;

- Follow below command to copy a specific file with different name
      $ cp setDomainEnv.sh setDomainEnv_07-72014.sh
Ref : http://www.tecmint.com/command-line-tools-to-monitor-linux-performance/

- Follow below command to execute shell script
   ./<script_name>.sh
  Also , bash test.sh

- How to take Thread Pool Dump in Unix.
      - Issue below command : ps - ef | grep java , Which will give you process ID (pid) as shown below
   - Once determining pid using above step, then issue below command
                kill -3 <pid> , This will generate thread dump in server STDOUT.
- To all the running processes
                   ps –ef | grep java

 - To Kill any specific running process
          Kill -9 pid
- To see installed Lunix s/w
        uname -a
- To see memory on linux 
           grep MemTotal /proc/meminfo
           grep SwapTotal /proc/meminfo
           df -h /tmp
- Search for all the groups exists in Linux
   cat  /etc/group

- How to create  a new group ?
        groupadd -g 800 dba

- To find specific user details
          id <user name > example : id oracle
- How to install a JAR file in linux environment ?
           java -jar installer.jar

-How to install specific missing RPM ?
           yum install <rpm name>

- How to install a rpm ?
      rpm -i <rpm Name> to install any rpm

- How to perform Update on linux machine ?
     yup update

- How to reboot Linux machine ?
       reboot
- Installing Oracle Fusion Middleware installers on linux machine
  ./runInstallaer -jreLoc usr/java/jdk... (Enter)

-How to set Display attributes in Linux machine
   DISPLAY 111.111.45.254:0.0; export DISPLAY

Ref : http://middlewaremagic.com/weblogic/?p=823

Wednesday, February 12, 2014

Check not null condition in EL (Expression Language)


Use below EL to check 'null' condition

visible="#{not empty pageFlowScope.ManagedBean.propertyName}"

Tuesday, February 11, 2014

How to Read Properties File in Java


This blog explains about how to read '.properties' file in Java

For eg : HostNamesURLS.properties file stores the values using key value pair

Below is the 'PropertyLoader' java class, which loads the all the properties into java.util.HashMap

       

  public class PropertyLoader {
   static PropertyLoader sPropertyLoader = null;
    static Properties propertyMap;
    public static PropertyLoader getInstance(){
        if(sPropertyLoader == null){
            sPropertyLoader = new PropertyLoader();
        }
        return sPropertyLoader;
    }
    
    private Properties loadProperties() {
        InputStream is;
        try {
            if (propertyMap == null) {
                propertyMap = new Properties();
                is =
        this.getClass().getClassLoader().getResourceAsStream("HostNameURLS.properties");
                propertyMap.load(is);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return propertyMap;
    }

    public void setPropertyMap(Properties pPropertyMap) {
        this.propertyMap = pPropertyMap;
    }
    public Properties getPropertyMap() {
        if(propertyMap == null){
            loadProperties();
        }
        return this.propertyMap;
    }    
}
  
       
 

Below is the sample code how to retrieve the values using above class

Object value = PropertyLoader.getInstance().getPropertyMap().get("key");

JDeveloper shortcuts


   Below are the most commonly used Jdeveloper shortcuts


Debug Project Shift+F9
Show Overview Ctrl+Shift+ Back Quote
Find Usages Ctrl+Alt+U
Go To Java Type Ctrl+Minus
Go To File Ctrl+Alt+Minus
Extract Method Ctrl+Alt+X
Introduce Variable Ctrl+Alt+V
Run Project F11
Quick JavaDoc Ctrl+D
Reformat Ctrl+Alt+L

Search
Code Highlight Ctrl+Alt+H
Clear Code Highlight Ctrl+Alt+K
Auto Code Highlight (this makes the code always highlighted)

View
Structure Ctrl+Shift+S
Property Inspector Ctrl+Shift+I
Component Palette Ctrl+Shift+R
Break Point Ctrl+Shift+R

Miscellaneous

Copy Path Ctrl+Shift+C
Go To Line Ctrl+G
Go To Window Ctrl+F6
Go To File Ctrl+Alt+Minus

Build
Make Project Ctrl+F9
Rebuild Project Alt+F9

Run
Resume F9
Step Over F8
Step Into F7
Step Out Shift+F7

Java Editing
Organize Imports Ctrl+Alt+O
Select in Navigator Alt+Home

What is cwallet.sso file in ADF application/JDeveloper?

In development environment when you define database connection, or any connection that has password for that matter, the cwallet.sso is the one that save and hash this password so that when you copy the project to another person it still works fine. 

cwallet.sso is encrypted and you cannot browse it or explicitly edit it via JDeveloper. At design-time, different components make use of cwallet.sso and are responsible for creating the necessary credentials in it. Examples are OWSM policy attachments that override the csf-key and ADF connections requiring credentials in the call out.

Monday, February 10, 2014

How to limit SQL Statement execution in ADF

If there are tables with huge volume of records and in order to limit the query execution to "x" seconds, add the following property in jdbc.xml file.

<jdbc-connection-pool-params>
    <test-connections-on-reserve>true</test-connections-on-reserve>
    <test-table-name>dual</test-table-name>
    <statement-timeout>60</statement-timeout>
  </jdbc-connection-pool-params>

This specifies how long the connection can be unused before the connection is abandoned. The connection timeout is in secs.

Please check foll. Oracle documentation for more:
http://docs.oracle.com/cd/E13222_01/wls/docs103/jdbc_admin/jdbc_datasources.html#wp1170721



How to disable VO execution on pageLoad.

Here is a good approach to prevent VO execution on pageload.

In 10g, ${adfFacesContext.postback == true} property is used as Refresh Condition for the VO iterator to stop its execution on Pageload.

11g has a good feature of taskflows, so we can create a default method.
Create a method in Application Module and execute a emptyRowSet on VO, this will executes the VO but returns 0 results(by appending false condition) and use this as default activity method in the taskflow.

How to set Custom DateTime Format in SQL Developer

In order to display the custom Date Format in SQL Devloper, configure the NLS parameters as follows:

Go to: Tools >> Preferences >> Database > NLS Parameters and update your Date Format field to
DD-MON-RR HH:MI:SS value.

By default Oracle SQL Developer displays the Date Format as 10-FEB-14

Sunday, February 9, 2014

How to turn off some features in PanelCollection component


This blog outlines about how to hide some of the features of <af:panelCollection> component

<af:panelCollection id="pc1" featuresOff="freezeMenuItem">

<af:panelCollection id="pc1" featuresOff="detachMenuItem">

<af:panelCollection id="pc1" featuresOff="sortMenuItem">

<af:panelCollection id="pc1" featuresOff="reorderColumnsMenuItem">

<af:panelCollection id="pc1" featuresOff="resizeColumnsMenuItem">

<af:panelCollection id="pc1" featuresOff="wrapMenuItem">

<af:panelCollection id="pc1" featuresOff="showAsTopMenuItem">

<af:panelCollection id="pc1" featuresOff="scrollToFirstMenuItem">

<af:panelCollection id="pc1" featuresOff="scrollToLastMenuItem">

<af:panelCollection id="pc1" featuresOff="freezeToolbarItem">

<af:panelCollection id="pc1" featuresOff="detachToolbarItem">

<af:panelCollection id="pc1" featuresOff="wrapToolbarItem">

<af:panelCollection id="pc1" featuresOff="showAsTopToolbarItem">

<af:panelCollection id="pc1" featuresOff="wrap">

<af:panelCollection id="pc1" featuresOff="freeze">

<af:panelCollection id="pc1" featuresOff="detach">

 <af:panelCollection id="pc1" featuresOff="statusBar">

 <af:panelCollection id="pc1" featuresOff="viewMenu">

Saturday, February 8, 2014

Change the weblogic startup port number


Sometimes we might want to start multiple weblogic servers on the same machine with different port numbers but the default port number is 7001 and we want to change it


How to change the port number

Open and edit the config.xml file in the location specific to the current domain in the weblogic server
                C:\Oracle\Middleware_webcenter\user_projects\domains\new_domain\config

  <server>
    <name>AdminServer</name>
     <listen-port>7601</listen-port>      => Change the port here
    <server-diagnostic-config>
      <name>AdminServer</name>
      <diagnostic-context-enabled>true</diagnostic-context-enabled>
    </server-diagnostic-config>

  </server>

Resolve Domain Creation error with UCM


Error

Whenever we are configuring or creating a new domain with UCM environment we may face the following error.

ERROR create_gui com.oracle.cie.wizard.domain.gui.tasks.DomainCreationGUITask - Generation Error!!
Traceback (innermost last):
File "<iostream>", line 17, in ?
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Solution

Generally the domain creation command script or shell script is present at the location below

C:\Oracle\Middleware_webcenter\wlserver_10.3.6\common\bin\config.exe

Instead of that use the config file at the below location to create the domain

C:\Oracle\Middleware_webcenter\Oracle_ECM1\common\bin\config.exe

Tuesday, February 4, 2014

How to apply view criteria programatically in Oracle ADF?

    public void getEmployeeById(Number employeeId) {
        EmployeesVOImpl empVO = getEmployeesView1();
        ViewCriteria vc = empVO.getViewCriteria("findEmployeeVC");
        vo.applyViewCriteria(vc);
        vo.setNamedWhereClauseParam("pEmployeeId", employeeId);
        vo.executeQuery();
    }

java.io.NotSerializableException in Oracle ADF


Why this error occurs?

This error occurs because of binding a UI Component to the managed bean which is not in Backing Bean or Request Scope. UI Component binding objects in scopes other than Backing Bean scope and request scope are expected to be serializable. 

How to resolve the issue?

Restrict the scope of the managed bean that you reference through a UI component's binding attribute to backingBean or request scope. Instances of UI components cannot be serialized. For this reason, you should not bind UI components to managed beans that have a scope other than Backing Bean scope or request scope. Note that JDeveloper defaults the binding attribute for UI components and region fragments to use the backingBean scope.

If the managed bean is in any other scope, then use the method findComponentInRoot method from this link