jsf (adf) case studies presentation

28
ADF Case Studies ADF Case Studies By Michael A. Fons By Michael A. Fons Graebel Companies, Inc. Graebel Companies, Inc. [email protected] [email protected] February 2008 February 2008

Upload: michael-fons

Post on 17-May-2015

1.641 views

Category:

Technology


1 download

DESCRIPTION

JSF Presentation I did for RMOUG training days conferenece 2008

TRANSCRIPT

Page 1: JSF (ADF) Case Studies Presentation

ADF Case StudiesADF Case Studies

By Michael A. FonsBy Michael A. FonsGraebel Companies, Inc.Graebel Companies, Inc.

[email protected]@graebel.com

February 2008February 2008

Page 2: JSF (ADF) Case Studies Presentation

The SubjectsThe Subjects

Graebel Companies, Inc.Graebel Companies, Inc.E-Pages projectE-Pages projectBranches coordinating resources of movesBranches coordinating resources of moves

RMOUGRMOUGwebsite rebuildwebsite rebuild IS Director wanted more features and a IS Director wanted more features and a

makeovermakeover

Page 3: JSF (ADF) Case Studies Presentation

PlatformsPlatforms

G:G: JDev 10.1.3.3.0JDev 10.1.3.3.0

ADF/BC, JSFADF/BC, JSF Web ServicesWeb Services

OAS 10.1.3.xOAS 10.1.3.x ADF, BPEL, APEX, BI Publisher, Forms, Reports, ADF, BPEL, APEX, BI Publisher, Forms, Reports,

PL/SQL, .NET, …PL/SQL, .NET, …

R:R: JDev 10.1.3.3.0JDev 10.1.3.3.0

ADF/BC, JSFADF/BC, JSF OC4J 10.1.3.3.0OC4J 10.1.3.3.0

Page 4: JSF (ADF) Case Studies Presentation

Why ADF?Why ADF?

G:G:Oracle investing in it heavilyOracle investing in it heavilyTouted as next step after Oracle FormsTouted as next step after Oracle Forms

R:R:Something I wanted to learnSomething I wanted to learn It would do the trick for IS DirectorIt would do the trick for IS Director I was willing and able to volunteerI was willing and able to volunteer

Page 5: JSF (ADF) Case Studies Presentation

Question from Design PhaseQuestion from Design Phase

G:G:Entities based on DB viewsEntities based on DB viewsNavigationNavigationTesting OptionsTesting OptionsGlobal Button barGlobal Button barDatabase custom login (modules)Database custom login (modules)Doing CRUD on an af:tableDoing CRUD on an af:table

R:R:Self-change password resetSelf-change password reset

Page 6: JSF (ADF) Case Studies Presentation

Training (of Developers to do ADF)Training (of Developers to do ADF)

G:G:Presentations and papers like thisPresentations and papers like thisManagement carved out several daysManagement carved out several days

Three days of lessonsThree days of lessonsOracle Developer DayOracle Developer DayDoing actual assignments & proofs-of-Doing actual assignments & proofs-of-

conceptconceptOn-line end-user trainingOn-line end-user training

R:R:So far: training through e-mail for IS So far: training through e-mail for IS

DirectorDirector

Page 7: JSF (ADF) Case Studies Presentation

Foundational DiscoveriesFoundational Discoveries

Good to be knowledgable/flexible with Good to be knowledgable/flexible with LOV’sLOV’s

Way has been paved for Custom Login Way has been paved for Custom Login Module by Frank Nimphius.Module by Frank Nimphius.

Validating at the view level is rather Validating at the view level is rather complexcomplexMade easier by doing Creates/Updates on a Made easier by doing Creates/Updates on a

single row pagesingle row page

Page 8: JSF (ADF) Case Studies Presentation

Web ServicesWeb Services

G:G:Prepared by calling .NET servicesPrepared by calling .NET servicesCould not use JDev’s Web Service Data Could not use JDev’s Web Service Data

Control Wizard (parameters did not implement Control Wizard (parameters did not implement Serializable)Serializable)

