Working on the Controller and UI
3.8 Define Application flow in ADF Controller
Step 1) Open the ViewControllerWeb ContentPage Flow and open adfc-config in the code editor.
Step 2) Select the HomePage.jspx from the application navigator and drop it in the code editor.
Step 3) Now select the bounded task flow we have created “Edit Registration” from Page Flows folder and drop it on the code editor. It will show an error on it as the parameters expected by the bounded page flow has not been set yet.
Step 4) Select the “Edit-Registration” and in the property inspector under the parameter node set the value=#{requestScope.mode} for ‘mode’ parameter and value=#{requestScope.regToEdit} for the regToEdit parameter. And define the out parameter ‘regToEdit’ with value= #{pageFlowScope.regToEdit}.
Step 5) Select the “Control Flow Case” from control flow in component palette, drag
& drop it from “HomePage” activity to “Edit-Registration” activity. And set the from-outcome property to “NewOrEdit”. This NewOrEdit is the action property we set for the ‘NewRegistration’ command button.
Step 6) Select the CatalogueCategoryPage.jspx from the application navigator window and drop it on the code editor.
Step 7) Select the “Control Flow Case” from control flow and drag & drop it from
“Edit-Registration” activity to “CatalogeCategoryPage” activity with from-outcome to
“CatalogPage”.
Run your application and see if you can create a new registration. Verify that the Creation date; Registration Number fields are getting shown with default values.
Check if the required indicator is appearing in the UI. We have done this setting at the RegsitrationEO entity level.
Let’s proceed now with updating page flow so that user can add lines in the registration.
Step 8) Select a method activity from the component palette and drop it on the adfc-config.xml in code editor with id=’ CreateNewLine’. Now select the RegistrationPageVOItemDetailsPageVOOperationsCreateInsert and drop it on the newly created method activity ‘CreateNewLine’. CreateInsert operation insert a new blank row in the entity object.
Step 9) Select the ‘Control Flow case’ from the component palette, drag & drop it from ‘CatalogueCategoryPage’ to ‘CreateNewLine’ activity with from-outcome property= ‘CreateNewLine’.
Step 11) Now as the item details page gets rendered, it gets rendered with the details of the item selected in the catalogue category page. To display these details on the item details page we will set the required details in the blank row created in ItemDetailsPageVO in step 8. To achieve this we will write a custom method in application module Impl class which will set the required item details in the ItemDetailsPageVO. Add the following code in your application module Impl public void initilizeNewRegLines(String productCode,String regId) {
ViewObjectImpl itemVO=getItemListVO();
String clause ="PRODUCT_CODE = '" + productCode + "'";
itemVO.setWhereClause(clause);
itemVO.executeQuery();
itemVO.setCurrentRowAtRangeIndex(0);
ItemVORowImpl itemRow=(ItemVORowImpl)itemVO.getCurrentRow();
ViewObjectImpl newItemLineVO=this.getItemDetailsPageVO();
ItemDetailsVORowImpl newGoodsLineRow=(ItemDetailsVORowImpl)newItemLineVO.getCurrentRow();
newGoodsLineRow.setProductCode(productCode);
Number unitPrice=itemRow.getUnitPrice();
String uom= itemRow.getUom();
String currency= itemRow.getCurrency();
String manufacturer = itemRow.getManufacturer();
if(unitPrice!=null)
newGoodsLineRow.setManufacturer(manufacturer);
if(regId!=null)
Add the above method in the application module client Interface.
Step 12) Select the initilizeNewRegLines from the data control palette and drop it on the adfc-config.xml in code editor. In the “Edit Action Binding” under the parameter section specify values as
Step 13) Select the flow control from the component palette, drag & drop it from
‘CreateNewLine’ to ‘initilizeNewRegLines’ activity with from-outcome property=
‘’CreateInsert’.
Step 14) Select the ItemDetailsPage from the application navigator, drag and drop it in the adfc-config.xml file in code editor. And define the control flow activity from
‘initilizeNewRegLines’ to ‘ItemDetailsPage’ activity with from-outcome=
initilizeNewRegLines.
Step 15) Define a control flow from ItemDetailsPage view activity to Edit-Registration task flow call activity with from-outcome= SaveRegLine. And then define a control flow from the “Edit-Registration” to “HomePage” with from-outcome= HomePage.
Run your application, with home page, you should be able to create and save the registration. And then add the new line by clicking the “Add Item” button on the registration page.
When you run your application and add the registration line in the registration, your added lines will not be shown in the registration lines table region in the registration page. To achieve this we have to execute the iterator with which the registration lines table is associated.
Step 16) Select the
RegistrationPageVO-->RegLinesRegPageVO-->Operations-->Execute from the data control palette and drop it on the adf-config.xml in code editor. Set the id of the activity to ExecuteRegLines.
Step 17) Delete the control flow case between the ItemDetailsPage and Edit-Registration.
Step 18) Select the flow control from the component palette, drag & drop it from
‘ItemDetailsPage’ to ‘ExecuteRegLines’ activity with from-outcome property=
‘SaveRegLine’.
Step 19) Select the flow control from the component palette, drag & drop it from
‘ExecuteRegLines’ to ‘Edit-Registration’ activity with from-outcome property=
‘Execute’. Now run the application, registration lines region in the registration page will show the added line in the registration.
Another navigation case is to go to item list page from registration page and search the item. And from Item list page to item details page where we will add the quantity of the item and navigate back to the Registration page. To achieve this , follow the following
steps:-Step 20) Select the item list page from the application navigator and drop it on the adf-config.xml in the code editor.
Step 21) Define control flow from 'Edit-Registration' to 'ItemLitsPage' with from-outcome='ItemListPage'. And from the 'ItemListPage' to the 'CreateNewLine' method activity with from-outcome='CreateNewLine'.
Now you will be able add a line in registration from the item list page.
Also we also have to open the exiting registration from the Home page. To achieve this open your home page. Now under the registration number command link add the following two action listener under that as
:-1) from="#{'Edit'}" to="#{requestScope.mode}"/>
2) from="#{row.RegistrationId}" to="#{requestScope.regToEdit}"
And finally, as we have the “Total USD Amount” and “Total PFI Amount” in the registration page which will show the total USD amount of the registration lines and total PFI(package, fright and insurance) amount of the registration lines added in the registration. To achieve this we will add the method in the application module custom Java class which will iterator through the registration lines related to current registration with the help of view link. Add following code in the application module Impl