10 Salesquote Workflow Ui
10 Salesquote Workflow Ui
10 Salesquote Workflow Ui
This lab focuses on providing you hands-on experience with creating highly user-friendly
and rich user interface for your workflow tasks.
Oracle Fusion Middleware provides Application Development Framework, or ADF, for
creating rich internet applications. Oracle BPM Suite fully leverages that framework for its
workflow application. Naturally, task forms associated with a task are also ADF pages. These
task forms are user defined ADF pages created as part of a task flow and registered with the
workflow application so that when the user navigates to the task, the appropriate task form
is displayed alongside the task.
In this lab you implement user interfaces for three task flows:
1. Forms for entering a quote
2. Forms for reviewing the quote
3. Forms for approving the deal
Although you can use the Create Form wizard from the human task definition to create task
forms, you are limited to a default task-flow with a single page. Of course, you can then add
more pages to the flow, but these additional pages will have to be created using the standard
ADF page designer only. For this lab, you are creating moderately complex UI, hence you
won’t be using the automatic form generation feature.
Page 1 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.1
Do not distribute to third parties.
BPM 11g Foundation Training
To ease the page design, you are provided with page templates that already have the basic
page layout completed. You will be using these templates to create your task form pages.
Make sure that you follow the instruction for each task flow for copying in the appropriate
templates.
You now create the user interface for this user task for capturing the details of the quote.
10.4.1 Setup
You already have created default UI forms for all the human tasks in the process. In this lab
you recreate those same forms from ground up. In order to start from a clean slate you need
to delete all the UI projects from the JDeveloper application. Follow these steps for
removing the default UI projects:
1. Exit JDeveloper and save your existing application by copying it to another folder or
ZIPping it up. Make sure that you copy the full directory tree starting from the directory
that contains the application workspace file, SalesQuoteLab.jws
2. Start JDeveloper, open the Application Navigator, right-click the ApproveDealUILab
UI project, and select Delete Project.
3. In the Confirm Delete Project dialog window, select Remove project and delete all
of its contents
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 2
Do not distribute to third parties.
BPM 11g Foundation Training
FinalizeContractsUILab
Page 3 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
2. In the New Gallery window, select ADF Business Components in the Categories
panel and Business Components From Tables in the Items panel and click OK.
3. Create new database connection to the quote schema that you created. This connection
is part of the project. You can also browse for and copy the connection if you already
created one in the IDE.
4. Click OK
5. In the Entity Objects window, enter Package name as enterquoteui.adfbc and select
PRODUCT and TERM tables. If you don’t see the tables in the Available list, click on
the Query button to query the database.
6. Click Next
7. Click Next in the Updatable View Objects window, without selecting any object
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 4
Do not distribute to third parties.
BPM 11g Foundation Training
8. In the Read-Only View Objects window, click on Query to retrieve list of available
objects and select PRODUCT and TERMS and click Next.
You now have entity objects and corresponding view objects created for the underlying
PRODUCT and TERMS table. You use these via ADF Data Controls in the task form later
in this lab. Before you move on to creating the task forms, you need to update the
application module configuration to use the JDBC data source for the QUOTE schema.
First, create the JDBC data source as follows.
11. Open http://localhost:7001/console to start the Web Logic Server (WLS) console and
login using weblogic/welcome (replace the host and port and username/password to
match your own configuration).
12. On the left navigation bar, click Services > JDBC > Data Sources.
13. At the top of the data source table, click New.
Page 5 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
20. Select the Target server where your BPM component is running: soa_server1 or
AdminServer
21. Click Finish
Now update the application module configuration.
Application
22. Double-click on AppModule under EnterQuoteUILab
enterquoteui.adfbc to open the application module
Sources
23. Click on Configurations
24. Select AppModuleLocal and click on the Edit icon
25. Change in the Connection Type to JDBC DataSource and enter Datasource Name
as jdbc/quoteDS.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 6
Do not distribute to third parties.
BPM 11g Foundation Training
Page 7 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
3. In the Items panel. Select ADF Task Flow Based on Human Task and click OK.
4. In the SOA Resource Browser window, go one directory up and double-click the
QuoteProcessLab folder.
5. Select EnterQuoteDetails.task and click OK.
6. You should now see the Create Task Flow window. Select Create Train and click
on OK. Selecting Create Train creates a special type of task flow that allows sequential
flow pages which the ADF Controller manages. It also provides visual clues on the
progress of the “train” represented by “train stops” which the user can click to progress
through the flow.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 8
Do not distribute to third parties.
BPM 11g Foundation Training
7. Delete the taskDetails1_jspx view from the flow by right-clicking on the view icon and
selecting Delete from the pop-up menu.
8. Drag and drop a View from the components palette. Name it enterHeader.
9. Similarly drop in a view for the remaining pages. Make sure you drop them in the right
sequence and they will automatically get connected to each other in a flow. Name them
selectProduct, requestDiscount, requestTerms and submit.
10. Save All.
You just created the pages for each train stop. The last page, submit, should return from
this bounded task flow. To do that drag a Control Flow Case from the palette and drop it
on the submit page. This will allow you to connect that page to taskReturn. The control
flow can have an event associated with it. In this case, name the event endTaskFlow.
Your flow diagram should look like this:
Page 9 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
2. Create a new File System connection by clicking on the New Folder icon in the
Resource Palette as shown.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 10
Do not distribute to third parties.
BPM 11g Foundation Training
3. Enter the connection name as SalesQuoteUIadflib and choose the directory adflib. You
will find this directory at the same level as your lab docs folder
4. Click OK
5. Now, make sure that EnterQuoteUILab project is selected
6. Expand the SalesQuoteUIadflib folder
7. Right-click theADF library and select Add to Project.
8. Save All.
Now design the first page for entering the quote header information
9. Open the task flow, if not already open, by double-clicking on
EnterQuoteDetails_Taskflow under Page Flows in the Application Navigator.
10. Double-click the enterHeader view in the flow.
11. In the Create JSF Page window, select the page template Oracle BPM 11g Training –
Enter Header Template, leave other fields as they are and click OK.
A new JSF file enterHeader.jspx is opened in the ADF designer. This template has four
facets defined. Drag and drop EnterQuoteUILab_EnterQuoteDetails data controls from
the Data Controls panel as explained in the following steps
Page 11 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
12. Drag and drop the Task data control on the task-action facet. When you drop the
control, a pop-up menu appears. Select Human TaskTask Action. Click OK in the
two pop-ups that follow.
This adds the task action UI components with appropriate action and action listener setup.
13. Next, drop the Summary data control into the task-summary facet and select
ADF Form.
Form
14. In the Edit Form Fields window, delete the following fields and click OK
NewCustomer
TotalNetRevenue
EffectiveDiscount
15. The default form is laid out in a single column. You can have the fields layout in 3
columns. To do that, select on the form to set the structure panel context and then
select af:panelFormLayout under task-summary in the structure panel. In the
Property Inspector (on the right side), set the MaxColumns to 3 and Rows to 1.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 12
Do not distribute to third parties.
BPM 11g Foundation Training
16. Drag and drop the Address data control from under the Summary data control to the
task-summary-address facet.
ADF Form and then click OK in the Edit Form Fields window.
17. Choose Form
Now add the Contacts data control to the page. This time you want to create a table so that
the user can add multiple contacts.
18. Before you drop the control onto the page, drop a Panel Collection from the Layout
section of the Component Palette to the task-summary-contacts facet. A Panel
Collection layout container is useful for rendering collection types like tables. Drag and
drop Contacts data control to the new panel just added and choose Table ADF
Table. Click OK on the Edit Form Fields window.
Your first form is mostly complete, and just needs a few more additions. Your contacts table
needs a couple of buttons to add and delete contacts. The next few steps show you how to
do that.
19. Add a Toolbar from the components palette to the toolbar facet.
20. Expand the Contacts data control, and do the same for the Operations folder within it.
Drag and drop the Create and Delete operations to the toolbar. Choose the ADF
Toolbar Button as the UI component to use for these operations.
21. Select the CreateInsert button you just created and change the Text property in the
Property Inspector to Add.
22. Your form is now ready and should look like this:
Page 13 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
12. As before, create the task action buttons by dragging and dropping the Task data
control from the EnterQuoteUILab_EnterQuoteDetails data control, to the task-
action facet. Select Human TaskTask Action from the pop-up menu that appears.
Click OK in the two pop-ups that follow.
13. Add a Panel Collection layout container to the available-products facet.
14. Drag and drop ProductView1 data control from the AppModuleDataControl to the
panel collection. This data control is for the ADF BC view you created at the beginning
of this lab.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 14
Do not distribute to third parties.
BPM 11g Foundation Training
16. In the Edit Table Columns dialog, delete the following fields
Category
ImageURL
17. Select Row Selection checkbox and click OK. You now have a table of products to
select from.
Now create the target table which will refer to the product list in the human task payload.
18. Add a Panel Collection to the selected-products facet
19. Drag and drop the Product Item data control from within the Task payload to the
new panel
ADF Read-only Table as the UI component
20. Choose Table
RequestedDiscount
ControlledAvailability
22. You now have the full form complete and should look something like this:
Page 15 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
There are a few last steps you still need to complete to enable the drag and drop operation
so that the user can select a product in the Available Products table and drop it into the
Selected Products table.
23. In the Component Palette, open the Operations section and drop Drag Source onto
the Available Products table portion of the Available Product facet.
24. With the Drag Source selected in the Structure Panel, in the Property Inspector, set
the Actions to COPY, the DefaultAction to COPY and the Discriminant to
productItem.
25. Drop the Collection Drop Target to the Selected Products table. This will pop up a
dialog for specifying a DropListener. Click on the v to the right of the field to open the
expression editor and click on Method Expression Builder.
26. Clear any expression in the Expression box. Under the ADF Managed Beans folder,
expand the dropProduct node and select HandleDrop. Click OK and click OK again
to return to the designer.
27. With the Collection Drop Target selected in the Structure Panel, in the Property
Inspector, set the Actions to COPY, and the ModelName to productItem.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 16
Do not distribute to third parties.
BPM 11g Foundation Training
10.
Page 17 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
15. Now add the selected products as an ADF table by dropping the Product Item data
control to the new panel.
16. In the Edit Table window, delete the following columns:
RestrictedItem
ControlledAvailability
17. Save All.
18. Set all columns except Quantity and Requested Discount to read-only. It may be
easier to use the Structure Panel to select the column’s input text field.
19. Move the column Requested Discount to be after Quantity.
20. Change the component type of Quantity from a text input field to a number spin box
so that the user can increase or decrease the value instead of typing it.
Right-click on Quantity, select Convert To… and then select Input Number
Spinbox
Whenever the quantity changes or the discount changes, the fields in your Summary should
also automatically change. You have already associated the appropriate properties in the
discountHelper managed bean. But that value needs to be rendered every time it changes.
This is achieved using ADF’s partial page rendering feature. To use partial page rendering to
update these values follow these steps:
21. Set the Behavior property AutoSubmit to true for both Quantity and
RequestedDiscount input fields.
22. Select the Quantity column and change its Id property to cQuantity. Similarly change
the Id of the Requested Discount column to cRequestedDiscount. Make sure you
select the whole column and not the individual field. Use the Structure Panel if
necessary.
23. Select netRevenue input field and edit the PartialTriggers property to pop up the
Edit Property: Partial Triggers window and select the fields under the columns
cQuantity and cRequestedDiscount
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 18
Do not distribute to third parties.
BPM 11g Foundation Training
Note that the Ids of the fields may not be the same as in the above image.
24. Click OK
25. Repeat the same steps for the Effective Discount field.
Now do a bit of tidying up and you will have completed your third form. Notice that the
table width doesn’t fully occupy the page. To adjust that you need to:
26. Change StyleClass property of the panel collection that holds the table to use the style
AFStretchWidth. You can type this style name in or select it from the StyleClass
browser by clicking on the v.
27. Select the ADF Table and in the Appearance section of the property inspector set
ColumnStretching property to the Product Name column. This change will stretch
the product name column so that the table width occupies all available space.
To make this change, first select the Product Name column (not the input field in the
column) and note down the Id. Select this Id in the ColumnStretching property by
first selecting the table.
Page 19 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
6. Select the table and change the ColumnStretching property to the Id of the
Description column
Instead of the text fields that were generated for the Category and Type fields, you want to
use drop-down lists of existing term categories and types. The following steps show how to
do that.
7. Drag and drop a Select One Choice component onto the Category column (make
sure the full column is highlighted as you drop the component).
8. This pops up a window for selecting the source to be used for the value displayed in the
drop-down list. Click on Bind… and under the ADF Managed Beans node select
termChoices categoryChoices and click OK and click Next
9. In the Common Properties window set the Label to Category and click Finish.
10. Repeat the above steps for the Type column, this time select
termTypeChoices and set the Label to Type.
termChoices
You need to provide a way to add new terms or delete existing ones, so add a Toolbar to the
toolbar facet.
11. Add a Toolbar from the components palette to the toolbar facet.
12. To this toolbar add CreateInsert and Delete operations as ADF Buttons from the
Operations folder in the LicenseTerm data control
13. Change the Text property for CreateInsert button to Add.
14. Save all.
10.2 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 20
Do not distribute to third parties.
BPM 11g Foundation Training
AccountName
SalesRepName
TotalNetRevenue
EffectiveDiscount
ValidUntil
4. Set Effective Discount and the TotalNetRevnue fields to be read-only.
5. Update the form layout so that the fields are laid out in 3 columns
6. Add a Panel Collection to the products-discount facet
7. To this panel add the Product Item data control as a read-only ADF Table. Keep the
following columns and delete the rest:
ProductId
Productname
Quantity
RequestedDiscount
8. Add another Panel Collection to the license-terms facet.
9. Add License Term data control to this panel as a read-only ADF Table.
10. Drag and drop the top level Task data control onto the comments facet. In the pop-up
menu select Human Task ->Task Comment And Attachment.
11. Save All
12. Your page is now complete and should look something like this:
13. The last step is to set the default activity for this page flow. Open
EnterQuoteDetails_TaskFlow Overview tab (tabs are at the bottom) and select the
General tab on the left.
Page 21 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.2
Do not distribute to third parties.
BPM 11g Foundation Training
By default the work-list provides a Task History data control that allows you to set/edit the
next approver in the human workflow. In this case you need to set the details of the next
activity in the business process itself. Hence you need custom code that allows you to do
that.
As for the EnterQuote user interface, you are provided with compiled Java code for this.
Source code is also provided so that you can learn how to create such complex task flows.
10.3 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 22
Do not distribute to third parties.
BPM 11g Foundation Training
5. Delete the taskDetails1_jspx view from the flow by right-clicking on the view icon and
selecting Delete from the pop-up menu.
6. Drag and drop a View from the components palette. Name it review.
7. Select the wildcard control flow indicated by the blue asterisk and delete it. With this
change you are ensuring that the task flow will exit only through the review page.
8. Click on the Control Flow Case in the Control Flow section of the component palette
and connect review to taskReturn. Name the flow closeTaskFlow.
9. Your flow should look like this:
11. Add the templates library to this project the same way as you did for the earlier one.
Make sure you select the project BPReviewUILab in the Application Navigator
Page 23 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.3
Do not distribute to third parties.
BPM 11g Foundation Training
20. Add a Panel Collection to the product-discount facet. To this panel add Product
Item data control as an ADF read-only table.
21. Add a Panel Collection to the license-terms facet and add the License Term data
control as an ADF read-only table to this.
10.3 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 24
Do not distribute to third parties.
BPM 11g Foundation Training
29. Set the Default Activity as you did for the previous form
30. Save All.
Page 25 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.3
Do not distribute to third parties.
BPM 11g Foundation Training
10.4 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 26
Do not distribute to third parties.
BPM 11g Foundation Training
Page 27 Oracle Confidential. For authorized use only. Workflow UI with ADF 10.5
Do not distribute to third parties.
BPM 11g Foundation Training
0 Workflow UI with ADF Oracle Confidential. For authorized use only. Page 28
Do not distribute to third parties.