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.

Refactoring ADF Pages

This section describes the refactoring options available for ADF pages. Table: Refactoring Options Available for ADF Pages lists each refactoring operation and what components are consequently modified.

Refactoring Options Available for ADF Pages

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


Refactoring ADF Task Flow configuration files

Table: Refactoring Options for ADF Task Flow Configuration Files 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 Options for ADF Task Flow Configuration Files

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


Refactoring JSF/ADF Managed Beans

OEPE support for refactoring a Java class includes all changes except those noted in Table: Refactoring Operations on Managed Beans, which lists each refactoring operation on managed beans and components consequently modified.

Refactoring Operations on Managed Beans

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


Refactoring ADF Data Binding Artifacts

This section describes the refactoring options available for ADF data binding artifacts. Table: Refactoring Operations and Modified Components lists each refactoring operation and what components are consequently modified.

Refactoring Operations and Modified Components

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


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:

    • Enter common prefix for generated keys: Specifies an optional prefix for all newly generated key. A good practice is to use the name of the JSF page to ensure that entries in the property files can be easily grouped.

    • Strings to externalize: Displays the list of all strings in the file.

    • Externalize: Marks the selected strings to be externalized. Externalized strings will be placed in a property file. In the code, the string is substituted by its corresponding EL expression.

    • Ignore: Marks the selected strings to be ignored from externalization.

    • Edit: Opens a dialog to enter a new value and key.

    • Context: Displays the occurrence of the string in the context of the page.

    • Bundle Property File: Select a property bundle file. If a properties file has not been created previously, OEPE creates called messages.properties.

  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.

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.