Sunday, August 24, 2014

Seeded Customizations using MDS in Oracle ADF

In the last post Personalization using MDS in Oracle ADF we saw the power of MDS Framework in Oracle ADF using which Users can personalize pages, components etc according to their own need. MDS saves these changes in MDS Store based on every user and applies on the runtime to the base document.

In Personalization, user is at the driver seat , changing things according to the needs. But there are cases where the application is developed and after there is a requirement of two different flavours of the same application. For example, there is a ADF application and there are two clients. One client wants some fields to be visible and some specific color settings while other client wants other fields to be hidden and different color settings. We can also put in this way, that one client want some regions (task flows) to be displayed and other client says other regions to be displayed.

Now in these cases the , making changes to the existing application will be difficult. Most common solution will be we create two versions of application , each version having specific changes required by the client. Hmm that works good for two clients but what will happen if there are hundreds, thousands of clients. One has to create / maintain same number of versions of applications. More to it, what will happen if there will be a common functionality change which needs to go to all versions. Maintenance will become a nightmare.

So by using Seeded Customizations provided by MDS, changes for specific needs / clients can be done on base document. There will be a single Base Application and changes corresponding to all the clients/layers will be done and these changes will be applied on runtime depending upon which client is using it..


Use Case :
There is a requirement that there is a ADF application which has one ADF Form on the page. There are two clients "ABCCorp" and "XYZCorp" which will be going to use this application. ABCCorp does not want to show Salary attribute to its users and want Employee ID to be in color "AQUA":

XYZCorp wants to show salary component to users and wants Employee ID background to be in color "LIME"

Lets get started with this Use Case :
Created a simple ADF Applications in Jdev 11.1.1.7 . Created ADF BC using HR schema with Employee EO and VO and AppModule.

In the VC Project, created a simple jspx page and used EmployeeVO to create a af Form.

Now we have a basic application with a form. We need to start customizing the application for both ABCCorp and XYZCCorp.

First step will be to enable Seeded Customizations in the projects.

This is done by ViewController -> Properties -> ADF View -> Enable seeded customizations.




Now the next and most important step is to create Customization Layer which will return the Name of the client, whether it is ABCCorp or XYZCorp.

So let us create a Customization class ClientCC which extends oracle.mds.cust.CustomizationClass provided by framework.



Now when you extends from CustomizationClass, one has to override these three methods. I will explain these methods and how to implement them in my next post. For now consider that getName method returns the name of CC layer and getValue method returns the current layer value. Here we are reading the value of client Name from Initialization Parameter in web.xml . If that parameter is set to ABCCorp, getValue method returns ABCCorp and so on.

Now we need to add this Customization Layer Class ClientCC to our application. But to make this class available, the project containing it needs to be deployed as ADF Shared jar and placed at <Jdev Home>/jdeveloper/jdev/lib/patches.





So after placing this jar to above path we are good. Now lets add this class to adf-config.xml.
adf-config.xml -> MDS Configuration


Now project is added with ClientCC Layer Class. Our setting in project is done.

Next step is to modify CustomizationLayerValues.xml . This file is available at <JdevHome>/jdeveloper/jdev
This XML file basically defines the design time values which can be returned from getValue method of CC class.

Add below XML to CustomizationLayerValues.xml

<cust-layers xmlns="http://xmlns.oracle.com/mds/dt">
    <cust-layer name="client" id-prefix="s">
        <cust-layer-value value="ABCCorp" display-name="ABCCorp" id-prefix="ABCCorp_"/>
<cust-layer-value value="XYZCorp" display-name="XYZCorp" id-prefix="XYZCorp_"/>
</cust-layer>
</cust-layers>


As one can see, there are two values defined ABCCorp and XYZCorp. This means when Jdev is open for customizations, these two values will be shown and one can select the values and make necessary changes for that value. Same these two values will be returned by getValue method of ClientCC class. Thus changes done to any value will be applied to the Layer returned by ClientCC get value method.

