What Happens When You Create an Input Form Using a Task Flow

Creating a Basic Databound Page 3-21

2. In the Property Inspector, enter a string for the fixed-outcome property. For

example, you might enter create as the fixed-outcome value. 3. Add a view activity that represents the page for the input form. For information on adding view activities, see the Using View Activities section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. 4. Add a control flow case from the method activity to the view activity. In the Property Inspector, enter the value of the fixed-outcome property of the method activity set in Step 2 as the value of the from-outcome of the control flow case. 5. Open the page for the view activity in the design editor, and from the Data Controls panel, drag the collection for which the form will be used to create a new record, and choose ADF Form from the context menu. For example, for the form to create addresses, you would drag the addresses accessor collection from the Data Controls panel. 6. In the task flow, add a return activity. This return activity must execute the commit operation on the data control. For these procedures, see the Using Task Flow Return Activities section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. 7. Add a control flow case from the view activity to the return activity. Set the fixed-outcome attribute to a text string. For example, you might set it to return .

8. From the Component Palette, drag and drop a button or other command

component that will be used to invoke the return activity. Set the action attribute to the text string set as the fixed-outcome created in Step 7.

3.7.2 What Happens When You Create an Input Form Using a Task Flow

When you use an ADF Form to create an input form, JDeveloper: ■ Creates an iterator binding for the accessor and an action binding for the Create operation in the page definition for the method activity. The Create operation is responsible for creating a row in the row set and populating the data source with the entered data. In the page definition for the page, JDeveloper creates an iterator Tip: If you want the user to be able to create multiple entries before committing to the database, do the following: 1. In the task flow, add another control flow case from the view activity back to the method activity, and enter a value for the from-outcome method. For example, you might enter createAnother. 2. Drag and drop a command component from the Component Palette onto the page, and set the action attribute to the from-outcome just created. This will cause the task flow to return to the method activity and reinvoke the Create operation. Tip: If when you set the return activity to execute the commit operation the activity shows an error, it is probably because the task flow itself is not set up to start a transaction. You need to set it to do so. For more information, see the Managing Transactions section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. 3-22 Java EE Developers Guide for Oracle Application Development Framework binding for the returned collection and attribute bindings for each of the attributes of the object in the collection, as for any other form. ■ Inserts code in the JSF page for the form using ADF Faces inputText components, and in the case of the operations, commandButton components. For example, the form shown in Figure 3–8 might be displayed by clicking a Create Address link on the main page. This link then navigates to the form where you can input data for a new address. Once the address is created, and you click the Save button, you return to the main page. Figure 3–9 shows a create-address-task-flow task flow with the newAddress method activity. Figure 3–9 Task Flow for an Input Form Example 3–12 shows the page definition file for the method activity. Example 3–12 Page Definition Code for a Creation Method Activity executables iterator Binds=root RangeSize=25 DataControl=SupplierFacadeLocal id=SupplierFacadeLocalIterator accessorIterator MasterBinding=SupplierFacadeLocalIterator Binds=addresses RangeSize=25 DataControl=SupplierFacadeLocal BeanClass=oracle.fodemo.supplier.model.Addresses id=addressesIterator executables bindings action IterBinding=addressesIterator id=Create RequiresUpdateModel=true Action=createRow bindings

3.7.3 What Happens at Runtime: Invoking the Create Action Binding from the Method Activity