Used JDev Web Service Proxy Wizard Used JDev Web Service Proxy Wizard instead; worked fineinstead; worked fine

Page 9: JSF (ADF) Case Studies Presentation

Web ServicesWeb Services

G:G:Kicking off BPEL may require BPEL web Kicking off BPEL may require BPEL web

service call from PL/SQL triggerservice call from PL/SQL triggerWeb Service Security by getting .NET tokenWeb Service Security by getting .NET tokenWeb Services called from Forms alsoWeb Services called from Forms also

R:R:nonenone

Page 10: JSF (ADF) Case Studies Presentation

Software Install IssuesSoftware Install Issues

R:R:JDK 5.0JDK 5.0OC4J 10.1.3.3.0OC4J 10.1.3.3.0ADFInstallerADFInstallerDB tablesDB tablesADF app deploymentADF app deployment

G:G:Talk to our DBA groupTalk to our DBA groupADF app deploymentADF app deployment

Page 11: JSF (ADF) Case Studies Presentation

Which JDev version to use?Which JDev version to use?

At second developers preview for 11g now (Jan At second developers preview for 11g now (Jan 8, 2008).8, 2008).

JDev 11g has many needed featuresJDev 11g has many needed features Developers Previews will blunt the “bleeding Developers Previews will blunt the “bleeding

edge”edge” Drag and dropDrag and drop At Graebel: too much risk currently go to 11gAt Graebel: too much risk currently go to 11g Staying at 10.1.3.3.0 (for G and R)Staying at 10.1.3.3.0 (for G and R) Looking forward to new features like Drag and Looking forward to new features like Drag and

Drop hooks.Drop hooks.

Page 12: JSF (ADF) Case Studies Presentation

HintsHints

Copy off your directory with JDev closed daily.Copy off your directory with JDev closed daily. Get comfy with framework extensions, for ADF Get comfy with framework extensions, for ADF

BC’s, FacesLifeCycles, SessionCookieFactories, BC’s, FacesLifeCycles, SessionCookieFactories, or any standard class.or any standard class.

CVS sounds like a good ideaCVS sounds like a good idea Integrated with JDev Integrated with JDev TeamworkTeamwork Suggests automated recompile/regression testsSuggests automated recompile/regression tests Chapter in ADF Developer’s GuideChapter in ADF Developer’s Guide

Source control .zip fileSource control .zip file

Page 13: JSF (ADF) Case Studies Presentation

HintsHints

Skin changesSkin changes Does your company’s marketing Does your company’s marketing

department have standard colors?department have standard colors? You can adapt some out-of-the-box You can adapt some out-of-the-box

skins to your needs. (We adapted skins to your needs. (We adapted SRDemo’s skin.)SRDemo’s skin.)

Make your own images; pixels; artistic.Make your own images; pixels; artistic. Disappearing skin: caching .css and Disappearing skin: caching .css and

other filesother files Panel form column alignment Panel form column alignment

problematicproblematic

Page 14: JSF (ADF) Case Studies Presentation

HintsHints

Page parametersPage parametersUse Invoke Action on MethodAction which Use Invoke Action on MethodAction which

passes values like #{param.param1} for passes values like #{param.param1} for setting query bind variable values.setting query bind variable values.

Using extension of ADFFacesLifeCycle works Using extension of ADFFacesLifeCycle works for non-query related coding (like storing page for non-query related coding (like storing page parameter values on the session scope)parameter values on the session scope)

Page 15: JSF (ADF) Case Studies Presentation

Calling ADF from Oracle FormsCalling ADF from Oracle Forms There is a solution which a Forms guru from the There is a solution which a Forms guru from the

Forum offered me; free now.Forum offered me; free now. SSO?SSO? Instead, we built a home-grown solution.Instead, we built a home-grown solution.

Call from forms contains un, pw (encrypted), and Call from forms contains un, pw (encrypted), and other parameters.other parameters.

