Monday, February 27, 2012

ADF Migration: 10g to Trinidad

How to Migrate an ADF 10g Application to 11g(Trinidad) ?
-----------------------------------------------------------------

When we attempt a migration from ADF 10g application to ADF 11g, It will get migrated to Trinidad Component. It handles automatically by the IDE(Jdeveloper 11g). You need to select the checkBox Migrate to Trinidad during opening an 10g application into Jdeveloper 11g.


Below is some useful tips::--

Imports
 import org.apache.myfaces.trinidad.component.core.data.CoreTable;
 import org.apache.myfaces.trinidad.component.core.input.CoreInputText;
 import org.apache.myfaces.trinidad.component.core.nav.CoreCommandButton;
 import org.apache.myfaces.trinidad.component.html.HtmlRowLayout;
 import org.apache.myfaces.trinidad.component.core.output.CoreMessages;
 import org.apache.myfaces.trinidad.component.core.output.CoreSpacer;
 import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
 import org.apache.myfaces.trinidad.component.html.HtmlBody;
 import org.apache.myfaces.trinidad.component.html.HtmlCellFormat;
 import org.apache.myfaces.trinidad.component.html.HtmlHead;
 import org.apache.myfaces.trinidad.component.html.HtmlHtml;
 import org.apache.myfaces.trinidad.component.core.output.CoreSpacer;
 import org.apache.myfaces.trinidad.component.core.nav.CoreCommandLink;
 import org.apache.myfaces.trinidad.component.core.layout.CorePanelBox;
 import org.apache.myfaces.trinidad.component.core.layout.CorePanelPage;
 import org.apache.myfaces.trinidad.component.core.layout.CorePanelList;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectOneChoice;
 import org.apache.myfaces.trinidad.component.core.input.CoreInputDate;
 import org.apache.myfaces.trinidad.component.core.input.CoreInputHidden;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectBooleanCheckbox;
 import org.apache.myfaces.trinidad.component.html.HtmlTableLayout;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectManyListbox;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectOneRadio;
 import org.apache.myfaces.trinidad.component.core.input.CoreResetButton;
 import org.apache.myfaces.trinidad.context.RequestContext;

 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import javax.el.ValueExpression;
 import org.apache.myfaces.trinidad.component.core.data.CoreColumn;
 import org.apache.myfaces.trinidad.component.core.input.CoreSelectItem;
 import org.apache.myfaces.trinidad.component.core.layout.CorePanelFormLayout;
 import org.apache.myfaces.trinidad.component.core.layout.CoreShowDetail;
 import org.apache.myfaces.trinidad.component.UIXSwitcher;
 import org.apache.myfaces.trinidad.model.RowKeySet;
 import org.apache.myfaces.trinidad.component.core.data.CoreTable;




List of the Component Classes, which has been Renamed/Changed in Trinidad
Name in 10G    CoreObjectSpacer
Name in Trinidad    CoreSpacer


Name in 10G    CorePanelGroup
Name in Trinidad    CorePanelGroupLayout


Name in 10G    CoreShowOnePanel
Name in Trinidad    CorePanelAccordion


Name in 10G    CoreSelectInputDate
Name in Trinidad    CoreInputDate


List of the Component Classes, which is not available in Trinidad

  CoreTableSelectOne
  CoreTableSelectMany
  CoreMenuList
  CoreCommandMenuItem

  RichCommandMenuItem
  CoreMenuBar
  RichMenuBar
  Region (Region Migration)

 NOTE : An adfinternal package, which has been changed to trinidadinternal; no migration will be available for any code using these APIs, as they were were not supported for use by clients.

Depricated API with Replacement

Deprecated  javax.faces.el APIs in 10G
Replaced by javax.el APIs in Trinidad
ValueBinding
Value Expression
Method Binding
Method Expression
Variable Resolver
Property Resolver
Vb.getValue(Context)
Vb.getValue(Context.getELContext)

