Wednesday, December 23, 2009

View Criteria Inside ADF Library

I got a question from blog reader, if its possible to include VO with View Criteria into ADF Library and later reuse this View Criteria from another ADF BC project. Reader was facing problems, so as usual I developed sample working application and now posting it here.

Download working sample - ViewCriteriaReuse.zip. This application implements two ADF BC projects - ModelCommon and Model. Inside ModelCommon I created LOV VO for Departments and defined View Criteria to filter based on LocationId attribute:



View Criteria definition:



View Object from ModelCommon is imported into Model project, DepartmentsLovView in this case:



Now we came to that moment, where reader had problems. While defining LOV on DepartmentId attribute, he wasn't able to set View Accessor from shared VO. However, it should work fine, like it works here:



On runtime LOV is filtered accordingly:


2 comments:

Chris Muir said...

Hi Andrejus

Thanks for the post. There's a little missing detail here, so to help other readers.

When you create the AM in the master application via the AM Wizard, you can then select the VO (imported from the ADF Library) and expose it as a VO in the AM Data Model page. The missing bit of info is if the VO came not from the ADF Library but the same application, you could then in the AM Data Model page in the Wizard, with the VO selected, click the Edit button and select the View Criteria. However in the case of a VO imported via an ADF Library, the View Criteria don't display for some reason when using the AM Wizard.

The workaround is to expose the VO in the AM, close the Wizard, then reopen the AM Editor dialog. Again select the VO in the AM Data Model page then the Edit button, and now the View Criterias specified against the VO in the ADF Library will be available to use.

I'm guessing a bug has been lodged with Oracle for this one Andrejus?

Cheers,

CM.

Andrej Baranovskij said...

Hi Chris,

Ah, I didnt noticed this myself, thanks for update ;)

Andrejus