Next step is to open Jdeveloper in Customization Role. For doing this, go to Tools -> Preferences -> Roles -> and select option "Always prompt for role selection on startup".


After OK Restart the Jdev.

On Restarting, you will be prompted for the role. Select Customization Developer.



Jdeveloper will be opened in Customization Developer role and there will be a window , Customization Context in which by default one Value from CustomizationLayerValues.xml will be selected.



Now whatever changes one does, applies to this value returned by the layer. When ABCCorp is selected in Customization Context window -> Tip layer, whatever changes are applied on base application are for ABCCorp client.

Lets open our JSPX page which has Form.

Remember, there will be many things, component which will be read only. One cannot modify things which are core functionality of base document. Only things related to behaviour that can be customize will be editable. Also one can add new component for this particular value  

As per the requirement, on clicking on EmployeeId attribute of the form, we set the back ground color as aqua.


And made the Salary attribute of the form Render as false because ABCCorp does not want to show Salary Component.


We are done with change to ABCCorp. Save and close the jspx. Now select XYZCorp from Customization Context window and again open the JSPX.



For EmployeeID, XYZCorp needs background color as Lime, and Salary attribute should be visible.



Great we are all done. The only thing left is setting In Parameter. Lets first set it to ABCCorp. Restart jdeveloper in Default Role. Open Web.xml. Enter ClientName as "ABCCorp".




Now lets run the the JSPX page.

We can see that page comes up according to ABCCorp. Employee Id background is AQUA and Salary attribute is not visible.

Now lets change Parameter in Web.xml to XYZCorp.



Save and run the page again. 

Page Comes up according to XYZCorp. EmployeeId background is Lime and Salary attribute is Visible.

Also if we see the project structure , there is a folder MDSSYS created in View Controller project which has two folders ABCCorp and XYZCorp and they consist of CommonCorpPage.jspx.xml which is our JSPX. So these folders contains all the customized artifacts values in form of XML and are applied on runtime to the base document.

Thats it. By using powerful features of MDS provided by ADF, Customizations of the applications can be done according to specific requirements.

Thanks !!





