You are previewing Oracle ADF Real World Developer's Guide.
O'Reilly logo
Oracle ADF Real World Developer's Guide

Book Description

Become an ADF expert with essential tips n' tricks and case studies for leveraging your ADF applications

  • Full of illustrations, diagrams, and tips with clear step-by-step instructions and real-time examples.

    Get to know the visual and declarative programming model offered by ADF.
  • In depth coverage of ADF business components and ADF binding layer.

  • Teaches you the ADF best practices and fine-tuning tips.

In Detail

Oracle ADF in combination with JDeveloper IDE offers visual and declarative approaches to enterprise application development. This book will teach you to build scalable rich enterprise applications using the ADF Framework, with the help of many real world examples.

Oracle ADF is a powerful application framework for building next generation enterprise applications. The book is a practical guide for the ADF framework and discusses how to use Oracle ADF for building rich enterprise applications.

"Oracle ADF Real World Developer’s Guide" discusses ADF framework in detail. This book contains a lot of real life examples which will help developers to design and develop successful enterprise applications.

This book starts off by introducing the development environment and JDeveloper design time features. As you read forward, you will learn to build a full stack enterprise application using ADF. You will learn how to build business services using ADF, enable validation for the data model, declaratively build user interfaces for business service and enable security across application layers.

Table of Contents

  1. Oracle ADF Real World Developer's Guide
    1. Table of Contents
    2. Oracle ADF Real World Developer's Guide
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
      2. Why Subscribe?
      3. Free Access for Packt account holders
      4. Instant Updates on New Packt Books
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Getting Started with Oracle ADF
      1. Introduction to Oracle ADF
      2. Why Oracle ADF?
      3. Oracle ADF architecture
        1. View layer
        2. Controller layer
        3. Model layer
        4. Business services layer
      4. Comparing the Fusion web application technology stack to the Java EE web application
        1. View layer
        2. Controller layer
        3. Data binding layer
        4. Business service layer
      5. Developing with ADF
        1. Setting up the development environment
        2. Picking up the tool for development
          1. Setting up the Software Configuration Management tool
          2. Build tool
          3. Team collaboration
        3. Taking a quick tour of the JDeveloper IDE
      6. Your first Fusion web application
        1. Starting JDeveloper IDE for the first time
        2. Picking up the right application template
          1. Analyzing the generated metadata files
        3. Connecting to the database
          1. What happens when you create a database connection?
        4. Generating the data model and business services
          1. Building entity objects to persist your business data
          2. Building view objects to shape your business data
          3. Building an application module to facade your business service implementation
          4. What is there in your model project source now?
        5. Building user interfaces from the model
          1. What have you got in your view controller project source now?
        6. Deploying and running the application
          1. Running the application using an integrated webLogic server
          2. Running the application on a standalone application server
      7. Summary
    10. 2. Introduction to ADF Business Components
      1. Business service layer
        1. Why ADF Business Components?
      2. Overview of ADF Business Components
        1. Oracle ADF Business Components' feature list
        2. Core building blocks
          1. Entity objects
          2. Associations
          3. View objects
          4. View links
          5. Row sets
          6. Query collections
          7. Application modules
          8. Services and service data objects
      3. Building a simple business service
        1. ADF Business Components configuration files
      4. Oracle ADF Model Tester
      5. Using the ADF Model Tester to test the CRUD operations on business data
        1. Testing business methods
      6. Java test client for ADF Business Components
      7. Understanding the runtime behavior of ADF Business Components
        1. Roles and responsibilities of the view object, row set, and query collection
          1. A closer look at query collection
        2. What happens when you execute an entity-based view object?
        3. What happens when you commit a transaction?
      8. Summary
    11. 3. Introducing Entity Object
      1. Introduction
      2. Ingredients of an entity object
        1. Runtime collaboration between business components
      3. Core features of ADF entity objects
      4. Developing entity objects
        1. Creating a database connection
        2. Initializing the ADF model project
        3. Creating entity objects
          1. Choosing the database object type
        4. Generating Java classes for entity components
        5. Commonly used properties of an entity attribute
          1. Attribute names in an entity object
          2. Attribute types in an entity object
          3. Using a resource bundle to localize UI hint properties
            1. Accessing the resource bundle from the entity object class
          4. Property set
            1. Creating a property set
            2. Associating the property set with the entity object attributes
            3. Using custom properties in business logic
          5. Persistent and transient attributes
          6. Specifying a default value for an entity attribute
          7. Effective dated entity objects
          8. Defining the primary key
          9. Inheritance hierarchies in entity objects
            1. Creating inheritance hierarchies for entity objects
          10. Updatability of entity attributes
          11. Refreshing attributes on posting changes to the database
          12. Marking an attribute as mandatory
          13. Checking data inconsistency by using the Change Indicator attribute
          14. Queriable attributes
          15. Tracking change history
          16. Configuring UI hints for an attribute
          17. Specifying dependency attributes
        6. Commonly used properties of an entity object
          1. Setting an alternate key for an entity object
          2. Specifying custom properties
          3. Defining entity association
            1. Composition association
              1. Properties of composition association
          4. Retaining the association accessor row set
          5. Adding validation
            1. Adding a validation rule to an attribute
            2. Adding a validation rule to an entity object
            3. Transaction level validation
            4. Defining a custom validation rule
          6. Concurrent access and locking
            1. Configuring Locking Mode for an ADF application
          7. Securing entity objects
          8. Enabling a batch update in an entity object
      5. Working with entity objects
        1. Programmatically creating an entity instance
        2. Entity object in a transaction post cycle
      6. Summary
    12. 4. Introducing View Object
      1. Introduction
      2. Concepts and architecture
        1. Ingredients of a view object
      3. Core features of ADF view objects
      4. Developing view objects
        1. Creating view objects
        2. Using the Create View Object wizard
          1. Creating a view object with entity usage mapping
          2. Creating a view object with SQL query
          3. Creating a view object with static list
          4. Creating a programmatic view object
          5. Creating a declarative SQL mode view object
        3. Optionally generating Java classes for a view object
        4. Commonly used properties of view objects
          1. Annotate attributes using UI hints
          2. Adding business rules
      5. Working with view objects
        1. List of values
          1. Configuring the list of values
        2. Linking two view objects
          1. Where clause and Reverse Where clause
        3. Inheritance hierarchies in view objects
          1. Inheritance hierarchies in view objects with non-polymorphic entity usage
          2. Inheritance hierarchies in view objects with polymorphic entity usage
        4. Querying the datasource by using a view object
          1. Specifying the query mode for a view object
          2. Adding WHERE clause to a view object
            1. Appending the WHERE clause at design time
            2. Appending the WHERE clause at runtime
          3. Using bind variables
            1. Programmatically specifying the value for bind variables
          4. Changing the query of a view object at runtime
          5. Programmatically sorting view object rows
          6. In-memory filtering of row sets
            1. In-memory filtering with RowMatch
            2. In-memory filtering by overriding rowQualifies() in ViewObjectImpl
          7. View criteria
            1. Architecture of view criteria
        5. Effective dated view objects
        6. Using alternate keys in a view object
        7. Using findByKey() on view objects
        8. Creating new rows through the view object
          1. Creating child rows in composition association
        9. View link consistency
          1. Configuring view link consistency
          2. How view link consistency works
          3. Why does view link consistency fail when you add a dynamic WHERE clause?
        10. What happens when you execute a view object?
      6. Summary
    13. 5. Advanced Concepts on Entity Objects and View Objects
      1. Taking a closer look at entity objects
        1. Lifecycle of an entity object
        2. Reading the current state of an entity row
        3. Reading the originally retrieved attribute value
        4. Retrieving all entity instances in the cache
        5. Lifecycle callback methods of an entity object
          1. What happens when a new entity instance is created?
          2. What happens when an entity instance is modified or removed?
          3. What happens when the transaction is committed?
        6. Building programmatically managed entity objects
        7. Generating a database independent unique ID
          1. How does unique ID sequencing work
          2. Using middle tier generated unique keys
        8. Refreshing entity rows, forgetting the changes
        9. Building custom history types
      2. Taking a closer look at view objects
        1. Lifecycle callback methods of a view object
          1. What happens when a client invokes executeQuery() on a view object instance?
          2. Count queries in a view object
        2. Building programmatically managed view objects
        3. Intercepting query generation for view criteria
          1. Using a custom view criteria adapter
          2. Overriding getViewCriteriaClause(boolean forQuery) in the view object implementation class
          3. Overriding getCriteriaItemClause(ViewCriteriaItem vci) in the view object implementation class
          4. Tips on overriding getViewCriteriaClause() and getCriteriaItemClause() in the view object implementation
        4. Customizing the query at runtime
          1. Customizing the query for a row set
          2. Customizing the query for a view object
        5. Passing parameters to a SQL IN clause using oracle.jbo.domain.Array
          1. Using oracle.jbo.domain.Array as a NamedWhereClauseParam value
          2. Using oracle.jbo.domain.Array as a bind variable value for a view criteria item
        6. Defining a cascading list of values
        7. Switching the LOV at runtime
        8. Reading and writing XML data
      3. Advanced data type techniques
        1. Building custom data types using domain type
          1. Working with BLOB and CLOB data types
          2. BLOB and CLOB support for alternate databases
      4. Building business components dynamically
        1. Building dynamic entity objects and view objects
          1. Steps for building entity definition at runtime
          2. Steps for building a view definition with entity usage at runtime
        2. Personalized business components
      5. Summary
    14. 6. Introducing the Application Module
      1. Introduction
      2. Concepts and architecture
        1. Ingredients of an application module
        2. Additional core components
      3. The core features of an application module
      4. Defining an application module
        1. Creating application modules
        2. Optionally generating Java classes for an application module
        3. Adding hierarchical view object instances to an application module
        4. Overriding the default properties of an application module
          1. Commonly used application module configuration properties
        5. Modifying the JDBC data source name for an application module
        6. Overriding properties for a view object instance
          1. Declaratively applying view criteria to a view object instance
      5. Sharing of application module data
        1. An alternative option to define a shared application module
        2. Runtime behaviour of shared application modules
        3. Query execution for a shared view object
        4. Shared query collection cache management
          1. The maximum weight of the query collection pool
          2. Query collection weight
        5. Consuming a shared application module
          1. Accessing view objects defined in a shared application module through a view accessor
        6. Associating view criteria with shared application module instances
      6. Nesting application modules
        1. Accessing a nested application module from the parent
      7. Working with an application module
        1. Exposing the business service method through data control
        2. Where do you write custom business logic in a fusion web application?
        3. Invoking an application module from a Java client
        4. Invoking a shared application module from a Java client
        5. What you may need to know about programmatically releasing an application module?
        6. What happens when a client creates an application module instance?
        7. The lifecycle of an application module
          1. Passivation activation of application modules
          2. Programmatic passivation and activation of custom data
        8. Storing business data at user session level
          1. Using a transient view object
          2. Using a user session data map
          3. Using a client bound session map object
        9. Using JDBC APIs in an application module
        10. Using save points for undo operations
        11. Programmatically configuring an application module
        12. Programmatically building a master-child view object
        13. Using ADF Business Components with Java EE components
      8. Summary
    15. 7. Binding Business Services with the User Interface
      1. Introduction
      2. Binding model data with user interfaces
      3. Building a simple data bound web page
      4. Is a view object really a data collection?
      5. What happens when we drop a data collection on a page?
        1. Taking a closer look at the ADF Model metadata files
          1. adfm.xml
          2. DataBindings.cpx
          3. adf-config.xml
          4. adf-settings.xml
      6. Browsing through the page definition file
        1. Parameters
        2. Executables
        3. Bindings
        4. Using the binding editor
        5. Programmatically accessing page binding elements
          1. Accessing binding container
        6. Programmatically accessing the parameter binding
          1. Programmatically executing method action binding
        7. Accessing the list control binding
        8. Accessing the attribute binding
          1. Accessing the iterator binding and associated view object
      7. What happens when you access a Fusion web page?
      8. Invoking an application module from a Java servlet
        1. Using Configuration::createRootApplicationModule() in HttpServlet
        2. Using ADF binding APIs in an HttpServlet
      9. Adding custom phase listeners
      10. Summary
    16. 8. Building Data Bound Web User Interfaces
      1. Introduction
      2. The art of laying out pages
        1. Organizing page contents – a case study
      3. Adding actions to your page
        1. Choosing between the managed bean method and the data control method as event handlers
          1. Using managed bean methods as event handlers
          2. Using data control methods as event handlers
      4. Building data bound table UIs
        1. What happens when you drop a data collection as a table on a page?
        2. Commonly used attributes of iterator bindings
        3. What happens at runtime in a data bound table?
        4. Adding edit functionalities for a table
          1. Creating a new row
          2. Deleting a row
          3. Committing changes
          4. Programmatically accessing a selected row from a table
          5. Declaratively reading the attribute value from the currently selected row
      5. Building data bound master-detail UIs
        1. Building a master-detail data model
        2. Building a master-detail UI
        3. What happens at runtime in the master-detail UI?
      6. Building a data bound tree table UI
        1. Building hierarchical view objects
        2. Creating a tree table UI
          1. What happens when you drop a data collection as a tree table on a page?
          2. Decorating the tree table UI
        3. What happens at runtime in a data bound tree table?
          1. Synchronizing UIs using the target data source
          2. What happens at runtime in the target data source?
        4. Adding edit functionalities for a tree table
          1. Configuring the parent view object to retain the view link accessor row set
          2. Creating utility methods for reading RowIterator and selected RowKey for the selected node
          3. Implementing create and delete methods in the application module
          4. Creating a new row
          5. Deleting a row
        5. Programmatically refreshing the tree hierarchy
      7. Accessing web tier values from business components
        1. Using ADFContext to access client specific scoped variables
          1. How does ADFContext provide uniform access across layers?
          2. The pitfalls of using ADFContext
        2. Passing web tier values as parameters to business service methods
          1. Establishing a channel for passing web tier values to the business service layer
          2. Using the user session data map to store values passed from the client
          3. When should the client invoke the method that takes web tier values?
        3. Making the user session data map passivation safe
      8. Building data bound query search forms
        1. Building the view criteria
          1. Using UI hints to control the display for a query component
        2. Building a search UI
          1. What happens when you drop a view criteria as a query component on a page?
          2. Commonly used properties of the search region binding
            1. What is AutoQuery or ClearRowSet behavior?
        3. Initializing criteria item values using web tier values
        4. Programmatically controlling the display of a query component
        5. Programmatically retrieving view criteria used for a query component
        6. Programmatically resetting a query component
        7. Search on a tree table
        8. What happens at runtime in a tree table search?
      9. Building a data bound multi select list
        1. Programmatically accessing selected rows
      10. Overriding UI hints in a view object
      11. Summary
    17. 9. Controlling the Page Navigation
      1. Introduction
      2. The navigation model in the JSF framework
        1. Rule based navigation
        2. Implicit navigation
          1. How does implicit navigation work?
      3. The navigation model in ADF
      4. The ingredients of an ADF task flow
        1. Task flow configuration files
        2. ADF managed beans
          1. What you need to know while using managed beans in JSF code?
        3. Task flow activities
          1. View activity
            1. What document type should you choose while creating a JSF page?
            2. Bookmarking view activity
            3. Redirect URL
          2. URL view activity
            1. Specifying parameters for a URL view activity
            2. What happens when runtime invokes a URL view activity from a bounded task flow?
          3. Method call activity
            1. Using a managed bean method in method call activity
            2. Using data control operation in method call activity
          4. Router activity
          5. Save point restore activity
            1. Where are ADF Controller save points created?
            2. Using save points in a task flow
            3. What happens when you create an ADF Controller save point?
            4. Implicit save points
          6. Task flow call activity
          7. Task flow return activity
          8. Parent action
      5. Building an unbounded task flow
        1. Using a managed bean to return a dynamic outcome for a navigation component
        2. Conditionally executing a control flow case
        3. Improving the readability of control flow cases
      6. Adding an exception handler
        1. Customizing the default exception handler
          1. Building a custom javax.faces.context.ExceptionHandler
      7. Using method call activity to initialize a page
        1. Building a task flow with method call activity
          1. What happens at runtime?
      8. Building a menu model
      9. Summary
    18. 10. Taking a Closer Look at the Bounded Task Flow
      1. Introduction
      2. The properties of a bounded task flow
      3. Building a bounded task flow
      4. Working with bounded task flow activities
        1. Marking an activity as the default activity
        2. Marking an activity as an exception handler
        3. Calling a bounded task flow using the task flow call activity
          1. Using dynamic task flow calls
          2. Commonly used properties for a task flow call activity
          3. Using remote task flow calls
            1. What happens at runtime when a remote task flow is called?
            2. What you may need to know when you use remote task flow
      5. Parameterizing a bounded task flow
        1. Defining a task flow input parameter
        2. Specifying input parameter values for a task flow
        3. Defining the task flow return value
        4. Reading a return value from a task flow
      6. Consuming bounded task flows as ADF regions
        1. Dynamically displaying the task flow
      7. Lazy loading of an ADF region
      8. Refreshing an ADF region
      9. Displaying task flows using a pop up component
        1. Lazy activation for a task flow when displayed in a pop up
      10. Using a contextual event for communicating to an ADF region
        1. Contextual event model
        2. Using a contextual event
          1. Defining an event publisher
          2. Defining an event subscriber
            1. Defining an event handler method
            2. Subscribing to desired events
        3. Contextual event propagation at runtime
      11. Dynamically adding multiple regions to a page
      12. Distributing ADF task flow as the ADF library
        1. Packaging the task flow into the ADF library
        2. Consuming task flows added into an ADF library
      13. Using a train component in a bounded task flow
        1. Creating a train in a bounded task flow
          1. Setting display names for train stops
          2. Customizing the display for train stops
          3. Programmatically navigating between train stops
          4. Executing methods while navigating between train stops
      14. Transaction management in a bounded task flow
        1. What happens at runtime?
        2. Programmatically managing transactions for a task flow
      15. The life span of a bounded task flow
      16. Summary
    19. 11. More on Validations and Error Handling
      1. Introduction
      2. Adding validation rules in a fusion web application
        1. Defining validations in the ADF view layer
          1. Defining a custom ADF Faces validator
            1. Step1: Defining client-side validation in JavaScript
            2. Step 2: Defining the validator Java class
            3. Step 3: Configuring and using the validator
        2. Defining validations in the ADF model layer
        3. Defining validations in the ADF Business Components layer
          1. Validations using custom domain objects
            1. Creating and registering custom message bundles
            2. What you may need to know while using custom domain types on the UI
            3. When does the framework validate the custom domain object?
        4. Where to put validation in a Fusion web application
      3. Displaying validation exceptions on a page
      4. Where in the page lifecycle does validation occur?
        1. Client-side validation
        2. Server-side validation
      5. Error handling in ADF
        1. Taking a closer look at DCErrorHandlerImpl
      6. Programmatically throwing validation exceptions in business components
        1. Localizing validation error messages
          1. Resource bundle usage in entity objects and view objects
          2. Resource bundle usage in the application module
          3. Reading the resource bundle definition from the business component
        2. Programmatically throwing validation exceptions
          1. Building a validation exception using message strings from the resource bundle
        3. Validation class hierarchy
        4. Wrapping exceptions
        5. Programmatically throwing multiple RowValException
        6. Programmatically throwing AttrValException
      7. Customizing default business component error messages
        1. Step1: Creating and registering a custom message bundle
        2. Step 2: Customizing the DCErrorHandlerImpl
        3. Step 3: Registering the CustomErrorHandler
        4. How does the CustomErrorHandler implementation work?
      8. Skipping validation
        1. Skipping validations in the ADF Faces layer
        2. Skipping validations in the business components
      9. Summary
    20. 12. Oracle ADF Best Practices
      1. Introduction
      2. Setting up the project structure for your Fusion web application
        1. Single application workspace comprising of multiple projects – monolithic approach
        2. Multiple application workspaces controlled by a single master application– microkernel approach
          1. Guidelines for setting up the application source using the microkernel approach
        3. How to avoid cyclic dependency between modules
      3. The life span of ADF Business Components
        1. Life span of an application module
          1. How the framework allocates an application module for serving a client request
          2. More configuration options for an application module
          3. When an application module is removed from the pool
            1. Configuring the application module pool parameters – a case study
        2. Life span of a view object, row set, and query collection in a regular application module
          1. The query collection cache and view accessor row set
        3. The life span of entity objects
          1. What if you want to clear an entity cache at specific points in time?
        4. The life span of row sets in a shared application module
        5. The life span of binding objects
      4. The best practices and performance tuning for Oracle ADF
        1. Tuning tips for an application module
          1. Tips for optimizing an application module initialization
          2. Tips for optimizing resource usages in an application module
          3. Tips for fine-tuning the JDBC API use
          4. Coding guidelines for application modules
        2. Tuning tips for view objects
          1. Tips for optimizing query execution in a view object
          2. Tips for optimizing database read operations
          3. Tips for setting a global row fetch limit for view objects
          4. Tuning view criteria in view objects
          5. Tips for optimizing LOV definitions
          6. General tips for tuning view objects
          7. Coding guidelines for view objects
        3. Tuning tips for entity objects
          1. Design guidelines for entity objects
          2. Tips for validating entity objects
          3. General tips for tuning entity objects
          4. Coding guidelines for entity objects
        4. Tuning tips for ADF model
          1. Tips for tuning executable bindings
          2. Tips for optimizing data traffic between a binding layer and business components
          3. Tips for optimizing count query executions
          4. Coding guidelines for ADF binding APIs
        5. Tuning tips for ADF Controller and task flows
          1. Tips for optimizing resource usage in a task flow
          2. General guidelines for building successful task flows
          3. Coding guidelines for managed beans
        6. Tuning tips for ADF Faces
          1. General tips for ADF Faces pages
          2. Best practices for ADF Faces UI components
      5. Internationalization of Fusion web applications
        1. Configuring the time zone for a Fusion web application
      6. Ensuring high availability for Fusion web applications
        1. How does a bean data control participate in session replication in high availability mode?
      7. Summary
    21. Index