From 1e0770c4c00639e1bdc5eab21478ebddacd06bf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 23 Apr 2020 09:55:51 +0200 Subject: [PATCH] Don't cherry-pick: - swapped out bonus_card entity to new jbonuscard-core project - JavaEE 7.0 API is no longer used here MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- nbproject/project.properties | 17 +- .../model/bonus_card/BonusCard.java | 149 -------- .../model/bonus_card/FinancialBonusCard.java | 326 ------------------ .../model/receipt/BillableReceipt.java | 2 +- .../model/receipt/FinancialReceipt.java | 6 +- 5 files changed, 18 insertions(+), 482 deletions(-) delete mode 100644 src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java delete mode 100644 src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java diff --git a/nbproject/project.properties b/nbproject/project.properties index a6af727..bdc3aae 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -30,6 +30,7 @@ dist.jar=${dist.dir}/jfinancials-core.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= +file.reference.jbonuscard-core.jar=lib/jbonuscard-core.jar file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar file.reference.jcontacts-core.jar=lib/jcontacts-core.jar file.reference.jcore-utils.jar=lib/jcore-utils.jar @@ -43,6 +44,7 @@ jar.archive.disabled=${jnlp.enabled} jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ + ${file.reference.jcore-utils.jar}:\ ${file.reference.jcountry-core.jar}:\ ${file.reference.jphone-core.jar}:\ ${file.reference.juser-core.jar}:\ @@ -50,10 +52,9 @@ javac.classpath=\ ${file.reference.jcontacts-business-core.jar}:\ ${file.reference.jcustomer-core.jar}:\ ${file.reference.jproduct-core.jar}:\ - ${file.reference.jcore-utils.jar}:\ + ${file.reference.jbonuscard-core.jar}:\ ${libs.commons-lang3.classpath}:\ - ${libs.jpa20-persistence.classpath}:\ - ${libs.javaee-api-7.0.classpath} + ${libs.jpa20-persistence.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation javac.deprecation=true @@ -74,6 +75,15 @@ javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=true +javadoc.reference.jbonuscard-core.jar=https://docs.mxchange.org/javadoc/jbonuscard-core/ +javadoc.reference.jcontacts-business-core.jar=https://docs.mxchange.org/javadoc/jcontacts-business-core/ +javadoc.reference.jcontacts-core.jar=https://docs.mxchange.org/javadoc/jcontacts-core/ +javadoc.reference.jcore-utils.jar=https://docs.mxchange.org/javadoc/jcore-utils/ +javadoc.reference.jcountry-core.jar=https://docs.mxchange.org/javadoc/jcountry-core/ +javadoc.reference.jcustomer-core.jar=https://docs.mxchange.org/javadoc/jcustomer-core/ +javadoc.reference.jphone-core.jar=https://docs.mxchange.org/javadoc/jphone-core/ +javadoc.reference.jproduct-core.jar=https://docs.mxchange.org/javadoc/jproduct-core/ +javadoc.reference.juser-core.jar=https://docs.mxchange.org/javadoc/juser-core/ javadoc.splitindex=true javadoc.use=true javadoc.version=true @@ -110,6 +120,7 @@ run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 +source.reference.jbonuscard-core.jar=../jbonuscard-core/src/ source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ source.reference.jcontacts-core.jar=../jcontacts-core/src/ source.reference.jcore-utils.jar=../jcore-utils/src/ diff --git a/src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java b/src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java deleted file mode 100644 index 785bd24..0000000 --- a/src/org/mxchange/jfinancials/model/bonus_card/BonusCard.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2017 - 2020 Free Software Foundation - * 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.jfinancials.model.bonus_card; - -import java.io.Serializable; -import java.util.Date; -import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; -import org.mxchange.jcustomercore.model.customer.Customer; - -/** - * A POJI for bonus cards - *