38 comments:

  1. It would be great if you post the sample application.

    ReplyDelete
  2. Hi Sfti,

    Updated the post with link to sample application. You can download the same.

    Thanks
    Rohan

    ReplyDelete
  3. Thanks Rohan. I get MDS-00035: cannot load the class: view.ClientCC. error when I re-open jdev with Customization Developer role. Also, both the options are disabled in the Customization Context window.

    ReplyDelete
  4. Hi Sfti, As described in the post, you need to create a jar file of ViewController project and place it in /jdeveloper/jdev/lib/patches. And you in customization role, add values to Customizationlayervalues.xml as described in post.

    Thanks

    ReplyDelete
  5. Hi Rohan, thanks for your post, it is very useful and clear.

    I have a question about the deploy of this customizations. I have understood that this customizations are packaged in a .MAR file within the EAR. Is it possible deploy new customizations in production environment dynamically without redeploy all the app? Have you ever tried this?

    Thanks!

    ReplyDelete
  6. Thanks bro for sharing I was looking for the same
    snapchat for pc free

    ReplyDelete
  7. Thanks for the such a Nice and useful post. The way you are putting things are very simple and creating interest to us.

    ReplyDelete
  8. A great information regarding Oracle ADF, it is interesting and people should understand easily who are looking to take certification course in Oracle ADF,Job Assistance and find out some more information in the site,Oracle ADF Online Training with free Demo class in USA | UK | INDIA | SINGAPORE | Australia | Canada.

    ReplyDelete
  9. can any tell me how to apply seeded customization's to the existing EAR file in weblogic server

    ReplyDelete
  10. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.

    rpa training in marathahalli

    rpa training in btm

    rpa training in kalyan nagar

    rpa training in electronic city

    rpa training in chennai

    rpa training in pune

    rpa online training

    ReplyDelete
  11. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Python training in usa
    Python training in marathahalli
    Python training in pune

    ReplyDelete
  12. Great Article… I love to read your articles because your writing style is too good,
    its is very very helpful for all of us and I never get bored while reading your article because,
    they are becomes a more and more interesting from the starting lines until the end.
    data science online training
    python online training
    uipath online training
    data science with python online training
    rpa online training

    ReplyDelete
  13. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article.
    angularjs online training

    apache spark online training

    informatica mdm online training

    devops online training

    aws online training

    ReplyDelete
  14. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
    Data science Course Training in Chennai | No.1 Data Science Training in Chennai
    RPA Course Training in Chennai | No.1 RPA Training in Chennai

    ReplyDelete
  15. Thanks for sharing very helpful information. I found another OCA Training in Greater Noida, site , they provide very helpful services.

    ReplyDelete
  16. Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up…

    Start your journey with SAP S4 HANA Simple Logistics Training in Bangalore and get hands-on Experience with 100% Placement assistance from experts Trainers @Softgen Infotech Located in BTM Layout Bangalore. Expert Trainers with 8+ Years of experience, Free Demo Classes Conducted.

    ReplyDelete
  17. I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts.

    Become an Expert In Python Training in Bangalore ! The most trusted and trending Programming Language. Learn from experienced Trainers and get the knowledge to crack a coding interview, @Softgen Infotech Located in BTM Layout.

    ReplyDelete
  18. Awesome,Thank you so much for sharing such an awesome blog...
    Informatica Training in Bangalore

    ReplyDelete
  19. I love reading a post that will make people think. guide Also, thank you for allowing me to comment!

    ReplyDelete
  20. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    web designing training in chennai

    web designing training in omr

    digital marketing training in chennai

    digital marketing training in omr

    rpa training in chennai

    rpa training in omr

    tally training in chennai

    tally training in omr

    ReplyDelete
  21. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site
    Best Oracle ADF Course in Bangalore

    ReplyDelete
  22. Thanks For sharing a nice post about all Course.It is very helpful and for us.
    Oracle ADF training in bangalore

    ReplyDelete
  23. last month he share is herbal medicine in some medical hospital and now he is well recognize as one of the best in West Africa, you don’t have to be sad any more or share your tears any more on this virus when the cure have already be find in 2013 if you want to get in touch with him in private contact him on his email dr.chalaherbalhome@mail.com Or you can visit his website on https://
    drchalaherbalhome.godaddysites.com or https://mywa.link/dr.chalaherbalhome

    ReplyDelete
  24. Set 3:
    Best Software Training Institute in Chennai | Infycle Technologies

    Title:

    Description:
    Train yourself in specific modules of any software to brush up your skills & shine in your career growth with the best software training institute in Chennai, Infycle Technologies. Infycle is the only Software Training Center in Chennai equipped with 150+ customized courses to serve the needs of the candidate's job profile requirements inclusive with the top job placements in the MNC's. Rather than just teaching the theories, our entire aim is aligned to make you a master by giving you the live hands-on training. Therefore, individuals will be asked to work on the live tasks & real-time use cases, that brings out the definite coder in you! To grab all these, call 7502633633 for a free demo.
    Best training in Chennai

    ReplyDelete
  25. Set 3:
    Grab Big Data Course in Chennai for making your career as a shining sun with Infycle Technologies. Infycle Technologies is the best software training center in Chennai, providing complete hands-on practical training of professional specialists in the field. It also offers numerous courses in the IT industry such as Oracle, Java, Python, AWS, Hadoop, etc. Once after the training, interviews will be arranged for the candidates, so that, they can set their career without any struggle. Of all that, 200% placement assurance will be given here. To have the best career, call 7502633633 to Infycle Technologies and grab a free demo to know more.
    best training institute in chennai

    ReplyDelete