]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Renamed more stuff for fixes + updated jcore
authorRoland Haeder <roland@mxchange.org>
Wed, 26 Aug 2015 13:33:52 +0000 (15:33 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 26 Aug 2015 13:33:52 +0000 (15:33 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jcore.jar
src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/basket/BaseBasket.java
src/java/org/mxchange/pizzaapplication/database/basket/BasketDatabaseConstants.java
src/java/org/mxchange/pizzaapplication/database/frontend/basket/BasketDatabaseFrontend.java
src/java/org/mxchange/pizzaapplication/filter/servlet/basket/BasketItemAddedFilter.java
src/java/org/mxchange/pizzaapplication/item/BaseItem.java
web/index.jsp

index 03f8053610357bd974371cda9b66d6e5dddfcd39..f4bdc108ad5046a41cac1bfec183ec3cace35b8f 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 378291058af45c260f667f969fe408c86a6daf19..88886d5d0f823676e4828965133371e0de0cd389 100644 (file)
@@ -45,12 +45,12 @@ public interface PizzaApplication extends Application {
        /**
         * HTTP parameter "item_id"
         */
-       public static final String HTTP_PARAM_ITEM_ID = "item_id"; //NOI18N
+       public static final String HTTP_PARAM_ITEM_ID = "itemId"; //NOI18N
 
        /**
         * HTTP parameter "type"
         */
-       public static final String HTTP_PARAM_ITEM_TYPE = "type"; //NOI18N
+       public static final String HTTP_PARAM_ITEM_TYPE = "itemType"; //NOI18N
 
        /**
         * Session key "ordered"
index 459d6c7d98fcd7cde77491c690d4181f58b1f98b..51e3d3779c403ba78c723cb50edd23f580e3f66e 100644 (file)
@@ -167,7 +167,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -219,7 +219,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -282,7 +282,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -326,7 +326,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -363,7 +363,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -401,7 +401,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -448,7 +448,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -525,7 +525,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                this.getLogger().trace(MessageFormat.format("session={0},key={1} - CALLED", session, key)); //NOI18N
 
                // Are both parameter not null?
-               if (session == null) {
+               if (null == session) {
                        // Abort here
                        throw new NullPointerException("session is null"); //NOI18N
                } else  if (key == null) {
@@ -612,7 +612,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -688,7 +688,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -755,7 +755,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -835,7 +835,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -863,7 +863,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -912,7 +912,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -940,7 +940,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                if (null == product) {
                        // Not set
                        throw new NullPointerException("product is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
@@ -1041,7 +1041,7 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                } else if (request == null) {
                        // Not set
                        throw new NullPointerException("request is null"); //NOI18N
-               } else if (session == null) {
+               } else if (null == session) {
                        // Not set
                        throw new NullPointerException("session is null"); //NOI18N
                }
index 79633d7b160369a4ca40c1e8d20b567494a34be7..819b853d0cc1cbea9206852526c90f0c0bd56037 100644 (file)
@@ -170,6 +170,8 @@ public class BaseBasket<T extends AddableBasketItem> extends BaseFrameworkSystem
                this.getLogger().trace(MessageFormat.format("in={0} - CALLED!", in));
 
                try {
+                       // Init everything else
+
                        // Init frontend
                        BasketFrontend frontend = new BasketDatabaseFrontend();
 
index 58a6dd599f4c675adc107a1359a70f5245048b49..91ede812a5d562d701699fc9c88176e03097c8a3 100644 (file)
@@ -40,7 +40,7 @@ public final class BasketDatabaseConstants {
        /**
         * Column for product type
         */
-       public static final String COLUMN_PRODUCT_TYPE = "item_type"; //NOI18N
+       public static final String COLUMN_ITEM_TYPE = "item_type"; //NOI18N
 
        /**
         * Column for session id or any unique identifier
index e261e63de253a4b7975b87280897e6e1b0d49d6f..b6097c9b1db68525cfd3cbe4949dc35c21bb8841 100644 (file)
@@ -22,6 +22,7 @@ import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.Map;
+import org.mxchange.jcore.criteria.logical.and.AndLogicalMatcher;
 import org.mxchange.jcore.criteria.searchable.SearchCriteria;
 import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
 import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
@@ -82,7 +83,7 @@ public class BasketDatabaseFrontend extends BaseDatabaseFrontend implements Bask
                this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_ID, item.getItemId());
                this.addToDataSet(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
                this.addToDataSet(BasketDatabaseConstants.COLUMN_AMOUNT, item.getAmount());
-               this.addToDataSet(BasketDatabaseConstants.COLUMN_PRODUCT_TYPE, item.getItemType());
+               this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_TYPE, item.getItemType());
 
                // Handle this over to the backend
                // @todo Nothing is done yet!
@@ -305,6 +306,9 @@ public class BasketDatabaseFrontend extends BaseDatabaseFrontend implements Bask
                criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
                criteria.setLimit(1);
 
+               // Set AND logical matcher
+               criteria.setLogical(new AndLogicalMatcher());
+
                // Now search for it
                Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
 
index 7b20ca2fa035bb9973d02e02a1f3d7af9361122a..13b96c95a2b2e48703a7239e25b6bd0449cdcd08 100644 (file)
@@ -80,6 +80,9 @@ public class BasketItemAddedFilter extends BaseServletFilter implements Filter {
                // Now it is secure to cast
                AddableBasketItem item = (AddableBasketItem) object;
 
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount()));
+
                // Init instance
                Basket<AddableBasketItem> basket;
                try {
@@ -90,7 +93,7 @@ public class BasketItemAddedFilter extends BaseServletFilter implements Filter {
                        this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
 
                        // Should not be null
-                       if (session == null) {
+                       if (null == session) {
                                // session is null
                                throw new NullPointerException("session is null"); //NOI18N
                        }
@@ -99,15 +102,21 @@ public class BasketItemAddedFilter extends BaseServletFilter implements Filter {
                        basket = ItemBasket.getInstance(session);
 
                        // Is the item already added?
-                       if ((item.getAmount() == null) || (item.getAmount() == 0)) {
+                       if (item.getItemId() == null) {
+                               // Item id is not set
+                               throw new NullPointerException(MessageFormat.format("item id of item={0} is null", item)); //NOI18N
+                       } else if (item.getItemType() == null) {
+                               // Item type is not set
+                               throw new NullPointerException(MessageFormat.format("item type of item={0} is null", item)); //NOI18N
+                       } else if ((item.getAmount() == null) || (item.getAmount() == 0)) {
                                // Debug message
-                               this.getLogger().debug("Amount for item " + item + " is null");
+                               this.getLogger().debug(MessageFormat.format("Amount for item {0} is null", item)); //NOI18N
 
                                // Amount is not entered
                                return;
                        } else if (basket.isItemAdded(item)) {
                                // Yes, then throw exception here
-                               throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getItemId()));
+                               throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getItemId())); //NOI18N
                        }
 
                        // Register item with it
index 7670ce41e1981340935403d7b5d01459d17354d1..43df54f8a9f156ecb4e60452c2f0a5be7d75ea3d 100644 (file)
@@ -62,7 +62,7 @@ public class BaseItem extends BaseFrameworkSystem implements AddableBasketItem {
                }
 
                // Debug message
-               this.getLogger().debug(MessageFormat.format("this.id={0},item.id={1}", this.getItemId(), item.getItemId())); //NOI18N
+               this.getLogger().debug(MessageFormat.format("this.itemId={0},item.itemId={1}", this.getItemId(), item.getItemId())); //NOI18N
 
                // Is the id the same?
                if (Objects.equals(this.getItemId(), item.getItemId())) {
index e9013807a3406a90e7f921c2e46ef2012a85377e..a0757c000ac7115962d453e78e59c2e9ac567065 100644 (file)
                                        // Get product instance
                                        Product product = iterator.next();
 
+                                       // Debug message
+                                       product.getLogger().debug("product.itemId=" + product.getItemId());
+
                                        // Get basket instance
                                        Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
 
                                        // Create an item instance form this product
                                        AddableBasketItem item = basket.getItem(product);
 
+                                       // Debug message
+                                       product.getLogger().debug("item=" + item);
+
                                        // Has it been already added to the basket?
                                        if (item != null) {
                                                // Some nice output ...