My Procurement Application JDeveloper Version: 11.1.1.0.

0 Audience: Beginners Prerequisites: Oracle JDeveloper 11g, Oracle Database 10g XE

Business Scenario:
I have developed this sample application to learn Oracle ADF 11g.And in this documented you will find the steps for developing this complete sample application. This application manages the procurement activities with in an organization. The different type of procurement activates handled by this application are:• • • • • Search for the Registrations. Creating Registration and adding item lines to Registration. Search item in catalog and categories. Edit the existing created registration. Search already created registration.

It is best to view this document with View as web layout, whether you are using the MS Word or the Open office Word Editor. Terms Used in Application

1) A Registration is created which can later on used to create purchase order. 2) 3) 4) 5)
Users add items in registration. Registration lines are items which are added in registration. Catalog contain categories. Categories contain items. PFI is package, fright and insurance charges.

Following database objects are used in this application:CATALOG: - database table which stores catalog details. CATEGORY: - database table used to store various categories of a catalog. ITEM: - database table used to store item belongs to different categories. PFI_DETAILS:- database table used to store Packaging, Freight and Insurance percentage based on the mode of payment of the item. REGISTRATION: - database table used to store registration created by users. REGISTRATION_S: sequence used to generated registration id REGISTRATION_LINES:- database table used to store goods which are added to registration.

http://kohlivikram.blogspot.com/

REGISTRATION_LINES_S: used to generate registration line id.

Database Diagram Complete application along with SQL script can be download from http://www.4shared.com/file/91772443/17828aab/MyADFLearningApp.html

Screen details: - We have following screens in this application. Home page: - Allows user to search for the registration. Search page where user
can search for the already created registrations and can navigate to the registration page to update the registration and add new registration lines in the registration. User can create the new registration by clicking the “New Registration” button on this page.

http://kohlivikram.blogspot.com/

http://kohlivikram.blogspot.com/

com/ . Following are field details for the page. User will create the new registration details and will edit the existing registration details.blogspot. http://kohlivikram.This page is used to create the new registration.Registration Page: .

Creation Details Created By Name of the user who created it Creation date Date of creation Requested by User who requested to Full name of employees http://kohlivikram.Registration Details Registration Number Unique registration number.Field Type and Description Region:.blogspot.Closed Normal . Emergency and Reimbursable Procurement Open .com/ . Urgent Region:. Procurement Type Static List of values Registration status Urgency Total USD Amount Total PFI Amount Static List of values Static list of values Sum of Total USD amount of the added lines in the registration Sum of Total PFI amount of the added lines in the registration Valid values Standard Procurement.

When user clicks on a particular category name.Registration Lines Details of the line added to the registration along with editing the line and deleting the line columns Catalog Categories Page: . “Search Item” will navigates to “Item list page” and “back button“ will take us back to “Registration page”.contains catalog table which has categories as its inner table . Region :.Department Name create the registration. http://kohlivikram. Department to which the user who requested the registration from HR.blogspot. Employees table.com/ . User will navigate to this page when he clicks on the “Add Item” button on the “Registration page”. Item table gets refreshed to show all items under that category.This page contains two regions:Catalog-category region:.shows the item under the categories. This is achieved using the PPR functionally. Items region:. On this page.

blogspot. http://kohlivikram.com/ .Item List page: . User will navigate to this page from registration page and catalog page after clicking on “Search Item “button.This page will help the user to search a particular item.

http://kohlivikram.com/ .blogspot.

http://kohlivikram.com/ .blogspot.

Here the quantity specified should always be greater then or equal to 5. Clicking on the button “Add to Registration” will add the current item from this page with specified quantity to the current registration.Item Details page:.In this page user will specify the quantity of items to be ordered . User will navigate to this page from Catalog categories page and Item list page after clicking on product code.blogspot.com/ . Application Flow :- http://kohlivikram.

right click and select “New Application' to create a new Application based on “Fusion web application(ADF)” in your Jdeveloper 11g.com/ .blogspot. http://kohlivikram. Accept all other setting as it is and click finish.1 Creating ADF Workspace In the application navigator .Chapter 1 Creating ADF Workspace & Database Connection 1.

• Click Test Connection to confirm that you can connect. and enter the username and password. select the connection type.Install the database object required for this application in default HR schema. • Enter a name for the connection.blogspot. • Select Application Resources if it is not selected as the Create Connection In option. • Click OK if the connection was successful.2 Creating a Database Connection Open the Create Database Connection dialogue [File > New > General > Connections > Database Connection] . Create a database connection with your HR schema.com/ . 1. http://kohlivikram.

→ in REGISTRATION_LINES table through item details page where user add/edit quantity. expand the Connections and Database nodes in the Application Resources panel to see the database objects. In my application user is storing data in two tables :→ in REGISTRATION table through registration page where user creates/edit new registration. Business services components acts as a communication channel between between an MVC application and a data source (usually a database). 21. For more conceptual knowledge on entity objects www. ADF Business Components in Depth.pdf and read Chapter 3. Each database column of a table is represented as attribute in entity object. It includes data.com/ . I am using ADF business components previously knows as BC4J to build our business services layer. Steps to create RegistrationEO Step 1) Right click on the Model project and select New. hit So we will create two Entity objects based on above two tables with name RegistrationEO and RegistrationLinesEO. Step 2) In the “New Gallery” window under “Business Tier” select “ADF Business Components”.oracle. Entity Objects required in application :. Step 3) Select “Entity Object” from Items and click OK. Chapter 2 Creating Business Service Layer Objects :- In this learning application. This components implements the O/R mapping and business rules/validations.business rules and persistence behavior for database tables used in your application.blogspot.com/technology/documentation/jdev/adf_guidelines_manual.• In the Application Navigator. http://kohlivikram.An entity object is a business components maps to a single object in the data source.

blogspot. http://kohlivikram. And select schema object as “REGISTRATION”. Name as “RegistrationEO”.com/ .entity”. specify package as “model.Step 4) In the Create Entity Object class.

blogspot. “Accessors” and “Create Method” check boxes and click ok. Double click RegistrationEO from the application navigator window and select java option from the code editor window. Step 6) Generating Entity object java class for custom functionality:We need to set the RegistrationId value which comes up from the “Registration_S” database sequence when new registration is created. Click on the Edit Java Option icon and in the “Select Java Option window. Check out following figure for help http://kohlivikram. check the “Generate Entity Object Class”.Step 5) Click next up till step 5 and click finish. This finishes the creation of the entity object RegistrationEO.com/ .

SequenceImpl.getDBTransaction()). setRegNum("MP" + seqNum).create(attributeList). } “protected void s = new This create method is called when you insert a new row inside your entity object. SequenceImpl SequenceImpl("REGISTRATION_S".server. Step 7) Set up default values for Attributes http://kohlivikram. protected void create(AttributeList attributeList) { super.getSequenceNumber(). This method can be used to initialize default values for the first time entity row is created.blogspot. Number seqNum=s.com/ . setRegistrationId(seqNum).jbo.Open the RegistrationEOImpl class and replace the create(AttributeList attributeList)” method add following code import oracle.

