From: Roland Haeder Date: Fri, 25 Sep 2015 10:39:37 +0000 (+0200) Subject: added a new enum for account status + updated jars X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3c20a10b2675eed767e7d900980a514c39e3c397;p=jcustomer-core.git added a new enum for account status + updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore.jar b/lib/jcore.jar index 2223e57..2fbc389 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 37a902e..648886a 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/src/org/mxchange/jshopcore/model/customer/Customer.java b/src/org/mxchange/jshopcore/model/customer/Customer.java index cbfe426..ffb8354 100644 --- a/src/org/mxchange/jshopcore/model/customer/Customer.java +++ b/src/org/mxchange/jshopcore/model/customer/Customer.java @@ -19,6 +19,7 @@ package org.mxchange.jshopcore.model.customer; import java.io.Serializable; import java.util.Calendar; import org.mxchange.jcore.model.contact.Contact; +import org.mxchange.jshopcore.model.customer.status.CustomerAccountStatus; /** * A customer interface @@ -137,12 +138,12 @@ public interface Customer extends Serializable { * * @return Account status */ - public String getCustomerStatus (); + public CustomerAccountStatus getCustomerAccountStatus (); /** * Setter for account status * * @param customerStatus Account status */ - public void setCustomerStatus (final String customerStatus); + public void setCustomerAccountStatus (final CustomerAccountStatus customerStatus); } diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index 7544264..3ea4c9c 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -30,6 +30,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jcore.model.contact.Contact; import org.mxchange.jcore.model.contact.UserContact; +import org.mxchange.jshopcore.model.customer.status.CustomerAccountStatus; /** * A shop customer class. @@ -97,8 +98,8 @@ public class ShopCustomer implements Customer { * Account status */ @Basic (optional = false) - @Column (name = "customer_status", nullable = false) - private String customerStatus; + @Column (name = "customer_account_status", nullable = false) + private CustomerAccountStatus customerAccountStatus; /** * Default constructor @@ -115,7 +116,7 @@ public class ShopCustomer implements Customer { this.setCustomerConfirmKey(customer.getCustomerConfirmKey()); this.setCustomerNumber(customer.getCustomerNumber()); this.setCustomerPasswordHash(customer.getCustomerPasswordHash()); - this.setCustomerStatus(customer.getCustomerStatus()); + this.setCustomerAccountStatus(customer.getCustomerAccountStatus()); this.setCustomerCreated(customer.getCustomerCreated()); this.setCustomerLocked(customer.getCustomerLocked()); } @@ -191,12 +192,12 @@ public class ShopCustomer implements Customer { } @Override - public String getCustomerStatus () { - return this.customerStatus; + public CustomerAccountStatus getCustomerAccountStatus () { + return this.customerAccountStatus; } @Override - public void setCustomerStatus (final String customerStatus) { - this.customerStatus = customerStatus; + public void setCustomerAccountStatus (final CustomerAccountStatus customerAccountStatus) { + this.customerAccountStatus = customerAccountStatus; } } diff --git a/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java b/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java new file mode 100644 index 0000000..5b41557 --- /dev/null +++ b/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java @@ -0,0 +1,65 @@ +/* + * 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 . + */ +package org.mxchange.jshopcore.model.customer.status; + +import java.io.Serializable; + +/** + * An enum 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 violeted 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; + } +}