Hi,
This is a small sample application demonstrating the findByKey(Key key,int i) method.
According to the API:
http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#findByKey_oracle_jbo_Key__int_
This is a small sample application demonstrating the findByKey(Key key,int i) method.
According to the API:
http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#findByKey_oracle_jbo_Key__int_
This can be useful when we want to navigate to a page for instance displaying a given row and not actually filtering the dataset retrieved from the query.
The test case is fairly simple. Lets use the HR schema.
We create an Application and produced the Business Components of the Employees and EmployessDetailsView tables. Just using the JDeveloper Wizard.
The result is to have, among others, the following views:
EmployeesView
EmpDetailsViewView
The findByKey method as we saw in the API accepts a parameter of type Key.
The case for this example is to use the key for one VO object and call the findByKey method to find a row in the other VO and make it current.
So we have to alter the EmpDetailsView entity Object a bit. We need to set the primary to point to EmployeeId and remove the RowId, smartly, produced by JDeveloper wizard.
and the View Object should be like the following:
Note here that we are not creating any ViewLinks. This will simply filter our data and we wont be able to see all other data.
Furthermore, we will create two separate pages for each VO and we will navigate from one page to another.
We will create a form in each page with navigation buttons. Additionally we will move from one page to another and see the appropriate information.
For example, while in page of Employees, we will navigate to record with EmployeeId=107 and then press the button to go to EmpDetails. The same operation will be done from EmpDetails to Employees.
The goal is to have consistent data according the employeeId.
As you understood by now, we will use the findByKey method...
Simply, we will create two separate methods in the Application Module Implementation class that will do the work.
What we do here is to get the Key from the One's VO current Row and find by key to another.
Now, we need to call these methods.
We will expose them in the client interface of the Application Module
Next we will create a task Flow of three (3) pages.
Index: from which we will navigate to Employees or EmpDetails pages
Emps: from which we will navigate either to EmpDetails or Index pages
EmpDetails: from which we will navigate to either Emps or Index pages.
The trick here is to interfere the calls from Emps to EmpDetails and vice versa in order to call the findByKey methods.
Since we have them exposed, we will simply drag and drop them to our taskFlow and have to be called before going to the page we want.
-
And that is about it..Every time we navigate from one page to another, the corresponding findByKey will be called and we will see the data set according the EmployeeId.cheers.