assoc” and Name as 'RegLinesAO”.2 Creating Entity Association :.Entity association defines the relationship between two entity objects based on entity attributes. the creation date default value should be ‘current system date’ and registration status field default value should be ‘Open’. setLineId(seqNum). Associations often map to foreign key relationships between tables in the database. And add the following create method in the RegistrationEOImpl class protected void create(AttributeList attributeList) { super. http://kohlivikram.In our application in the Registration page. ADF framework will itself create the association. SequenceImpl SequenceImpl("REGISTRATION_LINE_S".entity node and select “New Association”. Double click it and in the “Edit Attribute” window. Step 2) Specify package as “model.html?_template=/ocom/print Step 1) Right click the model. Select the ‘ProcType’ attribute and check the Mandatory check box to make this field required in the UI. Association allow you to navigate from one entity instance to either another entity instance or a collection of related instances.com/ .entity.com/technology/oramag/oracle/05nov/o65frame. Again double click the “RegStatus’ attribute and in the “Edit Attrbute” window set the value = ‘Open’. Steps to create RegistrationLinesEO In a similar fashion you can create entity object RegistrationLinesEO.blogspot. If the foreign key relation ship exist at database level . Select the Attributes tab from the code editor window and select “Creation Date” attribute. check the history column check box and select “created on” from drop down and click ok.oracle. And click on add button. For more conceptual knowledge on association hit http://www. we have to manually define the association between these two entity objects.And click next. Number seqNum=s.create(attributeList). Step 3) Select “RegistrationId” under RegistrationEO from “Select Source Attribute” and “RegistrationId” from “RegistrationLinesEO” under “Select Destination Attribute”.getSequenceNumber(). As in our SQL script we haven't defined any foreign key constraints. } s = new 2.getDBTransaction()).

3 View Objects required in application :.com/ . SQL query columns map to view attributes in the view object .1 Read only view objects http://kohlivikram. I think we should create separate view object for individual page because application will be more maintainable. We create read only view object for UI pages which only shows data and entity based view objects for pages which perform DML operations on data. we will create following view objects :2. SQL based also know as Read only View Objects which are not mapped to entity attributes. Thought we can create multiple UI pages based on the same view object. For our application.blogspot. A view object are either :Entity based which means view attributes are mapped to entity object attributes .3.Step 4) Click next until “step 4 of 5” and then click finish.View objects are ADF business components that collects data from the database based on the SQL query. 2.

blogspot. CategoryVO – to query categories table which will be used in the Catalog-category page. SearchPageRegistrationVO – will be used in the Home page. CATALOG. CATALOG.com/ .view” and name as “CatalogVO”. Steps to create the CatalogVO Step 1) Select model node.CatalogVO – to query the CATALOG table which will be used in the Catalog-category page. ItemListPageVO – will be used in the Item list page. Step 3) In query window of step 2 of 9 . And select “read only access through sql query” radio button. EmployeesVO – will be used in drop down “Requested By” field in the Registration page.CATALOGUE_ID CATALOGUE_ID. Step 2) In the Create View Object window. specify package name as “model. specify following query :SELECT CATALOG. RegistrationLinesVO – will be used in the registration page to show the lines details . Will be used in the Item details page to set the new row data based on data fetched by this view object.DESCRR DESCRR FROM CATALOG and set Order by as "CATALOGUE_NAME" http://kohlivikram. right click and select “New View Object”.CATALOGUE_NAME CATALOGUE_NAME. ItemVO – to be used to get the item details based on the product code from the Item table. SearchPageRegistrationLinesVO – will be used in the home page to show the lines that exist in the already existing registration.

EMAIL. Category.blogspot.EMPLOYEE_ID.CATEGORY_ID.Step 4) Click next until step 4 of 9 and then click finish.HIRE_DATE.CATEGORY_NAME.com/ . Employees. Employees. Employees.PHONE_NUMBER.LAST_NAME. http://kohlivikram. In the same fashion create remaining view objects based on following queries:CategoryVO SELECT Category. Category.FIRST_NAME. Employees. Category. Employees.DESCR FROM CATEGORY Category EmployeesVO SELECT Employees.CATALOGUE_ID.

QTY*Item.CATEGORY_ID. Item.PRODUCT_CODE. CATEGORY. Employees.CATALOGUE_NAME CATALOGUE_NAME. ITEM.CATEGORY_ID CATEGORY_ID.First_NAME || ' ' || LAST_NAME FROM EMPLOYEES Employees FULL_NAME ItemListPageVO SELECT CATALOG. CATEGORY. ITEM.CATEGORY_ID = CATEGORY.CATEGORY_ID ItemVO SELECT Item.CURRENCY.UNIT_PRICE as USD_AMOUNT . http://kohlivikram.DESCR.REGISTRATION_ID.CATALOGUE_ID AND ITEM. CATEGORY. Item.UOM UOM. Employees. Item. Employees.UNIT_PRICE UNIT_PRICE.SALARY. Item. Item.Employees. ITEM. CATALOG. RegistrationLines.PRODUCT_CODE. Employees.UOM.UNIT_PRICE.UNIT_PRICE. Item.CATALOGUE_ID CATALOGUE_ID1.CATEGORY_ID CATEGORY_ID1.CATALOGUE_ID CATALOGUE_ID.com/ . ITEM WHERE CATEGORY. Item. ITEM.CURRENCY .CATEGORY_NAME CATEGORY_NAME.LINE_ID. CATEGORY.COMMISSION_PCT. CATEGORY. CATALOG. RegistrationLines.DESCR DESCR1. ITEM.CURRENCY CURRENCY FROM CATALOG.JOB_ID. Item.PRODUCT_CODE PRODUCT_CODE. RegistrationLines.DEPARTMENT_ID. RegistrationLines. Employees.blogspot.Manufacturer FROM ITEM Item RegistrationLinesVO SELECT RegistrationLines.DESCR DESCR. ITEM.QTY.MANAGER_ID.DESCRR DESCRR.CATALOGUE_ID = CATALOG.

