You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/02/13 19:41:18 UTC
svn commit: r153653 [3/3] - in incubator/beehive/trunk/samples/petstoreWeb:
./ WEB-INF/ WEB-INF/src/
WEB-INF/src/org/apache/beehive/samples/petstore/controller/
WEB-INF/src/org/apache/beehive/samples/petstore/controls/
WEB-INF/src/org/apache/beehive/samples/petstore/controls/exceptions/
WEB-INF/src/org/apache/beehive/samples/petstore/controls/internal/
WEB-INF/src/org/apache/beehive/samples/petstore/forms/
WEB-INF/src/org/apache/beehive/samples/petstore/model/
WEB-INF/src/org/apache/beehive/samples/petstore/model/ws/
WEB-INF/tags/beehive/petstore/ account/create/ account/edit/ auth/
checkout/ search/ shop/ site/ webappRoot/
Modified: incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf?view=diff&r1=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf Sun Feb 13 10:41:07 2005
@@ -24,15 +24,23 @@
import org.apache.beehive.samples.petstore.forms.SearchForm;
import org.apache.beehive.samples.petstore.model.Product;
import org.apache.beehive.samples.petstore.controls.CatalogControl;
+import org.apache.beehive.controls.api.bean.Control;
@Jpf.Controller(
- nested = true
+ nested = true,
+ sharedFlowRefs={
+ @Jpf.SharedFlowRef(name="rootSharedFlow", type=webappRoot.SharedFlow.class)
+ }
)
-public class Controller extends PageFlowController
-{
- @org.apache.beehive.controls.api.bean.Control()
+public class Controller
+ extends PageFlowController {
+
+ @Control()
private CatalogControl _catalogControl;
+ @Jpf.SharedFlowField(name="rootSharedFlow")
+ private webappRoot.SharedFlow _sharedFlow;
+
@Jpf.Action(
forwards = {
@Jpf.Forward(name = "success", path = "index.jsp",
@@ -43,8 +51,7 @@
})
}
)
- protected Forward begin(SearchForm form)
- {
+ protected Forward begin(SearchForm form) {
Product[] searchResults = _catalogControl.searchProductList(form.getKeyword());
return new Forward("success", "searchResults", searchResults);
@@ -55,39 +62,7 @@
@Jpf.Forward(name = "done", returnAction = "begin")
}
)
- public Forward done()
- {
+ public Forward done() {
return new Forward("done");
}
-}
-@Jpf.ViewProperties(value = {
- "<!-- This data is auto-generated. Hand-editing this section is not recommended. -->",
- "<view-properties>",
- "<pageflow-object id='pageflow:/search/Controller.jpf'/>",
- "<pageflow-object id='page:index.jsp'>",
- " <property value='240' name='x'/>",
- " <property value='100' name='y'/>",
- "</pageflow-object>",
- "<pageflow-object id='action:globalViewProductById.do'><property name='x' value='240'/><property name='y' value='220'/></pageflow-object>",
- "<pageflow-object id='action:done.do'>",
- " <property value='400' name='x'/>",
- " <property value='100' name='y'/>",
- "</pageflow-object>",
- "<pageflow-object id='action-call:@page:index.jsp@#@action:globalViewProductById.do@'><property name='elbowsX' value='240,240,240,240'/><property name='elbowsY' value='144,160,160,176'/><property name='fromPort' value='South_1'/><property name='toPort' value='North_1'/></pageflow-object>",
- "<pageflow-object id='action-call:@page:index.jsp@#@action:done.do@'><property name='elbowsX' value='276,320,320,364'/><property name='elbowsY' value='92,92,92,92'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>",
- "<pageflow-object id='action:begin.do#org.apache.beehive.samples.petstore.forms.SearchForm'><property name='x' value='60'/><property name='y' value='100'/></pageflow-object>",
- "<pageflow-object id='control:org.apache.beehive.samples.petstore.controls.CatalogControl#_catalogControl'/>",
- "<pageflow-object id='exit:begin'>",
- " <property value='560' name='x'/>",
- " <property value='100' name='y'/>",
- "</pageflow-object>",
- "<pageflow-object id='forward:returnAction#done#begin#@action:done.do@'><property value='436,480,480,524' name='elbowsX'/><property value='92,92,92,92' name='elbowsY'/><property value='East_1' name='fromPort'/><property value='West_1' name='toPort'/><property value='done' name='label'/></pageflow-object>",
- "<pageflow-object id='forward:path#success#index.jsp#@action:begin.do#org.apache.beehive.samples.petstore.forms.SearchForm@'><property name='elbowsX' value='96,150,150,204'/><property name='elbowsY' value='92,92,92,92'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/><property name='label' value='success'/></pageflow-object>",
- "<pageflow-object id='formbean:org.apache.beehive.samples.petstore.forms.SearchForm'/>",
- "<pageflow-object id='action-output:searchResults#@forward:path#success#index.jsp#@action:begin.do#org.apache.beehive.samples.petstore.forms.SearchForm@@'/>",
- "</view-properties>"
-})
-interface VIEW_PROPERTIES
-{
-}
-
+}
\ No newline at end of file
Modified: incubator/beehive/trunk/samples/petstoreWeb/search/index.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/search/index.jsp?view=diff&r1=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/search/index.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/search/index.jsp Sun Feb 13 10:41:07 2005
@@ -32,13 +32,13 @@
<netui-data:repeaterItem>
<tr class="rowyellow">
<td class="celldata">
- <netui:imageAnchor action="globalViewProductById"border="0" src="${pageContext.request.contextPath}/images/${container.item.image}">
+ <netui:imageAnchor action="rootSharedFlow.globalViewProductById"border="0" src="${pageContext.request.contextPath}/images/${container.item.image}">
<netui:parameter name="productId" value="${container.item.productId}"/>
</netui:imageAnchor>
</td>
<td class="celldata">
<b>
- <netui:anchor action="globalViewProductById">
+ <netui:anchor action="rootSharedFlow.globalViewProductById">
<netui:parameter name="productId" value="${container.item.productId}"/>
<font color="black"><netui:span value="${container.item.productId}"/></font>
</netui:anchor>
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=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf Sun Feb 13 10:41:07 2005
@@ -31,6 +31,7 @@
import org.apache.beehive.samples.petstore.model.Item;
import org.apache.beehive.samples.petstore.model.LineItem;
import org.apache.beehive.samples.petstore.model.Product;
+import org.apache.beehive.controls.api.bean.Control;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
@@ -49,15 +50,14 @@
}
)
public class Controller
- extends PageFlowController
-{
+ extends PageFlowController {
+ @Control()
+ private CatalogControl _catalogControl;
+
@Jpf.SharedFlowField(name="rootSharedFlow")
private webappRoot.SharedFlow _sharedFlow = null;
- @org.apache.beehive.controls.api.bean.Control()
- private CatalogControl _catalogControl;
-
- // @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
@@ -66,8 +66,7 @@
private CartForm _cartForm;
- protected void onCreate()
- {
+ protected void onCreate() {
_cartForm = new CartForm();
_cartForm.setCart(_sharedFlow.getCart());
}
@@ -82,8 +81,7 @@
})
}
)
- protected Forward begin()
- {
+ protected Forward begin() {
if(_categories == null)
_categories = _catalogControl.getCategoryList();
@@ -103,8 +101,7 @@
})
}
)
- protected Forward viewCategory()
- {
+ protected Forward viewCategory() {
String categoryId = getRequest().getParameter("catId");
if(categoryId == null || categoryId.equals(""))
@@ -132,8 +129,7 @@
})
}
)
- protected Forward viewProduct()
- {
+ protected Forward viewProduct() {
String productId = getRequest().getParameter("productId");
if(productId == null || productId.equals(""))
@@ -148,8 +144,6 @@
return f;
}
- /**
- */
@Jpf.Action(
forwards = {
@Jpf.Forward(name = "item", path = "item.jsp",
@@ -163,8 +157,7 @@
})
}
)
- protected Forward viewItem()
- {
+ protected Forward viewItem() {
String itemId = getRequest().getParameter("itemId");
if(itemId == null || itemId.equals(""))
@@ -190,8 +183,7 @@
}),
@Jpf.Forward(name="cart", path="cart.jsp")
})
- protected Forward addItemToCart(CartForm form)
- {
+ protected Forward addItemToCart(CartForm form) {
Cart cart = form.getCart();
if (cart.containsItemId(form.getWorkingItemId()))
{
@@ -212,8 +204,7 @@
}
@Jpf.Action(useFormBean = "_cartForm", forwards={@Jpf.Forward(name="cart", path="cart.jsp")})
- protected Forward viewCart(CartForm form)
- {
+ protected Forward viewCart(CartForm form) {
return new Forward("cart");
}
@@ -227,8 +218,7 @@
required = false)
})
})
- protected Forward updateCartQuantities(CartForm form)
- {
+ protected Forward updateCartQuantities(CartForm form) {
return new Forward("cart", "product", _currentProduct);
}
@@ -243,113 +233,52 @@
}),
@Jpf.Forward(name="cart", path="cart.jsp")
})
- protected Forward removeItemFromCart(CartForm form)
- {
+ protected Forward removeItemFromCart(CartForm form) {
if(_cartForm.getCart().containsItemId(form.getWorkingItemId()))
_cartForm.getCart().removeItemById(form.getWorkingItemId());
return new Forward("cart", "product", _currentProduct);
}
- /**
- *
- */
public static class CartForm
- extends FormData
- {
+ extends FormData {
+
private String _workingItemId;
private Cart _cart;
- public void setCart(Cart cart)
- {
+ public void setCart(Cart cart) {
_cart = cart;
}
- public Cart getCart()
- {
+ public Cart getCart() {
return _cart;
}
- public void setWorkingItemId(String workingItemId)
- {
+ public void setWorkingItemId(String workingItemId) {
_workingItemId = workingItemId;
}
- public String getWorkingItemId()
- {
+ public String getWorkingItemId() {
return _workingItemId;
}
- public void reset(ActionMapping mapping, HttpServletRequest request)
- {
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
_workingItemId = null;
}
- public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
- {
+ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
List<LineItem> items = getCart().getLineItems();
- if(items != null && items.size() > 0)
- {
- for(int i = 0; i < items.size(); i++)
- {
+ if(items != null && items.size() > 0) {
+ for(int i = 0; i < items.size(); i++) {
errors.add("invalidQuantity" + i, new ActionError("order.error.invalidQuantity"));
}
}
-
+
return errors;
}
}
-}
-
-@Jpf.ViewProperties(value = {
- "<!-- This data is auto-generated. Hand-editing this section is not recommended. -->",
- "<view-properties>",
- "<pageflow-object id='pageflow:/shop/Controller.jpf'/>",
- "<pageflow-object id='page:cart.jsp'><property name='x' value='340'/><property name='y' value='340'/></pageflow-object>",
- "<pageflow-object id='page:category.jsp'><property name='x' value='260'/><property name='y' value='180'/></pageflow-object>",
- "<pageflow-object id='page:index.jsp'><property name='x' value='260'/><property name='y' value='80'/></pageflow-object>",
- "<pageflow-object id='page:item.jsp'><property name='x' value='660'/><property name='y' value='500'/></pageflow-object>",
- "<pageflow-object id='page:product.jsp'><property name='x' value='660'/><property name='y' value='180'/></pageflow-object>",
- "<pageflow-object id='formbean:CartForm'/>",
- "<pageflow-object id='action:begin.do'><property name='x' value='60'/><property name='y' value='80'/></pageflow-object>",
- "<pageflow-object id='action:viewCategory.do'><property name='x' value='60'/><property name='y' value='180'/></pageflow-object>",
- "<pageflow-object id='action:viewProduct.do'><property name='x' value='480'/><property name='y' value='180'/></pageflow-object>",
- "<pageflow-object id='action:viewItem.do'><property name='x' value='660'/><property name='y' value='340'/></pageflow-object>",
- "<pageflow-object id='action:addItemToCart.do#shop.Controller.CartForm'><property name='x' value='160'/><property name='y' value='340'/></pageflow-object>",
- "<pageflow-object id='action:viewCart.do#shop.Controller.CartForm'><property name='x' value='60'/><property name='y' value='500'/></pageflow-object>",
- "<pageflow-object id='action:updateCartQuantities.do#shop.Controller.CartForm'><property name='x' value='340'/><property name='y' value='500'/></pageflow-object>",
- "<pageflow-object id='action:removeItemFromCart.do#shop.Controller.CartForm'><property name='x' value='500'/><property name='y' value='500'/></pageflow-object>",
- "<pageflow-object id='control:org.apache.beehive.samples.petstore.controls.CatalogControl#_catalogControl'/>",
- "<pageflow-object id='forward:path#cart#cart.jsp'/>",
- "<pageflow-object id='forward:path#viewCart#viewCart.do'/>",
- "<pageflow-object id='forward:path#success#index.jsp#@action:begin.do@'><property name='elbowsX' value='96,160,160,224'/><property name='elbowsY' value='72,72,72,72'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/><property name='label' value='success'/></pageflow-object>",
- "<pageflow-object id='forward:path#category#category.jsp#@action:viewCategory.do@'><property name='elbowsX' value='96,160,160,224'/><property name='elbowsY' value='172,172,172,172'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/><property name='label' value='category'/></pageflow-object>",
- "<pageflow-object id='forward:path#product#product.jsp#@action:viewProduct.do@'><property name='elbowsX' value='516,570,570,624'/><property name='elbowsY' value='172,172,172,172'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/><property name='label' value='product'/></pageflow-object>",
- "<pageflow-object id='forward:path#item#item.jsp#@action:viewItem.do@'><property name='elbowsX' value='660,660,660,660'/><property name='elbowsY' value='384,420,420,456'/><property name='fromPort' value='South_1'/><property name='toPort' value='North_1'/><property name='label' value='item'/></pageflow-object>",
- "<pageflow-object id='forward:path#success#cart.jsp#@action:addItemToCart.do#shop.Controller.CartForm@'><property name='elbowsX' value='160,160,250,340'/><property name='elbowsY' value='296,296,296,296'/><property name='fromPort' value='North_1'/><property name='toPort' value='North_1'/><property name='label' value='success'/></pageflow-object>",
- "<pageflow-object id='forward:path#cart#cart.jsp#@action:updateCartQuantities.do#shop.Controller.CartForm@'><property name='elbowsX' value='304,304,304,304'/><property name='elbowsY' value='492,492,412,332'/><property name='fromPort' value='West_1'/><property name='toPort' value='West_1'/><property name='label' value='cart'/></pageflow-object>",
- "<pageflow-object id='forward:path#success#cart.jsp#@action:removeItemFromCart.do#shop.Controller.CartForm@'><property name='elbowsX' value='464,420,420,376'/><property name='elbowsY' value='492,492,343,343'/><property name='fromPort' value='West_1'/><property name='toPort' value='East_2'/><property name='label' value='success'/></pageflow-object>",
- "<pageflow-object id='action-output:categories#@forward:path#success#index.jsp#@action:begin.do@@'/>",
- "<pageflow-object id='action-output:category#@forward:path#category#category.jsp#@action:viewCategory.do@@'/>",
- "<pageflow-object id='action-output:products#@forward:path#category#category.jsp#@action:viewCategory.do@@'/>",
- "<pageflow-object id='action-output:product#@forward:path#product#product.jsp#@action:viewProduct.do@@'/>",
- "<pageflow-object id='action-output:items#@forward:path#product#product.jsp#@action:viewProduct.do@@'/>",
- "<pageflow-object id='action-output:product#@forward:path#item#item.jsp#@action:viewItem.do@@'/>",
- "<pageflow-object id='action-output:item#@forward:path#item#item.jsp#@action:viewItem.do@@'/>",
- "<pageflow-object id='action-output:myList#@forward:path#success#cart.jsp#@action:addItemToCart.do#shop.Controller.CartForm@@'/>",
- "<pageflow-object id='action-output:myList#@forward:path#cart#cart.jsp#@action:updateCartQuantities.do#shop.Controller.CartForm@@'/>",
- "<pageflow-object id='action-output:myList#@forward:path#success#cart.jsp#@action:removeItemFromCart.do#shop.Controller.CartForm@@'/>",
- "<pageflow-object id='action-call:@page:cart.jsp@#@action:viewItem.do@'><property name='elbowsX' value='376,500,500,624'/><property name='elbowsY' value='332,332,332,332'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>",
- "<pageflow-object id='action-call:@page:product.jsp@#@action:viewItem.do@'><property name='elbowsX' value='660,660,660,660'/><property name='elbowsY' value='224,260,260,296'/><property name='fromPort' value='South_1'/><property name='toPort' value='North_1'/></pageflow-object>",
- "<pageflow-object id='action-call:@page:cart.jsp@#@action:updateCartQuantities.do#shop.Controller.CartForm@'><property name='elbowsX' value='340,340,340,340'/><property name='elbowsY' value='384,420,420,456'/><property name='fromPort' value='South_1'/><property name='toPort' value='North_1'/></pageflow-object>",
- "<pageflow-object id='action-call:@page:category.jsp@#@action:viewProduct.do@'><property name='elbowsX' value='296,370,370,444'/><property name='elbowsY' value='172,172,172,172'/><property name='fromPort' value='East_1'/><property name='toPort' value='West_1'/></pageflow-object>",
- "</view-properties>"
-})
-interface VIEW_PROPERTIES
-{
-}
-
+}
\ No newline at end of file
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=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/shop/index.jsp Sun Feb 13 10:41:07 2005
@@ -39,12 +39,12 @@
<netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/>
<netui:errors/>
<map name="beehivepetstoremap">
- <area alt="Birds" coords="72,2,280,250" href="globalViewCategory.do?catId=BIRDS" shape="RECT" />
- <area alt="Fish" coords="2,180,72,250" href="globalViewCategory.do?catId=FISH" shape="RECT" />
- <area alt="Dogs" coords="60,250,130,320" href="globalViewCategory.do?catId=DOGS" shape="RECT" />
- <area alt="Reptiles" coords="140,270,210,340" href="globalViewCategory.do?catId=REPTILES" shape="RECT" />
- <area alt="Cats" coords="225,240,295,310" href="globalViewCategory.do?catId=CATS" shape="RECT" />
- <area alt="Birds" coords="280,180,350,250" href="globalViewCategory.do?catId=BIRDS" shape="RECT" />
+ <area alt="Birds" coords="72,2,280,250" href="rootSharedFlow.globalViewCategory.do?catId=BIRDS" shape="RECT" />
+ <area alt="Fish" coords="2,180,72,250" href="rootSharedFlow.globalViewCategory.do?catId=FISH" shape="RECT" />
+ <area alt="Dogs" coords="60,250,130,320" href="rootSharedFlow.globalViewCategory.do?catId=DOGS" shape="RECT" />
+ <area alt="Reptiles" coords="140,270,210,340" href="rootSharedFlow.globalViewCategory.do?catId=REPTILES" shape="RECT" />
+ <area alt="Cats" coords="225,240,295,310" href="rootSharedFlow.globalViewCategory.do?catId=CATS" shape="RECT" />
+ <area alt="Birds" coords="280,180,350,250" href="rootSharedFlow.globalViewCategory.do?catId=BIRDS" shape="RECT" />
</map>
<img vspace="10" hspace="15" border="0" height="347" width="357" src="${pageContext.request.contextPath}/images/splash.gif"
align="center" usemap="#beehivepetstoremap"/>
Modified: incubator/beehive/trunk/samples/petstoreWeb/site/emptyLeftNav.jsp
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/site/emptyLeftNav.jsp?view=diff&r1=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/site/emptyLeftNav.jsp (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/site/emptyLeftNav.jsp Sun Feb 13 10:41:07 2005
@@ -1,5 +1,5 @@
<%@page contentType="text/html;charset=UTF-8" language="java"%>
-<!-- start left nav -->
+<%-- start left nav --%>
-<!-- end left nav -->
+<%-- end left nav --%>
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=153652&r2=153653
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs Sun Feb 13 10:41:07 2005
@@ -17,8 +17,12 @@
*/
package webappRoot;
+import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
-import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.PageFlowException;
+import org.apache.beehive.netui.pageflow.NotLoggedInException;
+import org.apache.beehive.netui.pageflow.SharedFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
import org.apache.beehive.samples.petstore.forms.ReturnToForm;
import org.apache.beehive.samples.petstore.forms.SearchForm;
@@ -31,11 +35,6 @@
import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchAccountException;
import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException;
-/**
- * todo: one issue with exposing properties on a SharedFlow / GlobalApp is that they
- * are then bindable by all web clients; there needs to be a flag in netui-config.xml
- * that prevents this from happening.
- */
@Jpf.Controller(
catches={
@Jpf.Catch(method="handlePageFlowException", type=PageFlowException.class),
@@ -53,12 +52,11 @@
}
)
public class SharedFlow
- extends SharedFlowController
-{
- @org.apache.beehive.controls.api.bean.Control()
+ extends SharedFlowController {
+ @Control()
private CatalogControl _catalogControl;
- @org.apache.beehive.controls.api.bean.Control()
+ @Control()
private AccountControl _accountControl;
private Account _account = null;
@@ -67,8 +65,7 @@
private static String[] _categoryNames = null;
- protected void onCreate()
- {
+ protected void onCreate() {
// todo: move to ServletContext so it's cached for all users
Category[] categories = _catalogControl.getCategoryList();
_categoryNames = new String[categories.length];
@@ -83,14 +80,12 @@
* thrown when the the user is not logged in.
*/
public void ensureLogin()
- throws NotLoggedInException
- {
+ throws NotLoggedInException {
if (!isUserLoggedIn())
throw new NotLoggedInException("User not logged in", this);
}
- public void handleLogin(String username)
- {
+ 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
@@ -108,20 +103,17 @@
}
}
- public void handleLogout()
- {
+ public void handleLogout() {
setAccount(null);
setCart(null);
}
- public void handleCheckout()
- {
+ public void handleCheckout() {
setCart(null);
}
public void updateAccount(Account account)
- throws InvalidIdentifierException, NoSuchAccountException
- {
+ throws InvalidIdentifierException, NoSuchAccountException {
// update account info in globalApp
_account = account;
@@ -130,57 +122,48 @@
setMyList(_catalogControl.getProductListByCategory(account.getFavCategory()));
}
- public String[] getCategoryNames()
- {
+ public String[] getCategoryNames() {
return _categoryNames;
}
/**
* Determine if the user is logged into the website.
*/
- public boolean isUserLoggedIn()
- {
+ public boolean isUserLoggedIn() {
return _account == null ? false : true;
}
- public Product[] getMyList()
- {
+ public Product[] getMyList() {
return _myList;
}
- public Cart getCart()
- {
+ public Cart getCart() {
if(_cart == null)
_cart = new Cart();
return _cart;
}
- public Account getAccount()
- {
+ public Account getAccount() {
return _account;
}
- private void setAccount(Account account)
- {
+ private void setAccount(Account account) {
_account = account;
}
- private void setCart(Cart cart)
- {
+ private void setCart(Cart cart) {
_cart = cart;
}
- private void setMyList(Product[] myList)
- {
+ private void setMyList(Product[] myList) {
_myList = myList;
}
@Jpf.Action(
forwards={@Jpf.Forward(name="help", path="/help.jsp")}
)
- public Forward showHelp()
- {
+ public Forward showHelp() {
return new Forward("help");
}
@@ -191,8 +174,7 @@
@Jpf.Action(
forwards={@Jpf.Forward(name="auth", path="/auth/Controller.jpf")}
)
- public Forward signon()
- {
+ public Forward signon() {
ReturnToForm initForm = new ReturnToForm(false);
return new Forward("auth", initForm);
}
@@ -204,8 +186,7 @@
@Jpf.Action(
forwards={@Jpf.Forward(name="auth", path="/auth/Controller.jpf")}
)
- public Forward actionSignon()
- {
+ public Forward actionSignon() {
ReturnToForm initForm = new ReturnToForm(true);
return new Forward("auth", initForm);
}
@@ -213,8 +194,7 @@
@Jpf.Action(
forwards={@Jpf.Forward(name="search", path="/search/Controller.jpf")}
)
- public Forward search(SearchForm form)
- {
+ public Forward search(SearchForm form) {
return new Forward("search");
}
@@ -227,8 +207,7 @@
)
}
)
- public Forward globalShop()
- {
+ public Forward globalShop() {
return new Forward("shop");
}
@@ -242,8 +221,7 @@
@Jpf.Forward(name="currentPage", navigateTo=Jpf.NavigateTo.currentPage)
}
)
- public Forward loginDone(ReturnToForm initForm)
- {
+ public Forward loginDone(ReturnToForm initForm) {
if (initForm.getReturnToPreviousAction())
return new Forward("previousAction");
else return new Forward("currentPage");
@@ -254,8 +232,7 @@
@Jpf.Forward(name="errorPage", path="/error.jsp")
}
)
- protected Forward handleException(Exception ex, String actionName, String message, Object form)
- {
+ protected Forward handleException(Exception ex, String actionName, String message, Object form) {
System.err.print("[" + getRequest().getContextPath() + "] ");
System.err.println("Unhandled exception caught in SharedFlow.jpfs:");
ex.printStackTrace();
@@ -267,17 +244,14 @@
@Jpf.Forward(name="login", path="actionSignon.do")
}
)
- protected Forward handleNotLoggedInException(NotLoggedInException ex, String actionName, String message, Object form)
- {
+ protected Forward handleNotLoggedInException(NotLoggedInException ex, String actionName, String message, Object form) {
return new Forward("login");
}
@Jpf.ExceptionHandler()
public Forward handlePageFlowException(PageFlowException ex, String message, String action, Object form)
- throws java.io.IOException
- {
+ throws java.io.IOException {
ex.sendError(getRequest(), getResponse());
return null;
}
-
}