Adding data access to business process portlets
Add data access in the form of business process messages to the Page Data view for process initiation and task processing portlets.
After creating business process portlets and importing business process message classes into a separate project, you can incorporate input and output messages for process initiation and task processing into the portlets.
To incorporate business process messages into business process portlets, follow these steps
- With the appropriate portlet page (JSP file) open, select
New | Business Process Message from the Page Data view pop up menu. The Business Process Messages wizard will open.
- Specify whether the message will be used to initiate a business process, or handle a task in the business process. Then, Browse to locate the message schema file (WSDL document) that contains the desired business process message. Click Next.
- The next page displays the defined port types, the operations inside each port type, and, finally, input/output messages for each operation. You can select any of the following data:
For example, in the figure below, the TravelRequestProcessStaff process has two operations defined (ApproveRequest and BookFlight), and each operation has an input and an output message. The input message for the ApproveRequest operation is selected. Details of that message are displayed in the tree to the right.
- A message
- Two messages (input and output) defined for the same operation. Two Page Data nodes are created.
- An operation. Page Data node(s) are created for each message defined for the operation.
- After making selections, click Finish. The wizard generates the necessary codebehind methods and Javadoc annotations based on the schema information, by referencing the WSDL file associated with the selected message. You must ensure that the WSDL file is not moved or deleted after the message page data has been created, because the reference would become invalid, and the message page data will not be properly visualized.
- If the input message (for process initiation) or the output message (for task processing) includes complex types (in the example below, FlightReservation and Requestor), they must be initialized in the getter method generated in the page code. Select
Edit Page Code from the portlet JSP file's menu, and type the initialization code in the corresponding getter method for the message. For the Websphere Portal 6.0 example, the following highlighted code must be added:
public Object getTravelRequestInput() { if (travelRequestInput == null) { travelRequestInput = getSessionScope().get( ProcessInitiationHelper.PROCESS_INPUT_MESSAGE); ((Map)travelRequestInput).put("Requestor", new Employee()); ((Map)travelRequestInput).put("FlightReservation", new FlightReservation()); } return travelRequestInput; }
Note: This is not required for task processing input messages, as they are already initialized. For the WebSphere® Portal V6.0 example, the following highlighted code must be added:
public Object getTravelRequestInput() { if (travelRequestInput == null) { travelRequestInput = getSessionScope().get( ProcessInitiationHelper.PROCESS_INPUT_MESSAGE); DataObject sdo = (DataObject)travelRequestInput; sdo.set("Requestor", sdo.createDataObject("Requestor")); sdo.set("FlightReservation", sdo.createDataObject("FlightReservation")); } return travelRequestInput; }The message schema is displayed in the Page Data view, and is ready to be bound to a Face user interface component.
Related concepts
Process initiation helper classes
Task processing helper classes
Related tasks
Creating a business process portlet project
Enabling business process portlets that use the Basic portlet model
Creating user interfaces for business processes
Developing business process portlets
Inserting images in portlet JSP files
Related reference
WebSphere Portal Documentation Library