01 package handlingData.xmlBeans;
02 import com.bea.wlw.netui.pageflow.FormData;
03 import com.bea.wlw.netui.pageflow.Forward;
04 import com.bea.wlw.netui.pageflow.PageFlowController;
05 import java.sql.SQLException;
06 import org.openuri.bea.samples.workshop.xmlBeans.items.ItemsRowSetDocument;
07
08 /**
09 * This page flow shows how to handle XMLBean data types within a page flow.
10 *
11 * XMLBean dat is processed in the following way:
12 *
13 * (1) When this page flow is invoked, XMLBean data is returned from the database control
14 * into this controller file.
15 *
16 * (2) The XMLBean data is stored in the Form Bean instance _rows.
17 *
18 * (3) Finally, the XMLBean data is passed to the JSP page, index.jsp, for display.
19 *
20 * @jpf:controller
21 * @jpf:view-properties view-properties::
22 * <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
23 * <view-properties>
24 * <pageflow-object id="pageflow:/handlingData/xmlBeans/XmlBeansController.jpf"/>
25 * <pageflow-object id="action:begin.do#handlingData.xmlBeans.XmlBeansController.ItemsForm">
26 * <property value="60" name="x"/>
27 * <property value="40" name="y"/>
28 * </pageflow-object>
29 * <pageflow-object id="page:index.jsp">
30 * <property value="240" name="x"/>
31 * <property value="100" name="y"/>
32 * </pageflow-object>
33 * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do#handlingData.xmlBeans.XmlBeansController.ItemsForm@">
34 * <property value="96,150,150,204" name="elbowsX"/>
35 * <property value="32,32,92,92" name="elbowsY"/>
36 * <property value="East_1" name="fromPort"/>
37 * <property value="West_1" name="toPort"/>
38 * <property value="success" name="label"/>
39 * </pageflow-object>
40 * <pageflow-object id="control:handlingData.xmlBeans.ItemsDB#itemsDB">
41 * <property value="26" name="x"/>
42 * <property value="34" name="y"/>
43 * </pageflow-object>
44 * <pageflow-object id="formbeanprop:handlingData.xmlBeans.XmlBeansController.ItemsForm#rows#org.openuri.bea.samples.workshop.xmlBeans.items.ItemsRowSetDocument"/>
45 * <pageflow-object id="formbean:handlingData.xmlBeans.XmlBeansController.ItemsForm"/>
46 * </view-properties>
47 * ::
48 */
49 public class XmlBeansController extends PageFlowController
50 {
51 /**
52 * @common:control
53 */
54 private handlingData.xmlBeans.ItemsDB itemsDB;
55
56 /*
57 * Create an instance of the Form Bean ItemsForm.
58 * ItemsForm has one field of type ItemsRowSetDocument, an XMLBean type.
59 */
60 public ItemsForm _rows;
61
62 /**
63 * @jpf:action form="_rows"
64 * @jpf:forward name="success" path="index.jsp"
65 */
66 protected Forward begin(ItemsForm form)
67 throws SQLException
68 {
69 /*
70 * Call the database control method
71 * and load the results into
72 * the Form Bean instance _rows.
73 */
74 _rows.setRows( itemsDB.getAllItems() );
75
76 return new Forward( "success" );
77 }
78
79 public static class ItemsForm extends FormData
80 {
81 private ItemsRowSetDocument rows;
82
83 public void setRows(ItemsRowSetDocument rows)
84 {
85 this.rows = rows;
86 }
87
88 public ItemsRowSetDocument getRows()
89 {
90 return this.rows;
91 }
92 }
93 }
|