UNIT_PRICE))/100) USD_TOTAL_AMOUNT FROM REGISTRATION_LINES RegistrationLines.PRODUCT_CODE PRODUCT_CODE.ITEM WHERE REGISTRATION_LINES. Registration.REG_NUM REG_NUM.will be used in the Registration page as new registration is created and existing are modified. (RegistrationLines.TOTAL_USD_AMT + TOTAL_USD_PFI_AMOUNT.3.2 Entity based view objects as as Registration. ItemDetailsVO – will be used in the Item Details page as new items are added to registration and existing are modified. Registration. Item.PFI_PER*(RegistrationLines.(PFI.PRODUCT_CODE=Item.QTY QTY. PFI_Details PFI WHERE RegistrationLines.CURRENCY CURRENCY FROM REGISTRATION_LINES.QTY*Item.com/ .UOM UOM.PFI_PER*(RegistrationLines.LINE_ID LINE_ID. Steps to create the RegistrationVO http://kohlivikram.MODE_OF_PAY(+) SearchPageRegistrationVO SELECT Registration. REGISTRATION_LINES.blogspot. This view object will be based on RegistrationLinesEO entity object.REG_STATUS REG_STATUS. ITEM.UNIT_PRICE) + ((PFI.PRODUCT_CODE ORDER BY "LINE_ID" 2.TOTAL_PFI_AMT RegistrationVO .PRODUCT_CODE = ITEM. REGISTRATION_LINES. Registration. This view object will be based on RegistrationEO entity object.PRODUCT_CODE(+) AND Item. ITEM.MODE_OF_PAY=PFI.QTY*Item.UNIT_PRICE))/100 USD_PFI_AMOUNT.REGISTRATION_ID REGISTRATION_ID. REGISTRATION_LINES. Registration.CREATION_DATE CREATION_DATE FROM Registration SearchPageRegistrationLinesVO SELECT REGISTRATION_LINES.QTY*Item.REGISTRATION_ID REGISTRATION_ID.

EMPLOYEE_ID(+) AND Emp2.NOTES_BUYER.TOTAL_PFI_AMT.PROC_TYPE.FIRST_NAME || ' ' || Emp4.PRODUCT_CODE. RegistrationEO.CREATED_BY.FIRST_NAME || ' ' || Emp2. EMPLOYEES Emp1.TOTAL_USD_AMT.Department_id(+) and click finish .LINE_ID.REGISTRATION_ID. RegistrationLinesEO.Step 1) Right click the model.Department_id=Dept. RegistrationEO.SHIPING_ID = Emp4.FIRST_NAME || ' ' || Emp1. and in the “Step 5 of 9” select “Expert” as SQL mode and paste the following query in the Query statement. RegistrationEO. Emp5. Emp3.EMPLOYEES Emp4. Step 4) In step 3 of 9.LAST_NAME CONSIGNEE_NAME.REG_STATUS. SELECT RegistrationEO.FIRST_NAME || ' ' || Emp5.CONSIGNEE_ID = Emp3.EMPLOYEE_ID(+) AND RegistrationEO. RegistrationEO. Similarly create the ItemDetailsVO based on the RegistrationLinesEO with following query SELECT RegistrationLinesEO.REQUESTED_BY = Emp5.QTY. Dept.blogspot.PARTY_NOTES.LAST_NAME REQUESTED_BY_NAME. RegistrationEO. Emp2. http://kohlivikram. Emp4. RegistrationEO. select RegistrationEO from the model.entity and shift it to the Selected area.LAST_UPDATED_BY = Emp1.EMPLOYEE_ID(+) AND RegistrationEO. shift all the attributes from available list to the selected list and click next. Emp1. RegistrationEO. RegistrationLinesEO. RegistrationEO.Department_name FROM REGISTRATION RegistrationEO.EMPLOYEE_ID(+) AND RegistrationEO.CREATION_DATE.LAST_UPDATED_BY.SHIPING_ID. Step 5) Click next again. specify the Name as “RegistrationVO”. RegistrationEO.view and select “New View Object”.FIRST_NAME || ' ' || Emp3. RegistrationEO.CREATED_BY = Emp2. from the Available list.EMPLOYEES Emp3.LAST_NAME LAST_UPADTED_NAME. RegistrationEO.EMPLOYEES Emp2.LAST_NAME SHIPPING_NAME. RegistrationEO. RegistrationEO.REGISTRATION_ID.EMPLOYEE_ID(+) AND RegistrationEO.DEPARTMENTS dept WHERE RegistrationEO. RegistrationEO. Step 3) In Step 2 of 9.REQUESTED_BY. Step 2) In the Create View Object – Step 1 of 9 .REG_NUM.LAST_NAME CREATED_BY_NAME.CONSIGNEE_ID.URGENCY. EMPLOYEES Emp5.com/ . RegistrationLinesEO.

ITEM. select Both. total USD PFI amount and creation details as items under the created group as depicted in following diagram:- http://kohlivikram. click the Create New View Criteria icon. specify the name of the view criteria as SearchPageRegistrationVOCriteria. Creating View Criteria on SearchPageRegistrationVO view object.UNIT_PRICE. Home page which allows to search the already created registration. ITEM. ITEM.registration status. Step 4) In the Create View Criteria.MANUFACTURER FROM REGISTRATION_LINES RegistrationLinesEO. Step 3) In the View Criteria section. Step 5) In the Query Execution Mode drop down list. we have two search pages. ITEM. 2. In our application. For home page.PRODUCT_CODE. Step 6) Click on “Add Group” button because our view criteria will be based multiple criteria items.UOM.com/ . And the Item list page which allows to search the existing item.4 View Criteria used in application A view criteria defines filter information for the rows of a view object collection.CURRENCY. Step 2) In the overview editor navigation list. Step 1) Double click on the SearchPageRegistrationVO. Step 7) Add registration number.blogspot.PRODUCT_CODE=ITEM. We defined view criteria because they will be used in the search pages we will create for our application.DESCR. we are using SearchPageRegistrationVO and for Item list page. So we will create the view criteria on both of these view objects.ITEM.ITEM WHERE RegistrationLinesEO. we will use ItemListPageVO. select Query and expand the View Criteria section.

Now similarly create the view criteria ItemListPageVO with following criteria items.com/ .blogspot. named “ItemListPageVOCriteria” on http://kohlivikram.Step 8) Click OK to finish creating the view criteria.

In ADF 11g we define List of values against the VO attributes which are going to be displayed as LOV in the UI.5 List of Values used in Application There are various LOV components which are used in different pages in our application. → And in the Item list page for the Catalog and Category fields in the search region. In this learning application. This a I think one of the great features that has came up in ADF 11g as we are setting the LOV at the model layer itself. Steps to set the “Requested By” field in registration page as LOV http://kohlivikram.blogspot.com/ . LOV is used in the → Registration page for the requested by field which will show the employees in the drop down list .2.

http://kohlivikram. click on the new “List Data Source”.blogspot. And then click OK.view” from the “Available View Object” and shift to the “View Accessors” list. Step 1) Select the RegistrationVO from the model. In this window select the “EmployeeVO” under “model. And then select the “RequestedBy” attributes.com/ . click on the new LOV icon(a green color one) Step 4) In the “List of Values” window. Step 3) In the “List of Values: RequestedBy” . Step 2) In the code editor window .view package. select the Attributes tab. “View Accessors” window will appear.Requested By field in the Registration page shows all the employee name in the drop down list.

In “UI Hints” select appropriate attributes to be displayed in LOV. select and shift “Full Name” from “Available” to “Selected” list.Step 5) In the “List of values” select “EmployeeId” from “List Attributes”.blogspot. Step 6) In the “UI Hints” tab. Refer following figure to achieve this http://kohlivikram. And the click OK.com/ . In the same fashion → create the list of values for the “Catalog name” attribute based on the “CatalogVO” as “List data source” in the “ItemListPageVO”.

–> create the list of values for the “Category name” attribute based on the “CategoryVO” as “List data source” in the “ItemListPageVO”. In “UI Hints” select appropriate attributes to be displayed in LOV. Refer following figure to achieve this http://kohlivikram.com/ .blogspot.

blogspot. we need to create the view link between following view objects. We need view links to create the master detail components in the user interface. Source Object View Source View Attribute Destination View Object Destination View Attribute View name Link Description SearchPageRe Registrati SearchPageRe RegistrationI HomePageVL Used in the gistrationVO onId gistrationLines d home page VO to show the master detail relationship as table between table for registration and its lines.2. In our application.com/ . http://kohlivikram.6 View Links used in the application View links defines the relationship between the ADF view objects.

the item table gets refreshed with relevant items for that category.com/ .RegistrationV O Registrati RegistrationLin RegistrationP RegistrationP Used in the onId esVO ageVL ageVL registration page to link the RegistrationV O and RegistrationL inesVO Catalogue CategoryVO Id CatalogueId CatalogCate goryVL Used in the CatalogCategory page to achieve the master detail relationship as table with in table where outer table shows Catalog and inner table shows categories within that table. when user select the category from inner table. Used in the CatalogCategory page.blogspot. CatalogVO CategoryVO CategoryI ItemListpageV CategoryId1 CategoryIte d O mVL RegistrationV O Registrati ItemDetailsVO RegistrationI ItemDetailsV To link the onId d L ItemDetailsV O and RegistrationV O Steps to create the view link HomePageVL http://kohlivikram.

