Next ADF Training
Join Demo Session
Toggle Bar
  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Team Blogs
    Team Blogs Find your favorite team blogs here.
  • Archives
    Archives Contains a list of blog posts that were created previously.
  • Login
    Login Login form

How to add lov validation to oracle ADF BC webservice Part 2

Posted by on in ADF Webservices
  • Font size: Larger Smaller
  • Hits: 5178
  • 0 Comments
  • Subscribe to this entry
  • Print
  • Report this post

In the last post, I had walked you through the creation of simple ADF webservice which is based on the Departments table in XE database.There was no validation on the create or update method of the webservice in the previous version.There is a lot of chance that the caller of this webservice may send some junk data into your system through the webservice which doesn’t handle the validations properly.I have a lot of experience with my clients on this aspect :).

Also, the caller won’t know the ids in our system and most probably they will send the names(For Ex: Location id will not be known to the callers but they will know the Location Name).Instead of writing code to handle this kind of scenario, you can simply handle it by attaching the lov to the location id attribute.But this is tricky because locationid attribute is bigdecimal but how the caller will send the location name which is a string ??

Let me show the trick :)

First let us checkout the previous project from code.adfapps.com and build on top of it.

Step 1: Please verify that you have checked out the right project

o0s4w5ez

Step 2: Create an lov vo based on the locations table.

mbdfgvp1

jntom1si

zxhoeani

miiq2sss

Step 3 : Lets attach the lov to the VO Attribute, but we should not attach it to the Location ID attribute.Instead we should attach it to the new attribute called Location Name which is a calculated attribute.

aegjk4jw

pefn04py

1uk1ifg5

 

0kwzil0k

hkserwvo

zxcrhzos

Step 4: Once LOV is added to the Location name attribute, we can test our webservice by calling the updateDepartment method and pass the location name instead of the location id to verify the validated update to location id attribute.

unavwpr3

zebl4ile

v1hjgmqa

Note: Don’t forget to set the Location name attribute’s updatable property to “Always”

 It took some time to figure out this simple solution to handle list validation in ADF webservices.As usual, you can check out the code from code.adfapps.com website from the below url.

https://code.adfapps.com/svn/adfwebservices

adftraining/adftraining

Tag Name in SVN : WEBSERVICES_LOV_VALIDATION

© Creative Commons Attribution Assurance 3.0 License.
0
  • No comments found

Login