To break the rules you must first master them

ADF Namings Conventions – Part II

Hi all,

In my previous post ADF Namings Conventions – Part I I have focused my attention on:

  • Application & Project Namings
  • Packages Namings
  • Business Components Namings

Today I will start to talk about Model & View Controller Project namings.

 

Model Namings

For new ADF applications we are requested to set the names for Model and ViewController projects. In what concerns the Model it should following naming:

<PROJECT_NAME> + <MODULE_NAME> + Model

Example: RMKMyAdfLibModel

 

For the package structure it should be configured as follows:

<DOMAIN_NAME> + . + <PROJECT_NAME> + . + <MODULE_NAME> + . + model

Example: red.mavericks.rmk.my.adf.lib.model

 

As you can see, package structure follows the same structure defined in my previous post plus “model“.

View Controller Namings

In ViewController projects we have a wide range of namings we can follow since we have multiple features we can take advantage of. For that reason we divided it in sub topics. .

 

Project Name

 

The name for the project should be defined as follows:

<PROJECT_NAME> + <MODULE_NAME> + Controller

Example: RMKMyAdflibController

By using “Controller” prefix we are able to automatically identify projects type and purpose.

 

Project Default Package Structure

 

Package structure for View Controller project should be defined as follows:

<DOMAIN_NAME> + . + <PROJECT_NAME> + . + <MODULE_NAME> + . + view

Example: red.mavericks.rmk.my.adf.lib.view

As you can see, package structure follows the same structure defined in my previous post plus “view“.

 

Images, CSS and JavaScript Directories

 

Images, CSS and JavaScript directories should be defined right under “Web Content” folder. The folders should have the following names:

 

Folder Type Folder Path
 To contain images  resources/images
 To contain CSS files  resources/css
 To contain javascript files  resources/js

 

Example:

ImagesCssJavascript

 

Inside “web.xml” file in ViewController project set the following mappings:

<servlet-mapping>  
   <servlet-name>resources</servlet-name>  
   <url-pattern>resources/images/*</url-pattern>  
</servlet-mapping>  
<servlet-mapping>  
   <servlet-name>resources</servlet-name>  
   <url-pattern>resources/css/*</url-pattern>  
</servlet-mapping>  
   <servlet-mapping>  
   <servlet-name>resources</servlet-name>  
   <url-pattern>resources/js/*</url-pattern>  
</servlet-mapping>

 

Bounded Task Flows, JSFF, JSPX Directories

 

Reusable bounded task flows can be published in ADF Libraries and consumed by other ADF applications. For this use case is important, and a must, that all bound task flows have a unique name. If this isn’t accomplished ADF has no way to distinguish between task flows with the same name.

Before creating bounded task flows you should set a folder structure under “WEB-INF” folder. After this folder structure is created you can start creating your bounded task flows.

Folder structure should be created according to the following convention:

 

 <DOMAIN_NAME> + <PROJECT_NAME> + <MODULE_NAME> + view + <BUSINESS_AREA>

Example:

taskFlowsFolderStructure

JSF, JSFF and JSPX files must be saved on the same folder of the task flow.

Page definitions will be automatically generated with same package structure under Application Sources folder. Example: red.mavericks.rmk.my.adf.lib.view.financial or red.mavericks.rmk.my.adf.lib.view.retail

Managed Beans for Task Flows should be created under Application Sources folder with the following package structure:

<DOMAIN_NAME> + <PROJECT_NAME> + <MODULE_NAME> + <BUSINESS_AREA>

Example:

taskFlowsManagedBeans

 

We decided to create Managed Beans outside “view” package in order to not have a mixture between page definitions and java classes.

 

In my next post I will focus my attention on:

  • Task flows as well as Templates and some more regarding View Controller Projects
  • JAR, WAR, EAR files

 

Don’t miss my next post 🙂

Cheers,

Pedro Gabriel

@PedrohnGabriel

 

This is a cross post with LinkConsulting. For more Oracle Middleware related posts, please visit http://www.linkconsulting.com/oracle

Post Header photo by Lefteris Heretakis

3 replies
    • mm
      Pedro Gabriel says:

      Hi,

      The naming conventions provided are based on an existing document provided by Oracle and on my wide experience with ADF.

      Best Regards,
      Pedro Gabriel

      Reply

Trackbacks & Pingbacks

  1. […] my previous post ADF Namings Conventions – Part II I have focused my attention […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *