From e1e8c600ed21522ee7fe1e58d51c0640cb75a7e3 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 9 Apr 2016 13:07:30 +0200 Subject: [PATCH] Some rewrites: - generic customer-related classes/interfaces has been moved to jcustomer-core. - reordered imports (sorted) - added jcustomer-core (new project) --- lib/jcustomer-core.jar | Bin 0 -> 5872 bytes nbproject/project.properties | 3 + .../CustomerAlreadyRegisteredException.java | 43 ----- .../jshopcore/model/customer/Customer.java | 155 ------------------ .../model/customer/CustomerUtils.java | 1 + .../model/customer/ShopCustomer.java | 3 +- .../status/CustomerAccountStatus.java | 66 -------- .../jshopcore/model/order/Orderable.java | 2 +- .../jshopcore/model/order/ShopOrder.java | 2 +- .../jshopcore/wrapper/CheckoutWrapper.java | 2 +- .../jshopcore/wrapper/WrapableCheckout.java | 2 +- 11 files changed, 10 insertions(+), 269 deletions(-) create mode 100644 lib/jcustomer-core.jar delete mode 100644 src/org/mxchange/jshopcore/exceptions/CustomerAlreadyRegisteredException.java delete mode 100644 src/org/mxchange/jshopcore/model/customer/Customer.java delete mode 100644 src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java diff --git a/lib/jcustomer-core.jar b/lib/jcustomer-core.jar new file mode 100644 index 0000000000000000000000000000000000000000..255e0d347367c857944ceb227a3bfb9b9528c550 GIT binary patch literal 5872 zcmb_gO>7&-6@J5itw>p-WJ#7BXJsokNkyXM*s&eCt{GaY8T}ciBtT67W3^gK>yTV^ zxk{`WIph+wK-xol=&h$*TeMEwv<=$k79c>b0dniLhoWc?y*23f_J>-o#I59df!*2J zeSh=j&G+8Sy@hB@B1#ecXy=D_$#->8jF#qBOOuu5`QkTU5Z!B$ehAXi&wug3F39;F zz}+HUDlJ#$=c=nyOY=)gLw~3>t;u!GZ0bhiHF;)gIwO@DzAvR+McvV4e8bNhQ?F*E zvZ*PSwl(?sKGR>HntpKY@}%CdG_#@9CO41dGjk-FEkjJjs3h8f0qF`Q9*tZKVFm}ZFbv2Yo6 zV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8jw#7N7#a(eJnxL0m=C?U<;`+{~6x+zA zqS>xbNcxz%?QS}j&Dh-@yL&30?X|mo*apNlqED$C8-b_PgI&N=>Z^WCf=A_eGHZ|c zMdZ_Q_#jV{@M^@hf0Cv^7a<&Jh{!;+^N|-@hIypFm$+@6YB>jB2dqaOfiVMLAH6?; zXN%Q$Am&$o)De}}QwIZWo5C(`!B&%$LorEQovKJs!d9_v@f5vRI&FVy`ro><$=bJ(wj`0(fo zJZN_CNX*ml(fjpq@jlPClF0u!APedaZhsGS{|80m@rUN=cZ$QHmS7=zpyg|n&Bxag XmexGYaoEi`mZra. - */ -package org.mxchange.jshopcore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jshopcore.model.customer.Customer; - -/** - * An exception thrown when the customer is already registered - *

