Category Archives: ADF

Commands used to install XE for LINUX


Download the file from here

go to the installation folder of the rpm file

login as a root

root# rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm

to remove the previous installation use

root# rpm -e oracle-xe-univ-10.2.0.1-1.0.i386

root# /etc/init.d/oracle-xe configure
------------------------------------------------------------------------------

[root@indl144224 Desktop]# rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm

Preparing...                ########################################### [100%]

1:oracle-xe-univ         ########################################### [100%]

Executing Post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to

configure the database.

[root@indl144224 Desktop]# /etc/init.d/oracle-xe configure

------------------------------------------------------------------------------

user is prompted to configure http port, listener port, and the password for SYs and SYSTEM user

[its better to change to avoid any error in the future]

Oracle Database 10g Express Edition Configuration

-------------------------------------------------

This will configure on-boot properties of Oracle Database 10g Express

Edition.  The following questions will determine whether the database should

be starting upon system boot, the ports it will use, and the passwords that

will be used for database accounts.  Press <Enter> to accept the defaults.

Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8081

Specify a port that will be used for the database listener [1521]:1522

Specify a password to be used for database accounts.  Note that the same

password will be used for SYS and SYSTEM.  Oracle recommends the use of

different passwords for each database account.  This can be done after

initial configuration:

Confirm the password:

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:n

Starting Oracle Net Listener...Done

Configuring Database...Done

Starting Oracle Database 10g Express Edition Instance...Done

Installation Completed Successfully.

To access the Database Home Page go to "http://127.0.0.1:8081/apex"

------------------------------------------------------------------------------

export $ORACLE_HOME and $ORACLE_SID

------------------------------------------------------------------------------

[root@indl144224 Desktop]# export ORACLE_HOME=/usr/lib/oracle/xe/

app/     oradata/

[root@indl144224 Desktop]# export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

[root@indl144224 Desktop]# export ORACLE_SID=XE

[root@indl144224 Desktop]# cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/

------------------------------------------------------------------------------

Check the tns lsitener status

------------------------------------------------------------------------------

[root@indl144224 bin]# ./lsnrctl

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 30-AUG-2010 17:53:57

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                30-AUG-2010 17:40:21

Uptime                    0 days 0 hr. 13 min. 39 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Default Service           XE

Listener Parameter File   /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora

Listener Log File         /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=indl144224.idc.oracle.com)(PORT=1522)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8081))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "XE" has 1 instance(s).

Instance "XE", status READY, has 1 handler(s) for this service...

Service "XEXDB" has 1 instance(s).

Instance "XE", status READY, has 1 handler(s) for this service...

Service "XE_XPT" has 1 instance(s).

Instance "XE", status READY, has 1 handler(s) for this service...

The command completed successfully

LSNRCTL> exit

Getting the value of Saved search – programatic way


