From 96cc3eba87ecf3f3a2136f988d2da59a9e56416c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 16 Aug 2017 21:44:12 +0200 Subject: [PATCH] moved to jcustomer-core as this class is no longer pizzaservice-specific MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/customer/PizzaCustomer.java | 308 ------------------ 1 file changed, 308 deletions(-) delete mode 100644 src/org/mxchange/pizzaapplication/model/customer/PizzaCustomer.java diff --git a/src/org/mxchange/pizzaapplication/model/customer/PizzaCustomer.java b/src/org/mxchange/pizzaapplication/model/customer/PizzaCustomer.java deleted file mode 100644 index bfaf45b..0000000 --- a/src/org/mxchange/pizzaapplication/model/customer/PizzaCustomer.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.pizzaapplication.model.customer; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Index; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcustomercore.model.customer.Customer; -import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; - -/** - * A customer entity - *

- * @author Roland Häder - */ -@Entity (name = "customer") -@Table ( - name = "customer", - indexes = { - @Index (columnList = "customer_number", unique = true) - } -) -@NamedQueries ( - { - @NamedQuery (name = "AllCustomers", query = "SELECT c FROM customer AS c ORDER BY c.customerId ASC"), - @NamedQuery (name = "SearchCustomerByNumber", query = "SELECT c FROM customer AS c WHERE c.customerNumber = :customerNumber"), - @NamedQuery (name = "SearchCustomerById", query = "SELECT c FROM customer AS c WHERE c.customerId = :customerId") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class PizzaCustomer implements Customer { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 14_857_923_178_504_617L; - - /** - * Account status for this customer - */ - @Basic (optional = false) - @Enumerated (EnumType.STRING) - @Column (name = "customer_status", nullable = false) - private CustomerAccountStatus customerAccountStatus; - - /** - * Contact instance (personal data) - */ - @JoinColumn (name = "customer_contact_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) - private Contact customerContact; - - /** - * When this customer has been created - */ - @Basic (optional = false) - @Column (name = "customer_created", nullable = false, updatable = false) - @Temporal (TemporalType.TIMESTAMP) - private Calendar customerCreated; - - /** - * Id number for this entry - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "customer_id", nullable = false, updatable = false) - private Long customerId; - - /** - * When this customer has been locked (last timestamp) - */ - @Column (name = "customer_last_locked") - @Temporal (TemporalType.TIMESTAMP) - private Calendar customerLastLocked; - - /** - * Last locked reason - */ - @Lob - @Column (name = "customer_last_locked_reason") - private String customerLastLockedReason; - - /** - * Customer number - */ - @Basic (optional = false) - @Column (name = "customer_number", nullable = false, updatable = false) - private String customerNumber; - - /** - * When this customer has been updated - */ - @Column (name = "customer_updated") - @Temporal (TemporalType.TIMESTAMP) - private Calendar customerUpdated; - - /** - * Default constructor - */ - public PizzaCustomer () { - } - - /** - * Constructor with account status, contact instance and customer number - *

- * @param customerAccountStatus Account status (Call-agents may only call - * unlocked accounts) - * @param customerContact Contact instance - * @param customerNumber Customer number - */ - public PizzaCustomer (final CustomerAccountStatus customerAccountStatus, final Contact customerContact, final String customerNumber) { - // Call other constructor - this(); - - // Set all parameter - this.customerAccountStatus = customerAccountStatus; - this.customerContact = customerContact; - this.customerNumber = customerNumber; - } - - @Override - public void copyAll (final Customer customer) { - // Copy all supported fields - this.setCustomerAccountStatus(customer.getCustomerAccountStatus()); - this.setCustomerContact(customer.getCustomerContact()); - this.setCustomerCreated(customer.getCustomerCreated()); - this.setCustomerId(customer.getCustomerId()); - this.setCustomerLastLocked(customer.getCustomerLastLocked()); - this.setCustomerLastLockedReason(customer.getCustomerLastLockedReason()); - this.setCustomerNumber(customer.getCustomerNumber()); - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final Customer other = (Customer) object; - - if (!Objects.equals(this.getCustomerNumber(), other.getCustomerNumber())) { - return false; - } else if (!Objects.equals(this.getCustomerContact(), other.getCustomerContact())) { - return false; - } else if (!Objects.equals(this.getCustomerId(), other.getCustomerId())) { - return false; - } - - return true; - } - - @Override - public int hashCode () { - int hash = 7; - - hash = 53 * hash + Objects.hashCode(this.getCustomerContact()); - hash = 53 * hash + Objects.hashCode(this.getCustomerId()); - hash = 53 * hash + Objects.hashCode(this.getCustomerNumber()); - - return hash; - } - - @Override - public CustomerAccountStatus getCustomerAccountStatus () { - return this.customerAccountStatus; - } - - @Override - public void setCustomerAccountStatus (final CustomerAccountStatus customerStatus) { - this.customerAccountStatus = customerStatus; - } - - @Override - public String getCustomerConfirmKey () { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public void setCustomerConfirmKey (final String customerConfirmKey) { - throw new UnsupportedOperationException("Not supported yet."); //NOI18N - } - - @Override - public Contact getCustomerContact () { - return this.customerContact; - } - - @Override - public void setCustomerContact (final Contact customerContact) { - this.customerContact = customerContact; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getCustomerCreated () { - return this.customerCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCustomerCreated (final Calendar customerCreated) { - this.customerCreated = customerCreated; - } - - @Override - public Long getCustomerId () { - return this.customerId; - } - - @Override - public void setCustomerId (final Long customerId) { - this.customerId = customerId; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getCustomerLastLocked () { - return this.customerLastLocked; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCustomerLastLocked (final Calendar customerLastLocked) { - this.customerLastLocked = customerLastLocked; - } - - @Override - public String getCustomerLastLockedReason () { - return this.customerLastLockedReason; - } - - @Override - public void setCustomerLastLockedReason (final String customerLastLockedReason) { - this.customerLastLockedReason = customerLastLockedReason; - } - - @Override - public String getCustomerNumber () { - return this.customerNumber; - } - - @Override - public void setCustomerNumber (final String customerNumber) { - this.customerNumber = customerNumber; - } - - @Override - public String getCustomerPasswordHash () { - throw new UnsupportedOperationException("Unfinished"); //NOI18N - } - - @Override - public void setCustomerPasswordHash (final String customerPasswordHash) { - throw new UnsupportedOperationException("Unfinished"); //NOI18N - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getCustomerUpdated () { - return this.customerUpdated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setCustomerUpdated (final Calendar customerUpdated) { - this.customerUpdated = customerUpdated; - } - -} -- 2.39.2