Sumário Itens Encontrados: 512Preface 1Chapter 1: Getting Started with Oracle ADF 7Introduction to Oracle ADF 7Why Oracle ADF? 8Oracle ADF architecture 9View layer 11Controller layer 11Model layer 11Business services layer 12Comparing the Fusion web application technology stack tothe Java EE web application 12View layer 13Controller layer 13Data binding layer 14Business service layer 14Developing with ADF 15Setting up the development environment 15Picking up the tool for development 15Setting up the Software Configuration Management tool 16Build tool 16Team collaboration 17Taking a quick tour of the JDeveloper IDE 18Your first Fusion web application 20Starting JDeveloper IDE for the first time 20Picking up the right application template 21Analyzing the generated metadata files 23Connecting to the database 25What happens when you create a database connection? 25Generating the data model and business services 26Building entity objects to persist your business data 26Building view objects to shape your business data 29Building an application module to facade your business service implementation 30What is there in your model project source now? 33Building user interfaces from the model 34What have you got in your view controller project source now? 36Deploying and running the application 37Running the application using an integrated webLogic server 37Running the application on a standalone application server 38Summary 38Chapter 2: Introduction to ADF Business Components 39Business service layer 40Why ADF Business Components? 40Overview of ADF Business Components 41Oracle ADF Business Components feature list 41Core building blocks 42Entity objects 43Associations 44View objects 44View links 44Row sets 45Query collections 45Application modules 45Services and service data objects 46Building a simple business service 46ADF Business Components configuration files 49Oracle ADF Model Tester 50Using the ADF Model Tester to test the CRUD operationson business data 52Testing business methods 52Java test client for ADF Business Components 53Understanding the runtime behavior of ADF Business Components 55Roles and responsibilities of the view object, row set,and query collection 55A closer look at query collection 56What happens when you execute an entity-based view object? 58What happens when you commit a transaction? 60Summary 62Chapter 3: Introducing Entity Object 63Introduction 63Ingredients of an entity object 64Runtime collaboration between business components 65Core features of ADF entity objects 66Developing entity objects 66Creating a database connection 66Initializing the ADF model project 67Creating entity objects 67Choosing the database object type 68Generating Java classes for entity components 69Commonly used properties of an entity attribute 70Attribute names in an entity object 71Attribute types in an entity object 72Using a resource bundle to localize UI hint properties 73Property set 74Persistent and transient attributes 76Specifying a default value for an entity attribute 76Effective dated entity objects 78Defining the primary key 79Inheritance hierarchies in entity objects 80Updatability of entity attributes 83Refreshing attributes on posting changes to the database 83Marking an attribute as mandatory 84Checking data inconsistency by using the Change Indicator attribute 84Queriable attributes 84Tracking change history 85Configuring UI hints for an attribute 86Specifying dependency attributes 86Commonly used properties of an entity object 86Setting an alternate key for an entity object 86Specifying custom properties 87Defining entity association 88Retaining the association accessor row set 91Adding validation 92Concurrent access and locking 95Securing entity objects 98Enabling a batch update in an entity object 98Working with entity objects 98Programmatically creating an entity instance 98Entity object in a transaction post cycle 100Summary 103Chapter 4: Introducing View Object 105Introduction 105Concepts and architecture 105Ingredients of a view object 106Core features of ADF view objects 108Developing view objects 108Creating view objects 108Using the Create View Object wizard 109Creating a view object with entity usage mapping 110Creating a view object with SQL query 113Creating a view object with static list 114Creating a programmatic view object 114Creating a declarative SQL mode view object 114Optionally generating Java classes for a view object 116Commonly used properties of view objects 117Annotate attributes using UI hints 118Adding business rules 119Working with view objects 120List of values 120Configuring the list of values 120Linking two view objects 122Where clause and Reverse Where clause 122Inheritance hierarchies in view objects 123Inheritance hierarchies in view objects with non-polymorphic entity usage 123Inheritance hierarchies in view objects with polymorphic entity usage 123Querying the datasource by using a view object 125Specifying the query mode for a view object 126Adding WHERE clause to a view object 128Using bind variables 129Changing the query of a view object at runtime 131Programmatically sorting view object rows 132In-memory filtering of row sets 132View criteria 136Effective dated view objects 142Using alternate keys in a view object 143Using findByKey() on view objects 144Creating new rows through the view object 145Creating child rows in composition association 145View link consistency 147Configuring view link consistency 147How view link consistency works 148Why does view link consistency fail when you add a dynamic WHERE clause? 149What happens when you execute a view object? 151Summary 155Chapter 5: Advanced Concepts on Entity Objectsand View Objects 157Taking a closer look at entity objects 157Lifecycle of an entity object 158Reading the current state of an entity row 161Reading the originally retrieved attribute value 162Retrieving all entity instances in the cache 163Lifecycle callback methods of an entity object 163What happens when a new entity instance is created? 164What happens when an entity instance is modified or removed? 166What happens when the transaction is committed? 167Building programmatically managed entity objects 170Generating a database independent unique ID 172How does unique ID sequencing work 172Using middle tier generated unique keys 172Refreshing entity rows, forgetting the changes 173Building custom history types 175Taking a closer look at view objects 177Lifecycle callback methods of a view object 177What happens when a client invokes executeQuery() on a view object instance? 178Count queries in a view object 180Building programmatically managed view objects 180Intercepting query generation for view criteria 181Using a custom view criteria adapter 182Overriding getViewCriteriaClause(boolean forQuery) in the view objectimplementation class 183Overriding getCriteriaItemClause(ViewCriteriaItem vci) in the view objectimplementation class 184Tips on overriding getViewCriteriaClause() and getCriteriaItemClause()in the view object implementation 186Customizing the query at runtime 186Customizing the query for a row set 187Customizing the query for a view object 187Passing parameters to a SQL IN clause using oracle.jbo.domain.Array 188Using oracle.jbo.domain.Array as a NamedWhereClauseParam value 189Using oracle.jbo.domain.Array as a bind variable value for a view criteria item 190Defining a cascading list of values 193Switching the LOV at runtime 197Reading and writing XML data 199Advanced data type techniques 202Building custom data types using domain type 202Working with BLOB and CLOB data types 204BLOB and CLOB support for alternate databases 207Building business components dynamically 208Building dynamic entity objects and view objects 208Steps for building entity definition at runtime 210Steps for building a view definition with entity usage at runtime 212Personalized business components 215Summary 217Chapter 6: Introducing the Application Module 219Introduction 219Concepts and architecture 220Ingredients of an application module 220Additional core components 221The core features of an application module 222Defining an application module 223Creating application modules 223Optionally generating Java classes for an application module 223Adding hierarchical view object instances to an application module 224Overriding the default properties of an application module 225Commonly used application module configuration properties 227Modifying the JDBC data source name for an application module 229Overriding properties for a view object instance 230Declaratively applying view criteria to a view object instance 230Sharing application module data 230An alternative option to define a shared application module 232Runtime behaviour of shared application modules 232Query execution for a shared view object 233Shared query collection cache management 233The maximum weight of the query collection pool 234Query collection weight 235Consuming a shared application module 235Accessing view objects defined in a shared application module througha view accessor 235Associating view criteria with shared application module instances 238Nesting application modules 238Accessing a nested application module from the parent 240Working with an application module 240Exposing the business service method through data control 241Where do you write custom business logic in a fusion web application? 242Invoking an application module from a Java client 243Invoking a shared application module from a Java client 244What you may need to know about programmatically releasingan application module? 245What happens when a client creates an application module instance? 245The lifecycle of an application module 247Passivation activation of application modules 250Programmatic passivation and activation of custom data 250Storing business data at user session level 251Using a transient view object 251Using a user session data map 252Using a client bound session map object 253Using JDBC APIs in an application module 253Using save points for undo operations 256Programmatically configuring an application module 257Programmatically building a master-child view object 259Using ADF Business Components with Java EE components 260Summary 262Chapter 7: Binding Business Services with the User Interface 263Introduction 263Binding model data with user interfaces 264Building a simple data bound web page 266Is a view object really a data collection? 268What happens when we drop a data collection on a page? 270Taking a closer look at the ADF Model metadata files 271adfm.xml 272DataBindings.cpx 273adf-config.xml 274adf-settings.xml 275Browsing through the page definition file 275Parameters 275Executables 275Bindings 277Using the binding editor 278Programmatically accessing page binding elements 279Accessing binding container 279Programmatically accessing the parameter binding 280Programmatically executing method action binding 280Accessing the list control binding 282Accessing the attribute binding 283Accessing the iterator binding and associated view object 283What happens when you access a Fusion web page? 284Invoking an application module from a Java servlet 291Using Configuration::createRootApplicationModule() in HttpServlet 291Using ADF binding APIs in an HttpServlet 293Adding custom phase listeners 295Summary 296Chapter 8: Building Data Bound Web User Interfaces 297Introduction 297The art of laying out pages 298Organizing page contents â a case study 300Adding actions to your page 303Choosing between the managed bean method and the data controlmethod as event handlers 303Using managed bean methods as event handlers 304Using data control methods as event handlers 304Building data bound table UIs 307What happens when you drop a data collection as a table on a page? 308Commonly used attributes of iterator bindings 309What happens at runtime in a data bound table? 311Adding edit functionalities for a table 311Creating a new row 311Deleting a row 313Committing changes 313Programmatically accessing a selected row from a table 313Declaratively reading the attribute value from the currently selected row 315Building data bound master-detail UIs 316Building a master-detail data model 316Building a master-detail UI 316What happens at runtime in the master-detail UI? 317Building a data bound tree table UI 317Building hierarchical view objects 317Creating a tree table UI 318What happens when you drop a data collection as a tree table on a page? 320Decorating the tree table UI 321What happens at runtime in a data bound tree table? 322Synchronizing UIs using the target data source 323What happens at runtime in the target data source? 324Adding edit functionalities for a tree table 325Configuring the parent view object to retain the view link accessor row set 325Creating utility methods for reading RowIterator and selected RowKey forthe selected node 325Implementing create and delete methods in the application module 328Creating a new row 330Deleting a row 330Programmatically refreshing the tree hierarchy 331Accessing web tier values from business components 332Using ADFContext to access client specific scoped variables 332How does ADFContext provide uniform access across layers? 332The pitfalls of using ADFContext 333Passing web tier values as parameters to business service methods 333Establishing a channel for passing web tier values to the business service layer 333Using the user session data map to store values passed from the client 333When should the client invoke the method that takes web tier values? 334Making the user session data map passivation safe 334Building data bound query search forms 334Building the view criteria 335Using UI hints to control the display for a query component 337Building a search UI 338What happens when you drop a view criteria as a query component on a page? 338Commonly used properties of the search region binding 339Initializing criteria item values using web tier values 340Programmatically controlling the display of a query component 342Programmatically retrieving view criteria used for a query component 344Programmatically resetting a query component 346Search on a tree table 346What happens at runtime in a tree table search? 348Building a data bound multi select list 348Programmatically accessing selected rows 349Overriding UI hints in a view object 349Summary 352Chapter 9: Controlling the Page Navigation 353Introduction 353The navigation model in the JSF framework 354Rule based navigation 354Implicit navigation 355How does implicit navigation work? 355The navigation model in ADF 356The ingredients of an ADF task flow 357Task flow configuration files 357ADF managed beans 358What you need to know while using managed beans in JSF code? 361Task flow activities 361View activity 362URL view activity 366Method call activity 368Router activity 370Save point restore activity 371Task flow call activity 376Task flow return activity 376Parent action 377Building an unbounded task flow 378Using a managed bean to return a dynamic outcome for a navigation component 380Conditionally executing a control flow case 380Improving the readability of control flow cases 380Adding an exception handler 381Customizing the default exception handler 382Building a custom javax.faces.context.ExceptionHandler 382Using method call activity to initialize a page 385Building a task flow with method call activity 386What happens at runtime? 387Building a menu model 388Summary 388Chapter 10: Taking a Closer Look at the Bounded Task Flow 389Introduction 390The properties of a bounded task flow 390Building a bounded task flow 394Working with bounded task flow activities 395Marking an activity as the default activity 395Marking an activity as an exception handler 396Calling a bounded task flow using the task flow call activity 396Using dynamic task flow calls 398Commonly used properties for a task flow call activity 399Using remote task flow calls 400Parameterizing a bounded task flow 403Defining a task flow input parameter 403Specifying input parameter values for a task flow 403Defining the task flow return value 406Reading a return value from a task flow 406Consuming bounded task flows as ADF regions 408Dynamically displaying the task flow 409Lazy loading of an ADF region 410Refreshing an ADF region 411Displaying task flows using a pop up component 412Lazy activation for a task flow when displayed in a pop up 413Using a contextual event for communicating to an ADF region 414Contextual event model 414Using a contextual event 415Defining an event publisher 416Defining an event subscriber 418Contextual event propagation at runtime 422Dynamically adding multiple regions to a page 422Distributing ADF task flow as the ADF library 426Packaging the task flow into the ADF library 427Consuming task flows added into an ADF library 427Using a train component in a bounded task flow 428Creating a train in a bounded task flow 429Setting display names for train stops 430Customizing the display for train stops 430Programmatically navigating between train stops 432Executing methods while navigating between train stops 432Transaction management in a bounded task flow 434What happens at runtime? 435Programmatically managing transactions for a task flow 436The life span of a bounded task flow 437Summary 438Chapter 11: More on Validations and Error Handling 439Introduction 439Adding validation rules in a fusion web application 440Defining validations in the ADF view layer 441Defining a custom ADF Faces validator 442Defining validations in the ADF model layer 446Defining validations in the ADF Business Components layer 447Validations using custom domain objects 448Where to put validation in a Fusion web application 454Displaying validation exceptions on a page 454Where in the page lifecycle does validation occur? 455Client-side validation 455Server-side validation 456Error handling in ADF 457Taking a closer look at DCErrorHandlerImpl 459Programmatically throwing validation exceptions in business components 461Localizing validation error messages 462Resource bundle usage in entity objects and view objects 462Resource bundle usage in the application module 462Reading the resource bundle definition from the business component 464Programmatically throwing validation exceptions 464Building a validation exception using message strings from the resource bundle 465Validation class hierarchy 466Wrapping exceptions 467Programmatically throwing multiple RowValException 468Programmatically throwing AttrValException 471Customizing default business component error messages 473Step1: Creating and registering a custom message bundle 473Step 2: Customizing the DCErrorHandlerImpl 474Step 3: Registering the CustomErrorHandler 476How does the CustomErrorHandler implementation work? 476Skipping validation 477Skipping validations in the ADF Faces layer 477Skipping validations in the business components 478Summary 479Chapter 12: Oracle ADF Best Practices 481Introduction 481Setting up the project structure for your Fusion web application 482Single application workspace comprising of multiple projects â monolithic approach 482Multiple application workspaces controlled by a single masterapplicationâ microkernel approach 483Guidelines for setting up the application source using the microkernel approach 484How to avoid cyclic dependency between modules 486The life span of ADF Business Components 488Life span of an application module 488How the framework allocates an application module for serving a client request 489More configuration options for an application module 491When an application module is removed from the pool 492Life span of a view object, row set, and query collection in a regular application module 493The query collection cache and view accessor row set 495The life span of entity objects 496What if you want to clear an entity cache at specific points in time? 496The life span of row sets in a shared application module 497The life span of binding objects 498The best practices and performance tuning for Oracle ADF 499Tuning tips for an application module 499Tips for optimizing an application module initialization 499Tips for optimizing resource usages in an application module 501Tips for fine-tuning the JDBC API use 502Coding guidelines for application modules 503Tuning tips for view objects 505Tips for optimizing query execution in a view object 505Tips for optimizing database read operations 506Tips for setting a global row fetch limit for view objects 507Tuning view criteria in view objects 508Tips for optimizing LOV definitions 509General tips for tuning view objects 510Coding guidelines for view objects 511Tuning tips for entity objects 518Design guidelines for entity objects 518Tips for validating entity objects 518General tips for tuning entity objects 519Coding guidelines for entity objects 521Tuning tips for ADF model 522Tips for tuning executable bindings 522Tips for optimizing data traffic between a binding layer and business components 524Tips for optimizing count query executions 525Coding guidelines for ADF binding APIs 525Tuning tips for ADF Controller and task flows 527Tips for optimizing resource usage in a task flow 528General guidelines for building successful task flows 528Coding guidelines for managed beans 530Tuning tips for ADF Faces 530General tips for ADF Faces pages 531Best practices for ADF Faces UI components 532Internationalization of Fusion web applications 533Configuring the time zone for a Fusion web application 533Ensuring high availability for Fusion web applications 535How does a bean data control participate in session replication in high availability mode? 538Summary 540Index 541How does a bean data control participate in session replicationin high availability mode? 538