QueryModel qm = (QueryModel)evaluateEL("#{bindings.SearchViewCriteriaQuery.queryModel}");
 for(int indexCount=0; indexCount
 {
 QueryDescriptor qd = qm.getUserQueries().get(indexCount);
 if(qd!=null){
 String queryDescriptorName = qd.getName();
 System.out.println(queryDesctiptorName);
 m = qd.getUIHints();
 isDefault = (Boolean) m.get(QueryDescriptor.UIHINT_DEFAULT);
 System.out.println(isDefault);
 isRunAutomatically = (Boolean) m.get(QueryDescriptor.UIHINT_AUTO_EXECUTE);
 System.out.println(isRunAutomatically);
 if (Boolean.TRUE.equals(isDefault) && Boolean.TRUE.equals(isRunAutomatically){
 break();
 }
 else{
 queryDescriptorName = null;
 }
 System.out.println(isDefault);
 }

Snippet to check if the transaction is dirty


We can use the following code snippet to check if the transaction is dirty or not

BindingContext bctx = oracle.adf.controller.binding.BindingUtils.getBindingContext();
if (bctx.findDataControlFrame(bctx.getCurrentDataControlFrame()).isTransactionDirty()) {
 //show the timestamp
 }
 else{
 //don't show
 }

Show dialog when a page is fully loaded


1. Add popup and outputText component at the end of your page (make sure popup is before outputText in the page structure)

2. Create bean binding for popup as well as outputText.

3. In the getter of outputText, launch popup programatically.

4. Set visible=false for outputText

Ways to set the Query Mode programatically


The following snippet will be helpful in setting up the mode of the query criteria in programmatic way.

public Boolean setAdvancedMode(){
              QueryDescriptor descriptor =
                      (QueryDescriptor)evaluateEL
                  ("#{bindings.SearchCriteriaQuery.queryDescriptor}");
              descriptor.changeMode(QueryDescriptor.QueryMode.ADVANCED);
             return true;
}

public Object evaluateEL(String el) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ELContext elContext = facesContext.getELContext();
        ExpressionFactory expressionFactory =
            facesContext.getApplication().getExpressionFactory();
        ValueExpression exp =
            expressionFactory.createValueExpression(elContext, el,
                                                    Object.class);
       return exp.getValue(elContext);
    }

Easiest way to get the current binding from the bean


use the following snippet to get the current binding

BindingContainer bindings =  BindingContext.getCurrent().getCurrentBindingsEntry();
 AttributeBinding at = (AttributeBinding)bindings.getControlBinding("Period");
 at.getInputValue();

The above mentioned code is useful only in case of retrieving values of any attribute binding in the page definition file. To retrieve specific information use it like

//For search binding use it like
FacesCtrlSearchBinding fc =
(FacesCtrlSearchBinding)bindings.findExecutableBinding("PeriodQuery");
or
FacesCtrlSearchBinding fc =
(FacesCtrlSearchBinding)bindings.get("PeriodQuery");

//For LOV binding use it like
FacesCtrlLOVBinding fc = (FacesCtrlLOVBinding)bindings.get("PeriodLOV");

some of the useful methods that can also be used for retrieving binding is

private BindingContainer getBindings() {
BindingContainer bindings =
(BindingContainer)fc.getApplication().evaluateExpressionGet(fc, "#{bindings}",
 BindingContainer.class);
return (bindings == null) ? null : bindings;
 }

to retrieve the bindings  or executable you use it like

//to retireve the tree/table bindings
FacesCtrlHierBinding fc = (FacesCtrlHierBinding)bindings.get("Period");

//to retireve the tree/table iterator
DCIteratorBinding dc = (DCIteratorBinding)bindings.get("PeriodIterator");

Pictorial representation of JSF Life Cycle


Learn it from JSR


References for core and detail knowledge of technologies related to Java

JSR – http://jcp.org/en/jsr/platform

Java – http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html

J2EE5 – http://download.oracle.com/docs/cd/E17477_01/javaee/5/tutorial/doc/docinfo.html

JVM – http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html

JSP – http://jcp.org/aboutJava/communityprocess/final/jsr152/index.html

JSF – http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html

EJB2 – http://jcp.org/aboutJava/communityprocess/final/jsr019/index.html

EJB3 – http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html

EJB3.1 – http://jcp.org/aboutJava/communityprocess/final/jsr318/index.html

JSTL – http://jcp.org/aboutJava/communityprocess/final/jsr052/index.html

Servlets – http://jcp.org/aboutJava/communityprocess/final/jsr053/index.html

JDBC  – http://jcp.org/aboutJava/communityprocess/final/jsr054/index.html

Web services – http://jcp.org/aboutJava/communityprocess/final/jsr109/index.html

setting uniqueid for the attributes


At design time, Fusion Middleware extensions provide the ability to identify if an entity attribute needs a globally Unique ID. This is accomplished by setting Application Unique ID to true in the entity attribute’s Property Inspector

oracle.jbo.server.uniqueid.UniqueIdHelper.getUniqueId(adf.object.unwrapObject());

Increase the minimum/maximum heap size of Jdeveloper


To change the values for minimum and maximum Java heap, modify the corresponding parameters in $JDEV_HOME/ide/bin/ide.conf

Other parameters can be set in $JDEV_HOME/jdev/bin/jdev.conf