- * @author Roland Haeder - */ -public class CustomerAlreadyRegisteredException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 16_435_892_878_271L; - - /** - * Constructor with already registered customer instance - *

- * @param customer Customer instance - */ - public CustomerAlreadyRegisteredException (final Customer customer) { - // Call super contructor - super(MessageFormat.format("Customer {0} already registered with number {1} at record id {2}. Maybe forgot to call isRegistered(customer) ?", customer, customer.getCustomerNumber(), customer.getCustomerId())); - } -} diff --git a/src/org/mxchange/jshopcore/model/customer/Customer.java b/src/org/mxchange/jshopcore/model/customer/Customer.java deleted file mode 100644 index d2bd2b3..0000000 --- a/src/org/mxchange/jshopcore/model/customer/Customer.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2016 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 . - */ -package org.mxchange.jshopcore.model.customer; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jshopcore.model.customer.status.CustomerAccountStatus; - -/** - * A customer interface - *

- * @author Roland Haeder - */ -public interface Customer extends Serializable { - - /** - * Copies all attributes from other customer object to this - *

- * @param customer Source instance - */ - void copyAll (final Customer customer); - - /** - * Getter for contact instance - *

- * @return Contact id number - */ - Contact getContact (); - - /** - * Setter for contact instance - *

- * @param contact Contact instance - */ - void setContact (final Contact contact); - - /** - * Getter for confirmation key - *

- * @return Confirmation key - */ - String getCustomerConfirmKey (); - - /** - * Setter for confirmation key - *

- * @param customerConfirmKey Confirmation key - */ - void setCustomerConfirmKey (final String customerConfirmKey); - - /** - * Getter for "created" timestamp - *

- * @return "created" timestamp - */ - Calendar getCustomerCreated (); - - /** - * Setter for "created" timestamp - *

- * @param customerCreated "created" timestamp - */ - void setCustomerCreated (final Calendar customerCreated); - - /** - * Getter for customer id number - *

- * @return Customer id number - */ - Long getCustomerId (); - - /** - * Settte for customer id number - *

- * @param customerId Customer id number - */ - void setCustomerId (final Long customerId); - - /** - * Getter for "locked" timestamp - *

- * @return "locked" timestamp - */ - Calendar getCustomerLocked (); - - /** - * Getter for "locked" timestamp - *

- * @param customerLocked "locked" timestamp - */ - void setCustomerLocked (final Calendar customerLocked); - - /** - * Getter for customer number - *

- * @return Customer number - */ - String getCustomerNumber (); - - /** - * Setter for customer number - *

- * @param customerNumber Customer number - */ - void setCustomerNumber (final String customerNumber); - - /** - * Getter for password hash - *

- * @return Password hash - */ - String getCustomerPasswordHash (); - - /** - * Setter for password hash - *

- * @param customerPasswordHash Password hash - */ - void setCustomerPasswordHash (final String customerPasswordHash); - - /** - * Getter for account status - *

- * @return Account status - */ - CustomerAccountStatus getCustomerAccountStatus (); - - /** - * Setter for account status - *

- * @param customerStatus Account status - */ - void setCustomerAccountStatus (final CustomerAccountStatus customerStatus); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); -} diff --git a/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java b/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java index f62d873..6a9950a 100644 --- a/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java +++ b/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java @@ -22,6 +22,7 @@ import javax.persistence.EntityNotFoundException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.Sha2Crypt; import org.mxchange.jcore.BaseFrameworkSystem; +import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.order.Orderable; import org.mxchange.jshopcore.model.order.ShopOrder; diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index 0165309..1fb9cc1 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -34,7 +34,8 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jshopcore.model.customer.status.CustomerAccountStatus; +import org.mxchange.jcustomercore.model.customer.Customer; +import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; /** * A shop customer class. diff --git a/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java b/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java deleted file mode 100644 index 1606ac5..0000000 --- a/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2016 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 . - */ -package org.mxchange.jshopcore.model.customer.status; - -import java.io.Serializable; - -/** - * An enumeration for customer's account status like confirmed, locked, etc. - *

- * @author Roland Haeder - */ -public enum CustomerAccountStatus implements Serializable { - - /** - * Unconfirmed (default) - */ - UNCONFIRMED("CUSTOMER_ACCOUNT_STATUS_UNCONFIRMED"), //NOI18N - - /** - * Confirmed (email address validated) - */ - CONFIRMED("CUSTOMER_ACCOUNT_STATUS_CONFIRMED"), //NOI18N - - /** - * Locked (maybe violated T&C) - */ - LOCKED("CUSTOMER_ACCOUNT_STATUS_LOCKED"); //NOI18N - - /** - * Message key - */ - private final String messageKey; - - /** - * Constructor with i18n translation key - *

- * @param messageKey Message key (i18n) - */ - private CustomerAccountStatus (final String messageKey) { - // Set it here - this.messageKey = messageKey; - } - - /** - * Output value (for messages) - *

- * @return the messageKey - */ - public String getMessageKey () { - return this.messageKey; - } -} diff --git a/src/org/mxchange/jshopcore/model/order/Orderable.java b/src/org/mxchange/jshopcore/model/order/Orderable.java index 6413df9..78a00e8 100644 --- a/src/org/mxchange/jshopcore/model/order/Orderable.java +++ b/src/org/mxchange/jshopcore/model/order/Orderable.java @@ -19,8 +19,8 @@ package org.mxchange.jshopcore.model.order; import java.io.Serializable; import java.util.Calendar; import java.util.List; +import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.customer.Customer; /** * An interface for customer orders diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java index 54a087c..e74ed09 100644 --- a/src/org/mxchange/jshopcore/model/order/ShopOrder.java +++ b/src/org/mxchange/jshopcore/model/order/ShopOrder.java @@ -31,8 +31,8 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.customer.Customer; import org.mxchange.jshopcore.model.customer.ShopCustomer; /** diff --git a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java index 6b64238..44e7dc0 100644 --- a/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java +++ b/src/org/mxchange/jshopcore/wrapper/CheckoutWrapper.java @@ -17,8 +17,8 @@ package org.mxchange.jshopcore.wrapper; import java.util.List; +import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.customer.Customer; /** * A wrapper for checkouts (customer, ordered items) diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java index 1bef0d8..0f31363 100644 --- a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java +++ b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java @@ -18,8 +18,8 @@ package org.mxchange.jshopcore.wrapper; import java.io.Serializable; import java.util.List; +import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.jshopcore.model.basket.AddableBasketItem; -import org.mxchange.jshopcore.model.customer.Customer; /** * An interface for checkout wrapper -- 2.39.5