- * @author Roland Häder - */ -public interface BonusCard extends Comparable, Serializable { - - /** - * Getter for bonus card's bar code - *

- * @return Bonus card's bar code - */ - String getBonusCardBarCode (); - - /** - * Setter for bonus card's bar code - *

- * @param bonusCardBarCode Bonus card's bar code - */ - void setBonusCardBarCode (final String bonusCardBarCode); - - /** - * Getter for bonus card's contact data - *

- * @return Bonus card's contact data - */ - Contact getBonusCardContact (); - - /** - * Setter for bonus card's contact data - *

- * @param bonusCardContact Bonus card's contact data - */ - void setBonusCardContact (final Contact bonusCardContact); - - /** - * Getter for bonus card's creation timestamp - *

- * @return Bonus card's creation timestamp - */ - Date getBonusCardCreated (); - - /** - * Setter for bonus card's creation timestamp - *

- * @param bonusCardCreated Bonus card's creation timestamp - */ - void setBonusCardCreated (final Date bonusCardCreated); - - /** - * Getter for bonus card's customer data - *

- * @return Bonus card's customer data - */ - Customer getBonusCardCustomer (); - - /** - * Setter for bonus card's customer data - *

- * @param bonusCardCustomer Bonus card's customer data - */ - void setBonusCardCustomer (final Customer bonusCardCustomer); - - /** - * Getter for bonus card's primary key - *

- * @return Bonus card's primary key - */ - Long getBonusCardId (); - - /** - * Setter for bonus card's primary key - *

- * @param bonusCardId Bonus card's primary key - */ - void setBonusCardId (final Long bonusCardId); - - /** - * Getter for bonus card's issuing company - *

- * @return Bonus card's issuing company - */ - BasicData getBonusCardIssuer (); - - /** - * Setter for bonus card's issuing company - *

- * @param bonusCardIssuer Bonus card's issuing company - */ - void setBonusCardIssuer (final BasicData bonusCardIssuer); - - /** - * Getter for bonus card's number (other than customer/bar code) - *

- * @return Bonus card's number - */ - String getBonusCardNumber (); - - /** - * Setter for bonus card's number (other than customer/bar code) - *

- * @param bonusCardNumber Bonus card's number - */ - void setBonusCardNumber (final String bonusCardNumber); - - /** - * Getter for bonus card's partnering/branding company - *

- * @return Bonus card's partnering/branding company - */ - BasicData getBonusCardPartner (); - - /** - * Setter for bonus card's partnering/branding company - *

- * @param bonusCardPartner Bonus card's partnering/branding company - */ - void setBonusCardPartner (final BasicData bonusCardPartner); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java b/src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java deleted file mode 100644 index a1b0a9f..0000000 --- a/src/org/mxchange/jfinancials/model/bonus_card/FinancialBonusCard.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (C) 2017 - 2020 Free Software Foundation - * - * 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.jfinancials.model.bonus_card; - -import java.text.MessageFormat; -import java.util.Date; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.apache.commons.lang3.StringUtils; -import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcontacts.model.contact.Contacts; -import org.mxchange.jcontacts.model.contact.UserContact; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicDataUtils; -import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData; -import org.mxchange.jcoreutils.Comparables; -import org.mxchange.jcustomercore.model.customer.ContactCustomer; -import org.mxchange.jcustomercore.model.customer.Customer; -import org.mxchange.jcustomercore.model.customer.Customers; - -/** - * A POJO (entity) for bonus cards - *

- * @author Roland Häder - */ -@Entity (name = "bonus_cards") -@Table ( - name = "bonus_cards" -) -@SuppressWarnings ("PersistenceUnitPresent") -public class FinancialBonusCard implements BonusCard { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 12_586_367_165_980L; - - /** - * Bar code on bonus card - */ - @Column (name = "bonus_card_bar_code") - private String bonusCardBarCode; - - /** - * The contact that this card is assigned to - */ - @JoinColumn (name = "bonus_card_contact_id", referencedColumnName = "contact_id", nullable = false) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH, optional = false) - private Contact bonusCardContact; - - /** - * When this entry has been created - */ - @Basic (optional = false) - @Column (name = "bonus_card_created", nullable = false) - @Temporal (TemporalType.TIMESTAMP) - private Date bonusCardCreated; - - /** - * Bonus card customer id - */ - @JoinColumn (name = "bonus_card_customer_id", referencedColumnName = "customer_id") - @OneToOne (targetEntity = ContactCustomer.class, cascade = CascadeType.REFRESH) - private Customer bonusCardCustomer; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "bonus_card_id", nullable = false, updatable = false) - private Long bonusCardId; - - /** - * Issuing company of this card - */ - @JoinColumn (name = "bonus_card_issuer_id", referencedColumnName = "company_data_id", nullable = false) - @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH, optional = false) - private BasicData bonusCardIssuer; - - /** - * Bonus card number - */ - @Column (name = "bonus_card_number") - private String bonusCardNumber; - - /** - * Partnering/branding company of this card - */ - @JoinColumn (name = "bonus_card_partner_id", referencedColumnName = "company_data_id") - @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH) - private BasicData bonusCardPartner; - - /** - * Default constructor (required for JPA) - */ - public FinancialBonusCard () { - } - - /** - * Constructor with all required fields - *

- * @param bonusCardContact Contact instance - * @param bonusCardIssuer Issuing company instance - */ - public FinancialBonusCard (final Contact bonusCardContact, final BasicData bonusCardIssuer) { - // Call other constructor first - this(); - - // Validate parameter - if (null == bonusCardContact) { - // Throw NPE - throw new NullPointerException("bonusCardContact is null"); //NOI18N - } else if (bonusCardContact.getContactId() == null) { - // Throw it again - throw new NullPointerException("bonusCardContact.contactId is null"); //NOI18N - } else if (bonusCardContact.getContactId() < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("bonusCardContact.contactId={0} is invalid", bonusCardContact.getContactId())); //NOI18N - } else if (null == bonusCardIssuer) { - // Throw NPE - throw new NullPointerException("bonusCardOwner is null"); //NOI18N - } else if (bonusCardIssuer.getBasicDataId() == null) { - // Throw it again - throw new NullPointerException("bonusCardOwner.baseDataId is null"); //NOI18N - } else if (bonusCardIssuer.getBasicDataId() < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("bonusCardOwner.baseDataId={0} is invalid", bonusCardIssuer.getBasicDataId())); //NOI18N - } - - // Set all - this.bonusCardContact = bonusCardContact; - this.bonusCardIssuer = bonusCardIssuer; - } - - @Override - public int compareTo (final BonusCard bonusCard) { - // Check parameter on null-reference and equality to this - if (null == bonusCard) { - // Should not happen - throw new NullPointerException("bonusCard is null"); //NOI18N - } else if (bonusCard.equals(this)) { - // Same object - return 0; - } - - // Init comparators - final int comparators[] = { - // First compare by number - StringUtils.compare(this.getBonusCardNumber(), bonusCard.getBonusCardNumber()), - // ... next by bar code - StringUtils.compare(this.getBonusCardBarCode(), bonusCard.getBonusCardBarCode()), - // ... customer data - Customers.compare(this.getBonusCardCustomer(), bonusCard.getBonusCardCustomer()), - // ... contact data (card holder) - Contacts.compare(this.getBonusCardContact(), bonusCard.getBonusCardContact()), - // ... issuing company data - this.getBonusCardIssuer().compareTo(bonusCard.getBonusCardIssuer()), - // ... partner company data - BasicDataUtils.compare(this.getBonusCardPartner(), bonusCard.getBonusCardPartner()) - }; - - // Check all values - final int comparison = Comparables.checkAll(comparators); - - // Return value - return comparison; - } - - @Override - public boolean equals (final Object object) { - if (this == object) { - return true; - } else if (null == object) { - return false; - } - if (this.getClass() != object.getClass()) { - return false; - } - - final BonusCard other = (BonusCard) object; - - if (!Objects.equals(this.getBonusCardBarCode(), other.getBonusCardBarCode())) { - return false; - } else if (!Objects.equals(this.getBonusCardContact(), other.getBonusCardContact())) { - return false; - } else if (!Objects.equals(this.getBonusCardCustomer(), other.getBonusCardCustomer())) { - return false; - } else if (!Objects.equals(this.getBonusCardId(), other.getBonusCardId())) { - return false; - } else if (!Objects.equals(this.getBonusCardIssuer(), other.getBonusCardIssuer())) { - return false; - } else if (!Objects.equals(this.getBonusCardNumber(), other.getBonusCardNumber())) { - return false; - } else if (!Objects.equals(this.getBonusCardPartner(), other.getBonusCardPartner())) { - return false; - } - - return true; - } - - @Override - public String getBonusCardBarCode () { - return this.bonusCardBarCode; - } - - @Override - public void setBonusCardBarCode (final String bonusCardBarCode) { - this.bonusCardBarCode = bonusCardBarCode; - } - - @Override - public Contact getBonusCardContact () { - return this.bonusCardContact; - } - - @Override - public void setBonusCardContact (final Contact bonusCardContact) { - this.bonusCardContact = bonusCardContact; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Date getBonusCardCreated () { - return this.bonusCardCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setBonusCardCreated (final Date bonusCardCreated) { - this.bonusCardCreated = bonusCardCreated; - } - - @Override - public Customer getBonusCardCustomer () { - return this.bonusCardCustomer; - } - - @Override - public void setBonusCardCustomer (final Customer bonusCardCustomer) { - this.bonusCardCustomer = bonusCardCustomer; - } - - @Override - public Long getBonusCardId () { - return this.bonusCardId; - } - - @Override - public void setBonusCardId (final Long bonusCardId) { - this.bonusCardId = bonusCardId; - } - - @Override - public BasicData getBonusCardIssuer () { - return this.bonusCardIssuer; - } - - @Override - public void setBonusCardIssuer (final BasicData bonusCardIssuer) { - this.bonusCardIssuer = bonusCardIssuer; - } - - @Override - public String getBonusCardNumber () { - return this.bonusCardNumber; - } - - @Override - public void setBonusCardNumber (final String bonusCardNumber) { - this.bonusCardNumber = bonusCardNumber; - } - - @Override - public BasicData getBonusCardPartner () { - return this.bonusCardPartner; - } - - @Override - public void setBonusCardPartner (final BasicData bonusCardPartner) { - this.bonusCardPartner = bonusCardPartner; - } - - @Override - public int hashCode () { - int hash = 5; - - hash = 13 * hash + Objects.hashCode(this.getBonusCardBarCode()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardContact()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardCustomer()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardId()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardIssuer()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardNumber()); - hash = 13 * hash + Objects.hashCode(this.getBonusCardPartner()); - - return hash; - } - -} diff --git a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java index 61a10f3..b85d220 100644 --- a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java @@ -18,9 +18,9 @@ package org.mxchange.jfinancials.model.receipt; import java.io.Serializable; import java.util.Date; +import org.mxchange.jbonuscard.model.bonus_card.BonusCard; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.employee.Employable; -import org.mxchange.jfinancials.model.bonus_card.BonusCard; import org.mxchange.jproduct.model.payment.PaymentType; import org.mxchange.jusercore.model.user.User; diff --git a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java index 02a93af..24f000b 100644 --- a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java @@ -37,6 +37,8 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.apache.commons.lang3.StringUtils; +import org.mxchange.jbonuscard.model.bonus_card.BonusCard; +import org.mxchange.jbonuscard.model.bonus_card.RoyalityCard; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices; import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice; @@ -45,8 +47,6 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jcontactsbusiness.model.employee.Employees; import org.mxchange.jcoreutils.Comparables; import org.mxchange.jcoreutils.SafeNumberUtils; -import org.mxchange.jfinancials.model.bonus_card.BonusCard; -import org.mxchange.jfinancials.model.bonus_card.FinancialBonusCard; import org.mxchange.jproduct.model.payment.PaymentType; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; @@ -86,7 +86,7 @@ public class FinancialReceipt implements BillableReceipt { * Assigned bonus card */ @JoinColumn (name = "receipt_bonus_card_id", referencedColumnName = "bonus_card_id") - @OneToOne (targetEntity = FinancialBonusCard.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = RoyalityCard.class, cascade = CascadeType.REFRESH) private BonusCard receiptBonusCard; /** -- 2.39.5