Objects” CatalogVO CategoryVO via CataloeCategoryVL CatalogPageVO CatalogCategoryVO ItemListPageVO CatalogVO CategoryList CatalogeCategoryItemVO CatalogListVO CategoryListVO http://kohlivikram. → let developer define the service methods which are defined in the application module class. And then click on the “Add”.7 Application module Application module are business components that → provide data required by application to complete the specific task . 2. Step 3) In step 2 of 5. And select “RegistrationId” in “SearchPageRegistrationLinesVO” under “Select destination Attribute”. Step 2) In Step 1 of 5 .com/ . Step 3) In step 2 of 7. In completing the business service layer objects. create other view links. And click on next. A transaction object maintains pointers to entity and view caches. set the package to “model. In a similar fashion. Step 2) In the “Create View Link – Step 1 of 7 “. we will create the application module and will add the view objects to the application module. right click and select “New Application Module”.view” and shift it to the ”Data Model” pane. View Object to be selected under “Available View “New Instance Name” to be specified. From the “Available View Object” pane select the following view objects under “mode. it maintains a database connection. And click next”. select “RegistrationId” in “SearchPageRegistrationVO” under “select source Attribute” . and it is responsible for post. Click “OK” and then click finish. And view link instance provides a master-detail relationship between view object instances. A view object instance manages a single cache of retrieved data. package name should be 'model' and name should be 'MyLearningAM'. and rollback operations.view” node under the “Model-->Application Sources” sources.Step 1) Select the “model.link” and name to “HomePageVL”. commit. we will add the view objects and view links in the data model.view. → provides access to the transaction object.blogspot. These service methods allows you to dynamically add/remove new view objects to data model at run time and to perform operations on the view cache result set.The application module data model contains view object and view link instance. Following steps will help you to create this:Step 1) Select the model node.

blogspot.com/ . your “Data Model” should look like this:- http://kohlivikram.EmployeeVO EmployeesListVO ItemListPageVO ItemVO ItemListPageVO ItemListVO RegistrationPageVO RegistrationLinesVO via RegistrationPageVL RegistrationPageVO RegLinesRegPageVO ItemDetailsVO via ItemDetailsVL ItemDetailsPageVO SearchPageRegistrationVO SearchPageRegistrationLinesVO via HomePageVL SearchPageRegistrationVO SearchPageRegistrationLinesVO After completing this.

http://kohlivikram.blogspot.com/ .

blogspot.Step 4) Click on finish.com/ . So you have finished creating the Business service layer using the ADF Business components. Your model structure should look like this http://kohlivikram.

we will put the validation that in the RegistrationLinesEO.2. And later one is not suitable. We should prefer to put up the validations at entity level rather then at database level using pl/sql or at client end using the JavaScript. application has to hit the database every time validation has to be executed which will degrade the performance of the application by requiring the expensive JDBC calls. This can be achieved by putting up this validation at entity level.com/ .8 Validations In the Item Details page. Because in first case. or what if user access the data through other user interface. as later on if view technology need to be changed . So http://kohlivikram. As Item Details page will be based on the ItemDetailsPageVO which in turn based on the RegistrationLinesEO.blogspot. we have a validation that quantity should be greater then five.

Step 3) In the “Add Validation Rules for: Qty” . select the Rule Type as “Compare”. Chapter 3 Working on the Controller and UI. http://kohlivikram.Step1 ) Select the RegistrationLinesEO under the model. So this is how you can put up validations at the entity object level. Step 2) Select the Qty from the Attribute list and click on the “Add validation Rule” from the Validation Rules.com/ .entity and select the “Attributes”.blogspot. In the Operator select “Greater Than” and in the “Enter Literal Value” enter 5. Step 4) Now select the “failure Handling'” tab in the same window and enter the failure message as “Quantity should be greater the five”. And then click on “OK”.

and click OK. Step 2) In the Categories tree. all the pages which are based on the template will automatically reflect the changes.string and required as true.1 Steps to create the page template definition Step 1) Select the “ViewFolder”. Step 3) Click the Facet Definitions tab and click the Add icon to add facets.com/ .blogspot. select the JSF node. it will inherit the defined layout. Enter the File Name as “MyPageTemplate”. Step 5) Select the “Panel Stretch layout” from the Component Palette and drop it on the af:pageTemplateDef in the structure window.lang. Step 4) Click on the Attributes tab and click on the Add icon to add attribute with name PageTitle with type java. in the Items pane select JSF Page Template.We will now work on the controller and user interface for this application. Page template is one of the very important features in ADF 11g which let us define the entire page layout. right click it and select “New”. 3. When a page is created using a template. Facets are predefined areas on a page template where content can eventually be inserted when building pages using the template. We will start with building the page template. “Panel Stretch layout” is a http://kohlivikram. When we make the layout modifications in the template. Add two facets with name “MainPageRegion” and “ActionButtonBarRegion”.

com/ . This means that when user resizes the browser.blogspot. panelSplitter is the only other component that supports geometry management. Along with Panel Stretch layout. http://kohlivikram. Panel Stretch layout components will resize it self accordingly along with its child components.geometry management component.

com/ .blogspot.http://kohlivikram.

Inside the panelGroupLayout drop a separator from the layout component palette. And set the following properties to it in property inspector:StartWidth = 0px EndWidth = 0px TopHeight = 0px BottomHeight = 0px Inside the center facet of the above added panel stretch layout. Step 7) Now select the “Facet Ref” from the “common components” and drop it on the newly created panelGroupLayout in above step. We are using the panel group layout as it allows its child to be grouped vertically or horizontally.Now select the Panel Stretch Layout and set following properties in property inspector:StartWidth = 0px EndWidth = 0px TopHeight = 95px BottomHeight = 50px Step 6) Now expand the bottom facet under the panel Stretch layout and insert a panelGroupLayout inside that. Your page template structure should look like as following in structure window. color:Maroon.com/ . http://kohlivikram. This is actually referring to the attribute we have created above when we were creating the page template definition.PageTitle}. And set the following properties of the OutputText in property inspector: Value= # {attrs. Add an image component under that and then add an outputText under image. Step 9) Select the Center and add the panelStretchLayout inside it.blogspot. And then add the OutputText component from the common component palette and drop it below the above created outputText. Set the Source property of the image =” /MyProcLogo. vertical-align:textbottom. Under the output text drop the “Facet Ref” component from the common components palette. And in the “Insert Facet Ref” window select “MainPageRegion”. Step 8) Select the top facet under the panelStretchLayout and add a panelGroupLayout. font-size:small. add a panelGroupLayout. You will get the “MyProcLogo. This is the facet under which we will add our action command buttons aligned horizontally.  InlineStyle(under style) = font-weight:bold.JPG” from the application build by me. And set the value property of the outputText =” My Procurement Application”.JPG”. And in the “Insert Facet Ref” window select “ActionButtonBarRegion”.

then Item details page.blogspot.com/ . “Registration Search page”. Item Search Page because of the same reason.e. and finally we will create the Home page i. Here is a plan.We have finished creating the page template and now we will proceed to create our application pages. as it is not much dependent on other UI pages. we will first create the Catalogue-Category page.2 Steps to create the Catalogue Category Page http://kohlivikram.e. Then we will create the Item List page i. 3. And then we will create the Registration page.