Called logout.jspx (ADF Faces page)Called logout.jspx (ADF Faces page) ……which called unpwset.jsp to set HttpSession un and which called unpwset.jsp to set HttpSession un and

pw attributes…pw attributes… ……which called the final target page, which is which called the final target page, which is

protected in web.xmlprotected in web.xml Custom LoginModule decrypts pw before Custom LoginModule decrypts pw before

authenticating.authenticating.

Page 16: JSF (ADF) Case Studies Presentation

More HintsMore Hints

Deployment issuesDeployment issuesG:G:

Did initial proof of concept page Did initial proof of concept page in 10.1.3.2in 10.1.3.2

Deployed to Solaris 8 and OAS Deployed to Solaris 8 and OAS 10.1.3.x…this did not work well at 10.1.3.x…this did not work well at all.all.

Deployed to Solaris 10 worked Deployed to Solaris 10 worked fine however.fine however.

R:R:Deployed to 10.1.3.3.0 OC4J Deployed to 10.1.3.3.0 OC4J

(Solaris 10): worked great.(Solaris 10): worked great.

Page 17: JSF (ADF) Case Studies Presentation

HintsHints

executeWithParams quirkexecuteWithParams quirkG:G:

Drop of executeWithParams method onto page Drop of executeWithParams method onto page manifests fine as ADF Parameter Form.manifests fine as ADF Parameter Form.

Subsequent dragged-and-dropped parameters Subsequent dragged-and-dropped parameters from the same view are not connected right.from the same view are not connected right.

In the PageDef file for the page, add to list of In the PageDef file for the page, add to list of parameters listed in executeWithParams Action parameters listed in executeWithParams Action within the bindings section. (Subsequent drag and within the bindings section. (Subsequent drag and drops on the page do not add this.)drops on the page do not add this.)

Page 18: JSF (ADF) Case Studies Presentation

HintsHints

Creating an insert/update af:table can be Creating an insert/update af:table can be complex, depending on user expectations.complex, depending on user expectations.Data bound drop-down lists, must use Data bound drop-down lists, must use

af:forEachaf:forEachLOV on af:ouputText works wellLOV on af:ouputText works wellDoing view-level validation on af:table really Doing view-level validation on af:table really

threw me. threw me. Validates every row for every change; Validates every row for every change; value of #{row} changes while validating; value of #{row} changes while validating; commit stopped working due to faulty EL commit stopped working due to faulty EL

expression somewhereexpression somewhere

Page 19: JSF (ADF) Case Studies Presentation

LOV MontageLOV Montage

Page 20: JSF (ADF) Case Studies Presentation

SecuritySecurity Did not use ADF Security Did not use ADF Security

(on either G or R)(on either G or R) Used JAAS on bothUsed JAAS on both G:G:

Used custom LoginModule Used custom LoginModule and Dynamic JDBC; to and Dynamic JDBC; to authenticate and connect to authenticate and connect to individual Oracle schemas.individual Oracle schemas.

R:R: Used custom LoginModule to Used custom LoginModule to

authenticate against user and authenticate against user and role tables in databaserole tables in database

Connected to single user.Connected to single user.

Page 21: JSF (ADF) Case Studies Presentation

SecuritySecurity

G:G:Dynamic JDBC Dynamic JDBC

Do not use BASIC authentication; Do not use BASIC authentication; need HttpSessionneed HttpSession

Overrode ApplicationModule Overrode ApplicationModule implementation class’s afterLogon implementation class’s afterLogon method so I could do set_role method so I could do set_role required for our user/role setuprequired for our user/role setup

Database/sid/port obtained from Database/sid/port obtained from the default connection you set for the default connection you set for application module.application module.

Page 22: JSF (ADF) Case Studies Presentation

Custom Exception HandlingCustom Exception Handling

G:G: SRDemo app comes with implementation of custom SRDemo app comes with implementation of custom

exception handling.exception handling. ADF Dev Guide explains how to do the same thing.ADF Dev Guide explains how to do the same thing. When I copied the example code: it would disable the When I copied the example code: it would disable the

