]> git.mxchange.org Git - jproduct-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Tue, 15 Sep 2015 13:25:32 +0000 (15:25 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 15 Sep 2015 13:25:32 +0000 (15:25 +0200)
- added checkout wrapper class and interface
- added method clear() for clearing the basket
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jshopcore/model/basket/BaseBasket.java
src/org/mxchange/jshopcore/model/basket/Basket.java
src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java [new file with mode: 0644]
src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java [new file with mode: 0644]

index 06755b11078997f6692976dc6f154f24f4b518ce..def592671a3dd94efca64bdb910b174ab4f968ef 100644 (file)
@@ -130,4 +130,10 @@ public abstract class BaseBasket<T extends AddableBasketItem> implements Basket<
                // Return it
                return isAdded;
        }
+
+       @Override
+       public void clear () {
+               // Deligate to deque
+               this.deque.clear();
+       }
 }
index f0824bb474d9ff04e12c17d89249f101cb13e989..ea7e899778a5e361eb4839877e56d9ee8ea6cbc1 100644 (file)
@@ -36,6 +36,11 @@ public interface Basket<T extends AddableBasketItem> extends Serializable {
         */
        public void addItem (final T item) throws BasketItemAlreadyAddedException;
 
+       /**
+        * Clears the basket instance
+        */
+       public void clear ();
+
        /**
         * Checks whether the given item has already been added by checking the
         * item's id.
diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java
new file mode 100644 (file)
index 0000000..2ee6882
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jshopcore.wrapper;
+
+import java.util.List;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.customer.Customer;
+
+/**
+ * A wrapper for checkouts (customer, ordered items)
+ *
+ * @author Roland Haeder
+ */
+public class CheckoutWrapper implements WrapableCheckout {
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 94_358_758_475_481_781L;
+
+       /**
+        * Customer instance
+        */
+       private Customer customer;
+
+       /**
+        * List instance
+        */
+       private List<AddableBasketItem> list;
+
+       /**
+        * Default constructor
+        */
+       public CheckoutWrapper () {
+       }
+
+       public Customer getCustomer () {
+               return this.customer;
+       }
+
+       public void setCustomer (final Customer customer) {
+               this.customer = customer;
+       }
+
+       public List<AddableBasketItem> getList () {
+               return this.list;
+       }
+
+       public void setList (final List<AddableBasketItem> list) {
+               this.list = list;
+       }
+
+}
diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java
new file mode 100644 (file)
index 0000000..7d5d9db
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jshopcore.wrapper;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.customer.Customer;
+
+/**
+ * An interface for checkout wrapper
+ *
+ * @author Roland Haeder
+ */
+public interface WrapableCheckout extends Serializable {
+
+       /**
+        * Getter for customer instance
+        *
+        * @return Customer indstance
+        */
+       public Customer getCustomer ();
+
+       /**
+        * Setter for customer instance
+        * @param customer Customer instance
+        */
+       public void setCustomer (final Customer customer);
+
+       /**
+        * Getter for a List of AddableBasktem instances
+        * @return List with AddableBasketItem instances
+        */
+       public List<AddableBasketItem> getList ();
+
+       /**
+        * Setter for a List of AddableBasktem instances
+        * @param list List with AddableBasketItem instances
+        */
+       public void setList (final List<AddableBasketItem> list);
+}