Author: ekoneil
Date: Wed Feb 23 09:20:10 2005
New Revision: 155030

URL: http://svn.apache.org/viewcvs?view=rev&rev=155030
Log:
PetstoreWeb fixes.

This finishes the cleanup related to SharedFlow data binding and adds the 
shared flow name to all of the expressions.

Also an action name (loginDone) into the rootSharedFlow namespace.

BB: self
Test: build / deploy / purchase an item


Modified:
    incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build.xml
    
incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/org/apache/beehive/samples/petstore/model/Cart.java
    incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf
    incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp
    incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf
    incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp
    incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp
    incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs

Modified: incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build.xml?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build.xml (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/build.xml Wed Feb 
23 09:20:10 2005
@@ -28,15 +28,15 @@
   <!-- deploy targets - move the app to the server -->
   <!-- =========================================== -->
   
-  <target name="deploy">
+  <target name="deploy" description="Deploy the webapp to a running server">
     <deploy-webapp webappDir="${basedir}" contextPath="${context.path}"/>
   </target>
 
-  <target name="undeploy">
+  <target name="undeploy" description="Undeploy the webapp from a running 
server">
     <undeploy-webapp contextPath="${context.path}"/>
   </target>
 
-  <target name="redeploy">
+  <target name="redeploy" description="Redeploy the webapp on a running 
server">
     <redeploy-webapp contextPath="${context.path}"/>
   </target>
   
@@ -44,10 +44,10 @@
   <!-- build - build the webapp                  -->
   <!-- ========================================= -->
 
-  <target name="build">
-    <deploy-netui webappDir="${basedir}" />
-    <deploy-wsm webappDir="${basedir}" />
-    <build-webapp webappDir="${basedir}" />
+  <target name="build" description="Build the webapp">
+    <deploy-netui webappDir="${basedir}"/>
+    <deploy-wsm webappDir="${basedir}"/>
+    <build-webapp webappDir="${basedir}"/>
   </target>
 
   
@@ -55,8 +55,8 @@
   <!-- clean - clean the webapp                  -->
   <!-- ========================================= -->
 
-  <target name="clean">
-    <clean-webapp webappDir="${basedir}" />
+  <target name="clean" description="Clean the webapp">
+    <clean-webapp webappDir="${basedir}"/>
   </target>
   
 </project>

Modified: 
incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/org/apache/beehive/samples/petstore/model/Cart.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/org/apache/beehive/samples/petstore/model/Cart.java?view=diff&r1=155029&r2=155030
==============================================================================
--- 
incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/org/apache/beehive/samples/petstore/model/Cart.java
 (original)
+++ 
incubator/beehive/trunk/samples/petstoreWeb/WEB-INF/src/org/apache/beehive/samples/petstore/model/Cart.java
 Wed Feb 23 09:20:10 2005
@@ -17,8 +17,10 @@
  */
 package org.apache.beehive.samples.petstore.model;
 
-import java.math.*;
-import java.util.*;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /**
  * 

Modified: incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf Wed Feb 23 
09:20:10 2005
@@ -62,7 +62,7 @@
             @Jpf.Forward(name = "failure", path = "loginError.jsp"),
             @Jpf.Forward(
                 name = "success", 
-                returnAction = "loginDone", 
+                returnAction = "rootSharedFlow.loginDone", 
                 outputFormBean = "_initForm"
             )
         }
@@ -72,8 +72,7 @@
 
         if(!_sharedFlow.isUserLoggedIn())
             return new Forward("failure");
-
-        return new Forward("success");
+        else return new Forward("success");
     }
 
     @Jpf.Action(

Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp Wed Feb 
23 09:20:10 2005
@@ -17,7 +17,6 @@
     <center>
     <netui:span styleClass="boldlabel" 
value="${bundle.view.checkoutSummaryLabel}"/>
     <br/>
-    <br/>
     <table class="tablegreen">
         <tr class="rowgrey">
             <td class="celldata"><b>${bundle.view.itemIdLabel}</b></td>
@@ -28,7 +27,7 @@
             <td class="celldata"><b>${bundle.view.listPriceLabel}</b></td>
             <td class="celldata"><b>${bundle.view.totalCostLabel}</b></td>
         </tr>
-        <netui-data:repeater dataSource="sharedFlow.cart.lineItems">
+        <netui-data:repeater 
dataSource="sharedFlow.rootSharedFlow.cart.lineItems">
             <tr class="rowyellow">
                 <td class="celldata">
                 <b>
@@ -69,7 +68,7 @@
         </netui-data:repeater>
         <tr class="rowyellow">
             <td class="celldata" colspan="7" align="right">
-            <b>Sub Total: <netui:span value="${sharedFlow.cart.subTotal}">
+            <b>Sub Total: <netui:span 
value="${sharedFlow.rootSharedFlow.cart.subTotal}">
             <netui:formatNumber pattern="${bundle.view.priceFormat}"/>
             </netui:span> </b> <br/>
             </td>

Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf Wed Feb 23 
09:20:10 2005
@@ -51,13 +51,14 @@
 )
 public class Controller
     extends PageFlowController {
+
     @Control()
     private CatalogControl _catalogControl;
 
     @Jpf.SharedFlowField(name="rootSharedFlow")
     private webappRoot.SharedFlow _sharedFlow = null;
 
-    /* @todo: this should be shared for all users */
+    /* todo: this should be shared for all users */
     private Category[] _categories; // the list of categories
 
     private Category _currentCategory; // the current category being viewed
@@ -197,7 +198,7 @@
                 toAddItem.setProduct(_currentProduct);
                 cart.addItem(toAddItem);
             }