Replace <nodeDefinition DefName="model. Now set the Text property of the link to “#{detailRow.This page will show the catalogs . We did this because on category name click. Step 9) Select the Master table from the structure window and set the id properties = CatalogTbl.2. From the convert Ouput Text. select the JSF node. Expand the CategoryTbl and set following properties of “CategoryName” column width = 200 . select Link from list of components and click ok. And partial submit (under Behavior) property in property inspector to true. Step 7) In the “Edit Tree Binding window” select the model.ID = CategoryNameCol And select “Descrr” Column and set its width to 400. Right click and select convert from the context menu. 3. in the Items pane selects JSF Page and click ok. Step 10) Select the “af:outputText – {detailRow.CategoryVO"> <AttrNames> <Item Value="CategoryName"/> <Item Value="Descr"/> </AttrNames> http://kohlivikram. shift CatalogueName and Descrr to Display Attributes.ProductCode} and action = ‘CreateNewLine’.com/ .” Step 6) Expand the data control palette. Also select the af:document nod ein starcture window and set pageTitle=” Catalogue Category Page”. And set the id of the link to CategoryNameLK.CategoryName}”.CategoryName}” under the inner inline table column CategoryName. and select the CatalogPageVO and drop it on the af:panelCollection. Step 5) now select the “Panel Collection” from the layout component palette and drop it on the “MainPageRegion”. Expand the master table. Step 4) Select the af:pageTemplate from structure window and set pageTitle=” Catalogue Category Page”. Step 3) Give the file name as “CatalogeCategoryPage” and select “MyPageTemplate” from the Use Page template drop down.1 Creating the Master – Inline detail table to show Catalog-Categories Step 1) Select the “ViewController”. Step 11) Right click your catalogue category page. Step 9) Expand the detail facet under master table and set the id property = CategoryTbl and width=650px. Inline Detail Table”. Step 8) Add a new tree level rule by clicking on the green icon and select “CategoryVO” and shift the CategoryName and Descr to the display attributes and shift back the CategoryId to the Avaliable Attributes. Click Ok in confirm convert window.categories table as master table and inline detail table and an items table under the master detail table showing item under selected category. And shift back the CategoryId to the Available Attributes. From the context menu select “Tables->ADF Master Table.view. Step 11) Similarly convert the product code output text to link with Text property = #{row.view. and select “go to page definition”. Step 2) In the Categories tree.blogspot.Now set the width(under Apperance) of “CatalogeName” column to 250 and descrr column to 400. the item table(will be creating in next step) gets refreshed with the items under this category. Now select the af:panelCollection from the structure window and set the ID property to PanelCollectionRN and inline style property under style from property inspector equal to “width:700px.CatalogVO and from the Available attributes. right click and select new.

Text to Items and width to 650 Step 2) now select the CatalogeCategoryItemVO from the data control palette and drop it on the above created panel box. Select Edit from partialTriggers.CategoryNameLK and shift it to selected pane and click ok. It will open the Edit Property window. 3.view. Under the control hints in “Edit Attribute” window. you should open the relevant view object from the model.2.view. delete all column except ProductCode. Step 4) Now select the item table (af:table node) and set the partialTriggers. http://kohlivikram. In a same way . Your custom labels are getting stored in a message bundle file called “ModelBundle.CategoryVO"> <AttrNames> <Item Value="CategoryName"/> <Item Value="Descr"/> <Item Value="CategoryId"/> </AttrNames> </nodeDefinition> You will see that the all column header of the master table as well as detail table are not properly named.properties” under the model package. set the label for other columns too. Set the id of the newly created af:panelBox to ItemPanelRN. And check the Sorting check box to enable users to sort the items.</nodeDefinition> With <nodeDefinition DefName="model. From the context menu select tables->ADF read only table. To name them. set the Label Text as “Catalogue Name”. For example double click the CatalogVO from the model.blogspot. rather then only the component which accepts the fired partial page request gets refreshed. Step 1) Add a Panel Box under the MainPageRegion. If some how “Add to Select” is not enabled then make sure that you have given id for each component in the command link hierarchy.view and then set the Label Text under the control hit to appropriate name. Step 3) In the Edit Tables Columns. Now select the commandLink. UOM. Select the Attributes and double click on the Catalogue Name. UnitPrice.2 Create the Item table showing Items under Category using PPR Partial page rendering is the way by which your full screen will not get refreshed.com/ . Descr1.

com/ . Double click your application module under the model node. we will put up a method in Application module to set the required filter condition.3 Filtering items under selected category Step 1) Generate the application module java class. select “Generated Application Module Class” check box and click ok. Select Java section in code editor and then click on the Edit java options.We are done with the process by which the Item table will gets refreshed when the Category Name link is clicked by user. 3. http://kohlivikram. To achieve this.2.blogspot. Step 2) In the Select Java Option. But still the page will show all the Items rather then showing the items under the selected Category.

Delete the existing <af:commandLink . shift the getItemInCategory() method from Available list to Selected list and click ok. voItem. In the “Edit Client Interface” window. voItem. } Step 4) Again select your “MyLearningAM” node. Step 5) now you will see that above added method will appear in the data control palette.executeQuery().This will generated your AMImpl class where you can write service methods.CategoryName}"> and Select the getItemInCategory and drop it under the CategoryName column and select MethodsADF Link. For the method to be accessible in view layer and to be added to data control palette. and then java tab in code editor and click on the “Edit Application Module Client Interface” . And add following code in that:public void getItemInCategory(String CategoryId){ ViewObjectImpl voItem=getCatalogueCategoryItemVO(). we have to put the method in AM client interface.com/ ."#{detailRow. Step 3) Open your AMImpl class by selecting class under “MyLearningAM” node in Application Navigator. http://kohlivikram.setWhereClause("CATEGORY_ID1 = " + CategoryId).blogspot.

com/ . Your Catalogue Category page is ready to run.CategoryName} PartialSubmit = true. 3.Step 6) In the Edit Action Binding window set parameter value as #{detailRow. http://kohlivikram. Step 2) Select the af:pageTemplate and set the pageTemplate to “Item List Page”.3 Steps to create the Item List Page This page will help the user to search a particular item. It should be created based on the above created template.Now set the following properties on this af:commandLink:Id= CategoryNameLK Text = #{detailRow.blogspot. Step 3) Select af:document and set the title property to “Item List Page”. Following are the steps to create this page:Step 1) Create a new jsf page with name “ItemListPage” under the ViewController project. Step 4) Select the ItemListPageVONamed CriteriaItemListPageVOCriteria and drop it on the MainPageRegion and select Query”ADF Query Panel with Table”.CategoryId}.

”Descrr”. And select Link form the Convert Output Text window and click on ok.ProductCode}. ”Descr”. Step 8)Set the Text property of the newly converted link to #{row. we will convert the af:outputText .com/ .blogspot.And the Action property to the 'CreateNewLine'. click ok. So right click it and select “Convert” option. ”Product Code”.ProductCode} and to=#{requestScope. And in confirm convert window. Step 9) Inside the above command link add a action listener with from=#{row. To add the action http://kohlivikram. ”CatageoryName”.#{row. “Descr1” and “Unit Price”. Step 7) As User will move from this page to the Item details page.ProductCode}.ProductCode} to af:link. Step 6) Select the af:table –resId1 and then set the width to 900.Step 5) In the Edit Table Column delete all columns except “CatalogueName”.Set the column width of each column as per requirement.