use of #{row.xxx}. use of #{row.xxx}. Exception handling worked great though…Exception handling worked great though… I opened an Oracle SR; the solution: comment out I opened an Oracle SR; the solution: comment out

the portion of the SRDemo FacesPageLifeCycle that the portion of the SRDemo FacesPageLifeCycle that checks for proper setup of SRDemo. (an “if” checks for proper setup of SRDemo. (an “if” statement)statement)

Page 23: JSF (ADF) Case Studies Presentation

Column SortingColumn Sorting

G:G: Af:table column sortingAf:table column sorting If you request column sorting when If you request column sorting when

you drop a data control collection you drop a data control collection as a Table, all works well.as a Table, all works well.

New columns added, though, need New columns added, though, need the Sortable property set to the the Sortable property set to the ViewObject attribute on which that ViewObject attribute on which that column is sorting.column is sorting.

Sortable value can be conditional, Sortable value can be conditional, like #{bindings.Commit.enabled ? like #{bindings.Commit.enabled ? ‘theAttributeName’ : ‘’} ‘theAttributeName’ : ‘’}

Page 24: JSF (ADF) Case Studies Presentation

LOV issuesLOV issuesG and R:G and R:

Calling dialogCalling dialogDialog page can have source iterator binding Dialog page can have source iterator binding

in it, or data can pass back in it, or data can pass back Commit/Rollback buttons:Commit/Rollback buttons:

Af:setActionListener setting source iterator sets Af:setActionListener setting source iterator sets #{bindings.Commit.enabled} to true.#{bindings.Commit.enabled} to true.

If you pass data back, use ViewObject Iterator If you pass data back, use ViewObject Iterator binding, to get view object, then get current row, binding, to get view object, then get current row, and set desired values.and set desired values.

Page 25: JSF (ADF) Case Studies Presentation

af:table drop-down listsaf:table drop-down lists

Should have dynamic, data-bound, drop-Should have dynamic, data-bound, drop-down list in an af:table, instead of LOV’sdown list in an af:table, instead of LOV’sRan into problems in many cases using the Ran into problems in many cases using the

ListBinding. ListBinding. Blank List; could not find value in listBlank List; could not find value in listUsed af:forEach component instead with nested Used af:forEach component instead with nested

af:??? “option” component. (Do not use backing af:??? “option” component. (Do not use backing bean components for these).bean components for these).

Need to enable row-level Java implementation Need to enable row-level Java implementation class for the “forEach” view. class for the “forEach” view.

ViewObject row attributes start with lower-caseViewObject row attributes start with lower-case

Page 26: JSF (ADF) Case Studies Presentation

HintsHints

You can use transient views like forms You can use transient views like forms “control” blocks.“control” blocks.Single “header” row that applies to af:table Single “header” row that applies to af:table

child rowschild rowsaf:table below with row create capabilitiesaf:table below with row create capabilities

FacesContext can get current page nameFacesContext can get current page nameManaged bean (faces-config.xml) Managed bean (faces-config.xml)

instances in your app are accessible with instances in your app are accessible with ValueBindings.ValueBindings.

Page 27: JSF (ADF) Case Studies Presentation

My Future GoalsMy Future Goals

Create my own custom JSF componentsCreate my own custom JSF components Continue working with ADF.Continue working with ADF. Learn JDev (10g and 11g) ADF programming Learn JDev (10g and 11g) ADF programming

intricaciesintricacies In corporate more and more best practices forIn corporate more and more best practices for

JavaJava ADFADF CMCM Code SharingCode Sharing

Page 28: JSF (ADF) Case Studies Presentation

Questions?Questions?

Have fun at Training Days!!Have fun at Training Days!!Read my paper (if you have not)Read my paper (if you have not)My email is My email is [email protected]@graebel.comSee paper for bibliography/resources on See paper for bibliography/resources on

RMOUG web page, events section (…to RMOUG web page, events section (…to be available within the next couple of be available within the next couple of weeks.) weeks.)