-            // @todo: error handling path
+            /* todo: error handling path */
         }
 
         return new Forward("cart", "product", _currentProduct);

Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp Wed Feb 23 
09:20:10 2005
@@ -7,17 +7,14 @@
 <%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %>
 <netui-data:declarePageInput name="myList" 
type="org.apache.beehive.samples.petstore.model.Product[]" required="false"/>
 
-
-
-
 <netui-template:template templatePage="/site/template.jsp">
     <netui-template:section name="leftnav">
         <netui-data:declareBundle 
bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/>
         <beehive-petstore:catalogNav action="begin" 
labelValue="${bundle.view.mainMenuLabel}"/>
         <br/>
         <c:choose>
-            <c:when test="${sharedFlow.account != null}">
-                <c:if test="${sharedFlow.account.myListOpt != null}">
+            <c:when test="${sharedFlow.rootSharedFlow.account != null}">
+                <c:if test="${sharedFlow.rootSharedFlow.account.myListOpt != 
null}">
                     <beehive-petstore:productFavorites/>
                 </c:if>
             </c:when>

Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp Wed Feb 23 
09:20:10 2005
@@ -14,8 +14,8 @@
         <tbody>
         <tr class="rowyellow">
           <td>
-          <c:if test="${sharedFlow.account != null}">
-              <netui:span styleClass="meditaliclabel" 
value="${bundle.view.welcomeLabel} ${sharedFlow.account.firstName}"/>!
+          <c:if test="${sharedFlow.rootSharedFlow.account != null}">
+              <netui:span styleClass="meditaliclabel" 
value="${bundle.view.welcomeLabel} 
${sharedFlow.rootSharedFlow.account.firstName}"/>!
           </c:if>
           &nbsp;
           </td>

Modified: incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs?view=diff&r1=155029&r2=155030
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs 
(original)
+++ incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs Wed 
Feb 23 09:20:10 2005
@@ -53,6 +53,9 @@
 )
 public class SharedFlow
     extends SharedFlowController {
+
+    private static String[] CATEGORY_NAMES = null;
+
     @Control()
     private CatalogControl _catalogControl;
 
@@ -63,15 +66,13 @@
     private Cart _cart = null;
     private Product[] _myList;
 
-    private static String[] _categoryNames = null;
-
     protected void onCreate() {
         // todo: move to ServletContext so it's cached for all users
         Category[] categories = _catalogControl.getCategoryList();
-        _categoryNames = new String[categories.length];
-        for(int i = 0; i < _categoryNames.length; i++)
+        CATEGORY_NAMES = new String[categories.length];
+        for(int i = 0; i < CATEGORY_NAMES.length; i++)
         {
-            _categoryNames[i] = categories[i].getCatId();
+            CATEGORY_NAMES[i] = categories[i].getCatId();
         }
     }
 
@@ -88,7 +89,7 @@
     public void handleLogin(String username) {
         Account account = _accountControl.getAccount(username);
 
-        // @todo: need to fix the case where the account isn't found for this 
username
+        /* @todo: need to fix the case where the account isn't found for this 
username */
         if(account == null)
             return;
         
@@ -123,7 +124,7 @@
     }
     
     public String[] getCategoryNames() {
-        return _categoryNames;
+        return CATEGORY_NAMES;
     }
 
     /**


Reply via email to