- Oracle JDeveloper 11gR2 Cookbook
- Nick Haralabidis
- 603字
- 2021-08-20 15:53:00
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…
- 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 theSharedBC
business components project. - 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.
- 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
. - Now, repeat the same steps to create framework extension classes for the following components:
- Once you are done, your project should look similar to the following:
- 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.
- 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
- SQL Server 從入門到項目實踐(超值版)
- Mastering Visual Studio 2017
- Node.js 10實戰
- 數據庫原理及應用(Access版)第3版
- FFmpeg入門詳解:音視頻流媒體播放器原理及應用
- 零基礎學Java程序設計
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- 新一代SDN:VMware NSX 網絡原理與實踐
- Python Interviews
- Arduino可穿戴設備開發
- 跟戴銘學iOS編程:理順核心知識點
- SAP Web Dynpro for ABAP開發技術詳解:基礎應用
- MySQL數據庫應用實戰教程(慕課版)
- jQuery Mobile Web Development Essentials(Second Edition)
- Vue.js 3.x高效前端開發(視頻教學版)