Book Image

Oracle JDeveloper 11gR2 Cookbook

By : Nick Haralabidis
Book Image

Oracle JDeveloper 11gR2 Cookbook

By: Nick Haralabidis

Overview of this book

Oracle's Application Development Framework (ADF) for Fusion Web Applications leverages Java EE best practices and proven design patterns to simplify constructing complex web solutions with JDeveloper, and this hands-on, task-based cookbook enables you to realize those complex, enterprise-scale applications. With the help of real-world implementations, practical recipes cover everything from design and construction, to deployment, testing, debugging and optimization. This practical, task-based cookbook takes you, the ADF developer, on a practical journey for building Fusion Web Applications. By implementing a range of real world use cases, you will gain invaluable and applicable knowledge for utilizing the ADF framework with JDeveloper 11gR2. "Oracle JDeveloper 11gR2 Cookbook"ù is a task-based guide to the complete lifecycle of Fusion Web Application development using Oracle JDeveloper 11gR2 and ADF.You will get quickly up and running with concepts like setting up Application Workspaces and Projects, before delving into specific Business Components such as Entity Objects, View Objects, Application Modules and more. Along the way you will encounter even more practical recipes about ADF Faces UI components and Backing Beans, and the book rounds off by covering security, session timeouts and exceptions.With "Oracle JDeveloper 11gR2 Cookbook"ù in hand you will be equipped with the practical knowledge of a range of ready to use implementation cases which can be applied to your own Fusion Web ADF Applications.
Table of Contents (19 chapters)
Oracle JDeveloper 11gR2 Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface

Setting up BC base classes


One of the first things to consider when developing large-scale enterprise applications with ADF-BC is to allow for the ability to extend the framework's base classes early on in the development process. It is imperative that you do this before creating any of your business objects, even though you have no practical use of the extended framework classes at that moment. This will guarantee that all of your business objects are correctly derived from your framework classes. In this recipe, you will expand on the previous recipe and add business components framework extension classes to the SharedComponents workspace.

Getting ready

You will be adding the business components framework extension classes to the SharedComponents workspace. See the previous recipe for information on how to create one.

How to do it…

  1. 1. To create framework extension classes for the commonly used business components, start with the creation of an extension class for the entity objects. Open the SharedComponents workspace in JDeveloper and right-click on the SharedBC business components project.

  2. 2. From the context menu, select New… to bring up the New Gallery dialog. Select Class from the Java category (under the General category) and click OK.

  3. 3. On the Create Java Class dialog that is displayed, enter the name of the custom entity object class, the package where it will be created, and for Extends enter the base framework class, which in this case is oracle.jbo.server.EntityImpl.

  4. 4. Now, repeat the same steps to create framework extension classes for the following components:

    Business Component

    Framework Class Extended

    Entity Definition

    oracle.jbo.server.EntityDefImpl

    View Object

    oracle.jbo.server.ViewObjectImpl

    View Row

    oracle.jbo.server.ViewRowImpl

    Application Module

    oracle.jbo.server.ApplicationModuleImpl

    Database Transaction Factory

    oracle.jbo.server.DatabaseTransactionFactory

    Database Transaction

    oracle.jbo.server.DBTransactionImpl2

  5. 5. Once you are done, your project should look similar to the following:

  6. 6. The next step is to configure JDeveloper so that all new business components that you create from this point forward will be inherited from the framework extension classes you've just defined. Open the Preferences dialog from the Tools menu, expand the ADF Business Components node, and select Base Classes.

  7. 7. Then enter the framework extension classes that you created previously, each one in its corresponding category.

How it works…

Defining and globally configuring business components framework extension classes via the ADF Business Components Base Classes settings on the Preferences dialog causes all subsequent business components for all projects to be inherited from these classes. This is true for both XML-only components and for components with custom Java implementation classes. For XML-only components observe that the ComponentClass attribute in the object's XML definition file points to your framework extension class.

There's more…

You can configure your business components framework extension classes at two additional levels: the project level and the individual component level.

  • Configuration at the project level is done via the Project Properties Base Classes selection under the ADF Business Components node. These configuration changes will affect only the components created for the specific project.

  • Configuration at the component level is done via the component's Java Options dialog, in the component's definition Java page, by clicking on the Classes Extend… button and overriding the default settings. The changes will only affect the specific component.

Note

Do not attempt to directly change or remove the extends Java keyword in your component's implementation class. This would only be half the change, because the component's XML definition will still point to the original class. Instead, use the Classes Extend… button on the component's Java Options dialog.

Finally, note that the default package structure for all business components can also be specified in the ADF Business Components | Packages page of the Preferences dialog.

See also

  • Creating and using generic extension interfaces, Chapter 5,Putting them all together:Application Modules.

  • Breaking up the application in multiple workspaces, in this chapter