Step 7) Select RegistrationPageVOProcType from the data control and drop it below the above created output text as Single SelectionADF Select One Choice. Style = width:943px. Step 6) Inside the panel group layout add a output text with value as “Registration Details”. id=”FirstRN”. Step 6) Now select the RegistrationPageVORegNum from the data control and drop it on the above created panel form as TextADF Output Text w/ Label. Run it check the results. each item seprated by “enter” key: Standard Procurement  Emergency  Reimbursable Procurement and click ok. Your Item List page is ready. Created the fixed values choice list with values Normal and Urgent.com/ . And below the output text. Select the newly created panelGroup and set the layout property as “scroll”. Registration page is the one which will allow the user to create the new registration and to edit the existing one.listener.4 Steps to create the Registration Page So finally the big fish has arrived. Step 9) Select RegistrationPageVOUrgency from the data control and drop it below the above created RegStatus choice list with. right click the command link and select the “insert inside af:commandlink--> ADF Core--> Set Action Listener”. Step 5) Select the PanelGroupLayout from the layout components and drop it on the first facet of above created panelSplitter. 3.blogspot. add the separator from the layout components. Step 4) Select the newly created af:panelSplitter and set the following properties in the property inspector:SplitterPosition = 454. Step 10) Drop the TotalUsdAmt and TotalPfiAmt from RegistrationPageVO in data control and drop it below the above created Urgency choice list one by one as Text ADF Output Text w/ Label. Creation Details Region http://kohlivikram. In the Edit List Bindings window. select “Fixed List” option. Step 8) Select RegistrationPageVORegStatus from the data control and drop it below the above created ProcType choice list. Step 9) Now select the af:panelHeader and set the text property to “Search Item”. Step 2) Set the page title as “Registration Page” and page window title also as “Registration Page”. Step 3) Select the Panel Splitter from the layout components and drop it on the MainPageRegion in the structure window. Following are the steps to achieve this:Registration Details Region Step 1) Create a new page with name “RegistrationPage” based on the template “MyPageTemplate”. Set the Base data source attribute as “ProcType” and enter following items in the set of values one by one. with values as Open and Closed. Step 7) Now select the PanelFormLayout from the layout component and drop it inside the created panel group layout below the separator. Again created the fixed list choice box as above. height:200px.

Step 1) Select the PanelGroupLayout from the layout components and drop it on the Second facet of above created panelSplitter “FirstRN”. Select the newly created panelGroup and set the layout property as “scroll”. Step 2) Inside the above created panel group layout add an output text with value as “Creation Details”. And below the output text, add the separator from the layout components. Step 3) Select the PanelFormLayout from the layout component and drop it inside the created panel group layout below the separator. Step 4) Select the RegistrationPageVOCreatedByName and RegistrationPageVO CreationDate one by one, from the data control palette and drop it on the above created panel form as TextADF Output Text w/ Label. Step 5) Select the RegistrationPageVORequestedBy from the data control and drop it as Single SelectionADF Select One Choice. Step 6) Select the RegistrationPageVODepartmentName from the data control palette and drop it on the above created panel form as TextADF Output Text w/ Label. Notes to Buyer Region Step 1) Add a spacer below the “FirstRN” panel splitter. Below that add another panel splitter with ID= SecondRN and splitterPosition=452. Step 2) Inside the first facet of the “SecondRN”, add a panel group layout. Step 3) Inside the panel group layout add a output text with value as “Notes to Buyer”. And below the output text, add the separator from the layout components. Step 4) Select the RegistrationPageVONotesBuyer and drop it on the above created panel group as TextADF Input Text. And set the Rows property of newly created text box to 5. Party Notes Region Create this region in a similar fashion as Notes to Buyer region is created in the second facet of the SecondRN based on RegistrationPageVOPartyNotes from data control. Registration Lines Region Step 1) Add a spacer below the “SecondRN” and then add an output text with value = “Registration Lines” in the structure window of registration page. Step 2) Add a separator below the above created output text. Step 3) Add a command button below the above separator with Text= “Add Item” and action =” CatalogPage”. This button will help the user to navigate to the “Catalog Category Page”. Step 4) Add another command button below the above command button with text property =”Search Item” and action=” ItemLitsPage”. This button will lead the user to Item list page once the action property of the button is set. Step 5) Now select the RegistrationPageVORegistrationLinesVO from thedata control palette and drop it on the af:group as TablesADF Read Only table. Step 6) From the Edit Table Columns window, delete “LineId”, “RegistrationId” and click ok.

http://kohlivikram.blogspot.com/

Adding Registration Managed Bean When user navigates from the Home page to the Registration page by clicking on the “New Registration” button, the page appear in the new registration creation mode. In that case “Add Item” buttons and “Search Item” buttons in the Registration Lines region should be disabled. As the registration it self is not yet created, user should not be able to add the lines in registration. So we have to disable these buttons for new registration and when user clicks on the “Save” button buttons should be enabled. We will achieve this with the help of managed bean. A managed bean is a regular java bean whose bean properties and methods are bind to the JSF components. We will use these properties to enable and disable the command button in our registration page. Step 1) Right click the view controller project and select new. From items section select “Java Class”. In the Create Java Class window specify Name as RegistrationBean and package as “view.beans” and click ok. Step 2) Add following two variables in the RegistrationBean class and generate accessors for both the variable(you can generate the accessors by right clicking on it and selecting ‘Generate Accessors’ from the context menu. private boolean disableAddItemBtn; private boolean disableSearchCataBtn; Step 3) Now we have to declare the above managed bean in the adfc-config.xml file. Open the adfc-config.xml file and in the code editor window, select Overview from the bottom of the window. Click on the “Add” icon and specify details as shown below:-

Step 4) Now we should also specify the initial value of the above created variable, which should be ‘false’ as “Add Item” and “Search Item” should be enable all the time except for the new registration request. For this select the Managed Properties and click on “Add” icon and add following properties:-

Step 5) Select the “Add Item” command button and set the Disabled property = #{RegistrationBean.disableSearchCataBtn} And then select the “Search Item” command button and set the Disabled property = #{RegistrationBean.disableSearchCataBtn}

http://kohlivikram.blogspot.com/

Action Button Bar Region Step 1) Select the OperationsCommit from the data control palette and drop it on the ActionButtonBarRegion in the structure window and select operationsADF Button form the command window. Change the text property of the command button from Commit to Save and disabled property to false. Step 2) Insert inside the Save command button two action listener with following values:From= #{false} and To= #{RegistrationBean.disableAddItemBtn}  From= #{false} and To= #{RegistrationBean.disableSearchCataBtn} Step 3) Add another command button inside the ActionButtonBarRegion with Text property = “Home” , Action property =” HomePage” and Immediate property set to true. Your registration page layout in structure window should look like:-

http://kohlivikram.blogspot.com/

our big fish.5 Creating ‘Edit Registration’ bounded task flow A task flow is one of the best new features introduced in the ADF 11g.This finishes the layout of the Registration page. We will now work with controller to define the flow of the system. ADF task flow defines the control flow in the application. executing http://kohlivikram.blogspot. The nodes in the application are called activities representing a logical operation such as displaying a UI page.com/ . 3.

