Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Thursday, November 8, 2012

Mass Refactoring ADF Application

There are occasions when you may need to refactor the entire adf application including model and view projects to align to certain standards based on your organizational requirements or as a developmental decision.

Dev guide already covers on how to refactor different BC4J and UI artifacts like entity objects, task flows etc. You may refer the fusion applications developer guide for the individual refactoring requirements at http://docs.oracle.com/cd/E15051_01/web.1111/b31974/refactoring.htm

However, doing this object based refactoring could be just too painful depending upon the size of your application and yes of course time consuming as well. So, to make a change everywhere like converting the package name com.mycompany.app.blawblaw  to com.mycompany.newapp.blawblaw it will be required to change all the references of app to newapp in all the application files and also to rename the physical directory structure of the directory app to newapp. Here, are the steps you may find useful:

Assumptions
1. Used jdeveloper 11g version 11.1.1.6.2
2. Used on windows 7
3. Your JDeveloper is closed (not essentially harmful to keep it open but not recommended)

1. Take a good backup of your application before you start. Source control is a good way. However, I will still recommend to take a physical backup by just copy paste the app folder to somewhere else. Sometimes, source control might get crazy to figure out mass changes from outside the jdeveloper.
2. Download a good search and replace tool like I used http://www.divlocsoft.com/index.htm
3. Browse the tool to the root of your adf workspace and do a search with a filter mask *.jpr; *.jpx; *.java; *.xcfg; *.xlf; *.xml; *.cpx; *.adfc_diagram;  *.dcx
4. Above will make sure to capture all the relevant files from workspace from model and view controller project. Then search and replace the following:

  • .app. to .newapp.   for fixing all the packages
  • _app_ to _newapp_ to fix databindings.cpx with correct usageIds 
  • /app/ to /newapp/ to fix taskflow path references etc
5. Once file content refactoring is done there comes a bit manual work. Now, you need to rename all the directories with name app to newapp

Now, start your jdeveloper and you should be all set. 
A point to not forget is to use jdeveloper based refactoring if there are very less number of artifacts and not really a need of moving jpx, jpr files etc.
Post a Comment