Showing posts with label View Accessor. Show all posts
Showing posts with label View Accessor. Show all posts

Thursday, April 7, 2016

ADF BC View Criteria Query Execution Mode = Both

View Criteria is set to execute in Database mode by default. There is option to change execution mode to Both. This would execute query and fetch results from database and from memory.  Such query execution is useful, when we want to include newly created (but not commited yet) row into View Criteria result. Newly created row will be included into View Criteria resultset.

Download sample application - ViewCriteriaModeApp.zip. JobsView in sample application is set with query execution mode for View Criteria to Both:


I'm using JobsView in EmployeesView through View Accessor. If data from another VO is required, you can fetch it through View Accessor. View Accessor is configured with View Criteria, this means it will be automatically filtered (we only need to set Bind Variable value):


Employees VO contains custom method, where View Accessor is referenced. I'm creating new row and executing query with bind variable (primary key for newly created row). View Criteria is set to execution mode Both, this allows to retrieve newly created row (not commited yet) after search:


View Criteria execution mode Both is useful, when we want to search without loosing newly created rows.

Friday, November 9, 2012

ADF BC View Accessor To Centralize Business Logic Processing

I was implementing today one use case, where it was required to compare current row status with the data returned by another query (no master-detail relationship). Such use case can implemented in many ways in ADF - custom method on AM with combination of expression on ADF UI, etc. I decided to go different path and centralize processing logic into VO itself by using View Accessor (same as LOV's are defined in ADF). This allows to simplify implementation part on ADF UI - only simple access to VO attribute will be required, without calling any custom methods from ADF BC (all the job will be done already on VO level).

Here you can download sample application - ViewAccessorSampleApp.zip. This app logic allows to render in green these location lines, where at least one department exists:


There are 2 VO's, no View Link between them:


DepartmentsView VO is designed to check if at least one department exists for the current location. There is bind variable defined:


Here is important point now - Locations VO defines View Accessor (simply add it through the wizard) for Departments VO:


This means we are going to have access to Departments VO result set from Locations VO. Moreover, we can define Bind Variable value declaratively:


To complete use case, there is transient attribute defined of boolean type:


Getter method for this attribute is overriden in VO Row Implementation class. Here we are accessing View Accessor and check if at least one row exists:


And to complete, on ADF UI we only need to set color condition for table columns:


If current location got at least one department - it will be highlighted in green: