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
*
* @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);
}
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.
* 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
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());
}
}
@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;
}
}
--- /dev/null
+/*
+ * 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.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;
+ }
+}