It is a self contained unit of work that acts as a function.method in managed bean or application module or calling another task flow.com/ . And create two input parameters and one output parameter as follows hit Step 5) Add a router activity in the above created task flow with id=”RouteByMode”. For more learning on task flow http://www. Deselect the “page fragment” check box and click ok. Select parameters from the property inspector. It has single entry point. So it is better to create the registration page as a single unit of work. In this sample application. A router activity acts as an IF condition which transfers the control based on the expression language. There are two types of ADF task flows:Bounded task flow: . Step 2) In the create task flow window. a set of input parameters and one or more ways to return control. Open it in code editor. Step 3) Under the page flow directory your newly created task flow is added. set the file name as ‘Edit-Registration’ and select the “Create as Bounded Task Flow” check box. Question arises why? Because Registration page functionality can be considered as a single unit of work. Bounded task flows are called with in an unbounded task flow. Registration can either be displaying an existing registration.com/technology/oramag/oracle/08-sep/o58frame. ADF controller which is build up using task flows is implementation on top of JSF. Select “ADF Task Flow” from the Web TierJSF.It is a task flow with no boundaries and allows users to start at any page.html Steps to create the ‘Edit Registration’ bounded task flow Step 1) Select the ViewController right click it and select new. Step 4) Click on the blank area in the code editor. Unbounded task flow: .oracle. or will be used to create new registration. we will create one bounded task flow called ‘Edit registration’. And registration page will be called up from different view pages. http://kohlivikram.blogspot.

Set the ID of the new method activity as “CreateNewRegistration”. and drop it on the cod editor.com/ . specify two cases as below:- Step 7) Select the Method call activity from the component palette and drop it on the code editor. Step 13) set the control flow from the “CreateNewRegistration” to the “RegistrationPage”. And set the from-outcome to “Create” Step 10) Create another method activity with ID as “FindRegitration” . Step 11) Select the RegistrationPageVOOperations setCurrentRowWithKeyValue from the data control palette and drop it on the “FindRegistration” method activity. Connect RouteByMode to FindRegistration with from-outcome as “Edit”.regToEdit} and click ok. Step 19) set the control flow from “RegistrationPage” to “GoToHomePage” with fromoutcome property =” HomePage”. In the Edit Action bindings. Step 8) Now select the RegistrationPageVOOperationsCreateInsert from the data control palette and drop it on the CreateNewRegistration method activity. Your bounded task flow should look like:- http://kohlivikram. set the parameter value=#{pageFlowScope. Step 15) Drop a “Task Flow Return” activity on the page flow with name property = “CatalogPage” and id=” GoToCatalogPage” Step 16) Drop second task flow activity on the page flow with name property = “ItemListPage” and id=”GoToItemListPage”. Step 18) set the control flow from “RegistrationPage” to “GoToItemListPage” with from-outcome property =”ItemLitsPage”. Step 9) Select a control flow case from component palette and drag it from RouteByMode to CreateNewRegistration. Step 17) Drop yet another task flow activity on the bounded task flow with name property =”HomePage” and id=”GoToHomePage” Step 17) set the control flow from “RegistrationPage” to “GoToCatalogPage” with from-outcome property =”CatalogPage”. This from-outcome property is equivalent to the action property we have set for the Home command button in the registration page.jspx from the application navigator window. Step 12) Select the RegistrationPage. Now right click the “FindRegistration” activity and select “Edit Bindings”.blogspot.Step 6) Select the above created router activity. From the property inspector under the common node. Step 14) Again set the control flow from the “FindRegistration” to the “RegistrationPage”.

com/ . Step 2) Select SearchPageRegistrationVONamed Criteria SearchPageRegistrationVOCriteria and drop it on the MainPageRegion in structure window.3. And select QueryADF Query panel.blogspot.6 Creating Home page Step 1) Create your home page with name “HomePage” based on the created ADF template we created. http://kohlivikram.

Inline Detail Table option. Step 4) Now select the SearchPageRegistrationVO and drop it on the MainPageRegion and select the TablesADF Master Table.com/ . And set the text property =” Search Registration”. http://kohlivikram.Step 3) Expand the af:PanelGroupLayout and select af:panelHeader.blogspot.

blogspot. Select “model. http://kohlivikram. shift all the attributes from available attributes to display attributes except “RegistrationID”.view.com/ . And set the text property of the panel box to “Registration List”.SearchPageRegistrationVO”. And click ok. Step 8) Add a Panel Box layout from the component palette window in the structure window under MainPageRegion”. Steps 9) Add the above created table in step 5 inside the above created panel box.”Qty” and “Uom”. Step 7) Select the newly created af:table and set the following properties:ID = resultTbl Width=900.Step 5) From the “Edit Tree Binding” for the “model. Step 10) Select the af:query region and set the ResultComponentID property under the Behavior node to “::resultTbl”.view. It means that the query results will be shown in the above created table.SearchPageRegistrationLinesVO” rule and set display attributes as “ProductCode”. And set the width of the each column respectively as required. Step 6) Click on the “Add Rule” icon and select “SearchPageRegistrationLinesVO”.

disableSearchCataBtn} Your final structure window for the home page should look like:- http://kohlivikram. Step 14) Insert another action listener with From= #{true} and To= #{RegistrationBean. This mode method is acting as a input parameter for the ‘Edit-Registration’ bounded task flow we created in step 4 of 3. This action will put the value ‘New’ in the mode attribute.5 exercise.com/ .RegNum} Step 12) Inside the Action button bar add a command button with following property values:Text = New Registration Action =NewOrEdit Step 13) Right click your command button and select “Set Action Listener” as shown below:- In the “Insert Set Action Listener” set From = #{'New'} and To = #{requestScope.mode}.Step 11) Convert the output text for registration number to link with text property =#{row.disableAddItemBtn} Insert yet another action listener with From= #{true} and To= #{RegistrationBean.blogspot.

And then set the text property = #{bindings. Step 7) Select “UnitPrice” in RegistrationPageVOItemDetailsPageVO from data control palette and drop it on the first facet as “ADF Output Text w/ Label” Step 8) Under the second facet of the panel splitter.RegNum.com/ . add a separator under the panel header. Step 2) In the MainPageRegion. “Currency” and “Descr” in RegistrationPageVOItemDetailsPageVO from data control palette and drop it under above output text as ““ADF Input Text w/ Label”. Set the following property of newly created panel splitter SplitterPosition = 338 Inline style = width:620px. Step 3) Inside the header region.blogspot. We will create this page layout and after that in our last step in creation of this application. add a panel header region. Step 5) Select “ProductCode” in RegistrationPageVOItemDetailsPageVO from data control palette and drop it on the first facet as “ADF Output Text w/ Label” Step 6) Select “Qty” in RegistrationPageVOItemDetailsPageVO from data control palette and drop it under above output text as ““ADF Input Text w/ Label”. So the Save button will commit the http://kohlivikram.7 Creating Item Details page So we are now at final page of our application.3. we will define the application flow in ADF controller.inputValue}. drop the “Uom”. Step 9) Select OperationsCommit from the data control palette and drop it inside the ActionButtonBarRegion as adf button with Text = ‘Save’ and action =’ SaveRegLine’. And add another command button inside the ActionButtonBarRegion with Text=’Cancel’ and Action=’ SaveRegLine’. Step 4) Add a panel splitter component under the separator component. Item details page is used to create a new registration line in the existing reg Step 1) Create a new jspx page name “ItemDetailsPage” based on created page template.

