8 Refactoring Oracle ADF Components

OEPE provides refactoring options to rename, move, and delete the ADF components that your application uses. These refactoring options synchronize your changes with other parts of the application that are dependent on the changes.

8.1 Refactoring ADF Pages

This section describes the refactoring options available for ADF pages. The following table lists each refactoring operation and what components are consequently modified.

Refactoring operation Components modified
Renaming a page file
  • faces-config.xml
  • ADF task flow
  • DataBindings.cpx
Moving a page to a different folder
  • faces-config.xml
  • ADF task flow
  • databindings.cpx
Deleting a page file The corresponding page definition file and the entry for the page definition in the CPX file are deleted

Note: If there are invalid references, an error message is displayed

Deleting a folder containing a page The corresponding page definition files and the entries for the page definitions in the CPX file are deleted
Renaming a folder containing a page
  • faces-config.xml
  • ADF task flow
  • corresponding page definition file
  • databindings.cpx

8.2 Refactoring ADF Task Flow configuration files

The following table describes the refactoring options available for ADF task flow configuration files. The following content lists each refactoring operation and what components are consequently modified.

Refactoring operation Components modified
Renaming the task-flow-id tag of a bounded task flow
  • task-flow-call tag in the task flow configuration file
  • Page definition XML file of the page in which the task flow is embedded
Renaming the task flow configuration file
  • document tag in the task flow configuration file
  • Page definition XML file of the page in which the task flow is embedded.
Renaming the task-flow-activity id attribute for view and taskflow call activities References to task-flow-activity within the configuration file
Renaming task flow id ID reference in page definition
Renaming a folder containing a task flow
  • document tag in task flow configuration file
  • Page definition XML file of the page in which the task flow is embedded.
Moving a task flow
  • document tag in the task flow configuration file
  • Page definition XML file of the page in which the task flow is embedded.
Deleting a task flow Entry in page definition file deleted

8.3 Refactoring JSF/ADF Managed Beans

OEPE support for refactoring a Java class includes all changes except those noted in the following table, which lists each refactoring operation on managed beans and components consequently modified.

Refactoring operation on Managed Bean Components modified
Moving to a different package Class name in the managed bean definition in the corresponding configuration file
Deleting the Java class
  • No change to the definition of the bean in the configuration file
  • An error message warns you about invalid references
Renaming the name of the managed bean in the configuration file References to the managed bean in all pages
Deleting the name of the managed bean or the managed bean itself Reference to the managed bean in all pages
Renaming a property of the managed bean
  • Method or field in the managed bean class that corresponds to the property
  • Name of property in faces-config.xml
  • EL expression in JSP files
Renaming a Java class that is the type for a managed property in a JSF/ADF managed bean
  • Accessors on the property
  • Reference to the managed bean in all pages

8.4 Refactoring ADF Data Binding Artifacts

This section describes the refactoring options available for ADF data binding artifacts. The following table lists each refactoring operation and what components are consequently modified.

Notes:


Refactoring operation Components modified
Moving datacontrols.dcx to another package under the adfmsrc folder
  • datacontrolusages attribute in the DataBindings.cpx file
  • Reference to the .dcx file in META-INF/adfm.xml of the Model project
  • package attribute in the file
Renaming or moving a folder containing a data control file
  • datacontrolusages attribute in the DataBindings.cpx file
  • Reference to the .dcx file in META-INF/adfm.xml of the Model project
  • package attribute in the file
Changing the Id within a data control
  • path attribute in the data control usages section of the .cpx file
Moving DataBindings.cpx
  • Reference to the .dcx file in META-INF/adfm.xml of the Model project
  • package attribute in the file
Renaming or moving a folder containing an ADFm file (*.cpx)
  • Reference to the .dcx file in META-INF/adfm.xml of the Model project
  • package attribute in the file
Changing the data control ID in the data control usages section of an ADFm file (*.cpx)
  • DataControl attribute in associated page definition files
Renaming or moving a page definition file
  • Id attribute in the root element
  • Reference to the page definition file in the .cpx file
  • package attribute in the file
  • Page definition Id
Renaming or moving a folder containing a page definition file
  • Reference to the page definition file in the .cpx file
  • package attribute in the file
  • Page definition Id

8.5 Externalizing Strings

The string externalization feature in OEPE enables you to extract strings from JSF pages and externalize them in resource bundles. The strings are then substituted by the corresponding EL expression. By externalizing strings, the text can be translated in different languages.

To externalize strings:

  1. In the Project Explorer, right-click the page you want to extract strings from. In the context menu, choose Source > Externalize Strings.
  2. In the Externalize Strings dialog, select the strings you want to externalize. The Externalize Strings dialog contains the following options:
  3. Click Next.
  4. In the next page of the wizard, confirm the changes to be performed after reviewing the original source and the refactored source.
  5. Click Finish.

8.6 Adding and Refactoring ADF Tag IDs

If you have tags on your page with missing IDs, you can add and refactor your ADF tags using the Fix ADF Component IDs feature from your page editor.

To add and refactor ADF tag IDs

  1. With the focus on your page, right-click and choose Source > Fix ADF Component IDs...




  2. A refactoring diff window comes up and shows you the code before and after the refactor operation. Inspect the changes to ensure correctness, then click Finish.