Deprecated  APIs in 10G
Replaced APIs in Trinidad
AdfFacesContext
RequestContext
AdfFacesFilter
TrinidadFilter
ADFLogger
TrinidadLogger
ADFLogRecord
TrinidadLogRecord

NOTE : 'processScope'  has been  renamed 'pageFlowScope' in Trinidad.



Manual Changes Needed:
NOTE : (Refer from SRDemoMigration Guide)
Ø  Replace adfFacesContext References with Trinidad requestContext
 In this release, the migration wizard automates substituting references to adfFacesContext by the Trinidad equivalent requestContext in pages and page definitions, however if you have referenced adfFacesContext in Java code, you need to make this subsitution manually. So we can use JDeveloper's search/replace in files functionality to accomplish this manually.
Ø  Add Whitespace After Colon in EL Expressions Using Ternary Operation to Avoid JSF 1.2 EL Runtime Error
The JSF 1.2 Expression Language (EL) evaluator currently throws an ELException at runtime trying to parse the : (colon) symbol in ternary expressions if it is immediately followed by an alphabetic character. The easiest way to workaround this issue is to search for such occurrences in your pages and add whitespace around the : in the ternary expression.
Example,welcome.jspx.
value="#{row.AssignedDate eq null?res['srsearch.highlightUnassigned']:row.AssignedDate}"
...
The colon needs to be separated from the identifier row by whitespace to avoid the error. So change the EL expression to have whitespace after the : like this:
value="#{row.AssignedDate eq null?res['srsearch.highlightUnassigned']: row.AssignedDate}"
...


To quickly navigate to any file by name, choose Navigate | Go to File... or press Ctrl+ Alt+ Minus, then begin to type the name of the file to subset the list and choose the one you want. (No need to remember what directory it is in!)





Ø  Add Immediate="true" To Buttons Bound to Delete Actions If Not Present
As a best practice, a JSF command component like a "Cancel" or "Rollback" button should have its immediate property set to true to avoid posting any user data in the current form before carrying out the operation. The SRDemo's SRMain.jspx page inadvertently did not correctly follow this best practice for the (Cancel) button in the "Add Note" panel in the page.
Due to an ADF Faces 10.1.3 issue [Bug 5918302] now fixed in 11g, this best-practice setting of the immediate property went unnoticed. Here's why. In JDeveloper 10.1.3 with ADF Faces, when client-side mandatory attribute enforcement is not in use, a form submitted

with empty values for server-side mandatory fields is not correctly validated if the user has not changed the data of any field in the form. In 11g, the validation is correctly triggered now so we need to correct the situation by adding the immediate="true" property to this (Cancel) button.

Ø  Adjust Reference to Table SelectionState
The ADF Faces table has a property named selectionState whose nested property keySet returns a Set of keys for the selected rows. The Apache Trinidad table has a property named selectedRowKeys that similarly returns a Set of keys for the selected rows.


Table handling code level in Bean
Set keySet = getHistoryTable().getSelectionState().getKeySet();-->  (ADF 10G)
to this:
Set keySet = getHistoryTable().getSelectedRowKeys(); --> (Trinidad)
-----------------------------------------------------


Tool Tip Handling code level
getConfidential().setTip(null); --> (ADF 10G)
to this:
getConfidential().setShortDesc(null); --> (Trinidad)
 
Migration Tips
·         The PPR implementation of Trinidad is different from the one in ADF Faces. However, when you mix ADF Faces components with Trinidad components, avoid Trinidad components that have integrated PPR behaviour. Only use passive Trinidad components.



     Useful Link:
·        Apache Trinidad Home Page: http://myfaces.apache.org/trinidad/index.html
·        Trinidad Demo:  http://example.irian.at/trinidad-demo/faces/index.jspx
·        SRDemo migration(10.1.3 to Trinidad): http://www.oracle.com/technetwork/developer-tools/jdev/migration-082101.html
·        Trinidad Apache TagDoc:  http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_tableLayout.html

    How to migrate an adf application?
    Trinidad component
    How to migrate adf faces to trinidad?
    How to migrate adf 10g to trinidad?