We have done this setting at the RegsitrationEO entity level.jspx from the application navigator and drop it in the code editor.mode} for ‘mode’ parameter and value=#{requestScope.data as well as navigate to the Registration page. Check if the required indicator is appearing in the UI. Verify that the Creation date.regToEdit}. Step 2) Select the HomePage.regToEdit} for the regToEdit parameter. Run your application and see if you can create a new registration. but cancel will just navigate to registration page. Step 3) Now select the bounded task flow we have created “Edit Registration” from Page Flows folder and drop it on the code editor. And set the fromoutcome property to “NewOrEdit”. drag & drop it from “HomePage” activity to “Edit-Registration” activity. And define the out parameter ‘regToEdit’ with value= #{pageFlowScope. Step 4) Select the “Edit-Registration” and in the property inspector under the parameter node set the value=#{requestScope.8 Define Application flow in ADF Controller Step 1) Open the ViewControllerWeb ContentPage Flow and open adfc-config in 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”. Step 6) Select the CatalogueCategoryPage. It will show an error on it as the parameters expected by the bounded page flow has not been set yet. Now in both the command button add action listener with From= #{'Edit'} and To= #{requestScope.com/ .jspx from the application navigator window and drop it on the code editor. This NewOrEdit is the action property we set for the ‘NewRegistration’ command button. http://kohlivikram. Registration Number fields are getting shown with default values.blogspot. Step 5) Select the “Control Flow Case” from control flow in component palette. 3.mode} And your layout for the page Item details is ready.

CreateInsert operation insert a new blank row in the entity object.setProductCode(productCode).xml in code editor with id=’ CreateNewLine’. if(uom!=null) newGoodsLineRow. Add the following code in your application module Impl class:public void initilizeNewRegLines(String productCode. if(unitPrice!=null) newGoodsLineRow.setRegistrationId(new Number(regId)).getUom().executeQuery(). itemVO.setCurrency(currency).getItemDetailsPageVO(). if(currency!=null) newGoodsLineRow. String uom= itemRow. drag & drop it from ‘CatalogueCategoryPage’ to ‘CreateNewLine’ activity with from-outcome property= ‘CreateNewLine’. Step 9) Select the ‘Control Flow case’ from the component palette.getCurrentRow(). ViewObjectImpl newItemLineVO=this. itemVO. if(regId!=null) { try { newGoodsLineRow. itemVO. To achieve this we will write a custom method in application module Impl class which will set the required item details in the ItemDetailsPageVO.getCurrentRow().setCurrentRowAtRangeIndex(0). 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. if(manufacturer!=null) newGoodsLineRow. String manufacturer = itemRow.String regId) { ViewObjectImpl itemVO=getItemListVO(). Now select the RegistrationPageVOItemDetailsPageVOOperationsCreateInsert and drop it on the newly created method activity ‘CreateNewLine’.getUnitPrice(). String clause ="PRODUCT_CODE = '" + productCode + "'". Number unitPrice=itemRow. } catch (SQLException e) { } } } http://kohlivikram.setUom(uom).setWhereClause(clause). String currency= itemRow.setManufacturer(manufacturer). newGoodsLineRow.blogspot.getManufacturer(). ItemDetailsVORowImpl newGoodsLineRow=(ItemDetailsVORowImpl)newItemLineVO. Step 11) Now as the item details page gets rendered.com/ . Step 8) Select a method activity from the component palette and drop it on the adfcconfig. ItemVORowImpl itemRow=(ItemVORowImpl)itemVO. it gets rendered with the details of the item selected in the catalogue category page.getCurrency().setUnitPrice(unitPrice).Let’s proceed now with updating page flow so that user can add lines in the registration.

xml file in code editor. Step 16) Select the RegistrationPageVO-->RegLinesRegPageVO-->Operations->Execute from the data control palette and drop it on the adf-config. drag & drop it from ‘ItemDetailsPage’ to ‘ExecuteRegLines’ activity with from-outcome property= ‘SaveRegLine’. Run your application. follow the following steps:- http://kohlivikram. Step 15) Define a control flow from ItemDetailsPage view activity to Edit-Registration task flow call activity with from-outcome= SaveRegLine. To achieve this . Step 14) Select the ItemDetailsPage from the application navigator. 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. drag & drop it from ‘ExecuteRegLines’ to ‘Edit-Registration’ activity with from-outcome property= ‘Execute’. Step 18) Select the flow control from the component palette. Now run the application.blogspot. Step 19) Select the flow control from the component palette. Step 12) Select the initilizeNewRegLines from the data control palette and drop it on the adfc-config. And then define a control flow from the “Edit-Registration” to “HomePage” with from-outcome= HomePage. drag & drop it from ‘CreateNewLine’ to ‘initilizeNewRegLines’ activity with from-outcome property= ‘’CreateInsert’. Set the id of the activity to ExecuteRegLines. you should be able to create and save the registration. And define the control flow activity from ‘initilizeNewRegLines’ to ‘ItemDetailsPage’ activity with from-outcome= initilizeNewRegLines.xml in code editor. And then add the new line by clicking the “Add Item” button on the registration page. registration lines region in the registration page will show the added line in the registration.Add the above method in the application module client Interface. Step 17) Delete the control flow case between the ItemDetailsPage and EditRegistration. with home page. In the “Edit Action Binding” under the parameter section specify values as Step 13) Select the flow control from the component palette. drag and drop it in the adfc-config. 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.xml in code editor. To achieve this we have to execute the iterator with which the registration lines table is associated.com/ .

getRegistrationLinesVO().out. try { currRow. To achieve this open your home page.parseDouble(usdAmt).getAttribute("UsdAmount"). } System. Now you will be able add a line in registration from the item list page.next(). if(pfiAmt!=null) totalPfiAmt = totalPfiAmt + Double.regToEdit}" And finally.parseDouble(pfiAmt). Now under the registration number command link add the following two action listener under that as :1) from="#{'Edit'}" to="#{requestScope. Step 21) Define control flow from 'Edit-Registration' to 'ItemLitsPage' with fromoutcome='ItemListPage'. usdAmt=curItem.getEstimatedRowCount()!=0) { while (items.println("USD Amount= " + usdAmt + " .mode}"/> 2) from="#{row. RowSet items = (RowSet)currRow. currRow.xml in the code editor.com/ . Also we also have to open the exiting registration from the Home page.0. if(usdAmt!=null) totalUsdAmt = totalUsdAmt + Double. Add following code in the application module Impl class:- public void updateRegLinesAmt() { ViewObjectImpl vo = getRegistrationPageVO(). } catch (SQLException e) { } http://kohlivikram. fright and insurance) amount of the registration lines added in the registration.out. System. if(items.hasNext()) { Row curItem = items. String usdAmt=null. 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.pfiAmt=null.getAttribute("UsdPfiAmount"). And from the 'ItemListPage' to the 'CreateNewLine' method activity with from-outcome='CreateNewLine'.toString().0.setTotalUsdAmt(new Number(totalUsdAmt)).totalPfiAmt=0.setTotalPfiAmt(new Number(totalPfiAmt)). pfi Amt=" + pfiAmt).Step 20) Select the item list page from the application navigator and drop it on the adf-config. 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.toString(). double totalUsdAmt=0.getCurrentRow(). pfiAmt=curItem.blogspot.RegistrationId}" to="#{requestScope.println("totalPfiAmt="+totalPfiAmt + " totalUsdAmt= " + totalUsdAmt). RegistrationVORowImpl currRow= (RegistrationVORowImpl)vo.

Now open your Edit Registration page flow. select the updateRegLinesAmt from the data control palette and drop it in the code editor window in the 'Edit-Registration' page flow in between the 'FindRegistration' and RegistrationPage activity as shown below:- Procurement application is ready. } } Expose the above method in the application module client. I will keep working on the application and will improve it further and update the document.com/ .blogspot.//commit(). Test it and let me know how your feedback on this and and error in the documentation. http://kohlivikram. Please let me know any errors or suggestions to improve the document. Happy Learning.

Sign up to vote on this title
UsefulNot useful