Monday, March 10, 2014

How to create deploy and reuse the taskflow/datacontrol as a library in Oracle ADF application? How to Reuse taskflow of one application in another in ADF?

Many a times we might need to use the taskflow or datacontrol of one ADF application in another. For example if there is an application module with much of business functionality then we might want to reuse the entire AM in another application. This can be achieved in many ways. One way is to create a library out of the ADF application and deploy it and reuse it as an artifact in another application. The following approach explains this.

Step1: Create the library out of ViewController project application

  1. Double click the view controller project
  2. In the project properties dialog, click the Deployment section
  3. Create a new deployment profile by clicking the New option
  4. In the archive type select the ADF library jar file as shown below



ADF libraries is a Java Archive (JAR) file concept in ADF that contains a specific manifest file that allow Oracle JDeveloper to detect and import reusable components so they show in the ADF Component palette.

Step2: Deploy the taskflow/UI project using the newly created deployment profile

Now that we have created the deployment profile, we will deploy the project and its artifacts as the ADF library so that it can be imported and used in another application. Deployment is done as below









Step3: Import the deployment in another application
  1. Create the file system connection in the resource palette to point to that directory as shown below. Give some connection name and in the directory path, point to the jar file deployed directory 
  2. Select the deployment and say add to the project as shown below.


  1.  
  2. On doing that we observe the new data control and the new connection are also imported to the current project. 
  3. We can thus use the service methods from the imported data control
  4. We can also observe in the below image about how to import the region from the imported library from the component palette




One important thing to note is the naming convention here. If the package names are same in the imported library and the current project then we will have the naming conflicts and the fucntionality will not work as expected. The better naming convention is to com.project_name.resource_package

No comments:

Post a Comment