From: Roland Haeder Date: Thu, 13 Apr 2017 20:14:19 +0000 (+0200) Subject: moved to proper package, they are model classes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f5df2846c61ff9c42b86938e73082a9df5f91f84;p=jfinancials-core.git moved to proper package, they are model classes Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jfinancials/model/receipt/Billable.java b/src/org/mxchange/jfinancials/model/receipt/Billable.java new file mode 100644 index 0000000..0e35e18 --- /dev/null +++ b/src/org/mxchange/jfinancials/model/receipt/Billable.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2017 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.jfinancials.model.receipt; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jcontactsbusiness.BusinessContact; +import org.mxchange.jshopcore.model.payment.PaymentType; +import org.mxchange.jusercore.model.user.User; + +/** + * An interface for receipts + *

+ * @author Roland Haeder + */ +public interface Billable extends Serializable { + + /** + * Getter for when this receipt has been created in database + *

+ * @return Receipt creation timestamp + */ + Calendar getReceiptCreated (); + + /** + * Setter for when this receipt has been created in database + *

+ * @param receiptCreated Receipt creation timestamp + */ + void setReceiptCreated (final Calendar receiptCreated); + + /** + * Getter for primary key + *

+ * @return Primary key + */ + Long getReceiptId (); + + /** + * Setter for primary key + *

+ * @param receiptId Primary key + */ + void setReceiptId (final Long receiptId); + + /** + * Getter for receipt's user + *

+ * @return Receipt's user + */ + User getReceiptUser (); + + /** + * Setter for receipt's user + *

+ * @param receiptUser Receipt's user + */ + void setReceiptUser (final User receiptUser); + + /** + * Getter for seller instance + *

+ * @return Seller instance + */ + BusinessContact getReceiptSeller (); + + /** + * Setter for seller instance + *

+ * @param receiptSeller Seller instance + */ + void setReceiptSeller (final BusinessContact receiptSeller); + + /** + * Getter for payment type + *

+ * @return Payment type + */ + PaymentType getReceiptPaymentType (); + + /** + * Setter for payment type + *

+ * @param receiptPaymentType Payment type + */ + void setReceiptPaymentType (final PaymentType receiptPaymentType); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jfinancials/model/receipt/Receipt.java b/src/org/mxchange/jfinancials/model/receipt/Receipt.java new file mode 100644 index 0000000..1d334a8 --- /dev/null +++ b/src/org/mxchange/jfinancials/model/receipt/Receipt.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2017 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.jfinancials.model.receipt; + +import java.util.Calendar; +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.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.mxchange.jcontactsbusiness.BusinessContact; +import org.mxchange.jcontactsbusiness.CompanyContact; +import org.mxchange.jshopcore.model.payment.PaymentType; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * + * @author Roland Haeder + */ +@Entity (name = "receipts") +@Table ( + name = "receipts" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class Receipt implements Billable { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 185_867_217_461L; + + /** + * When this receipt has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "receipt_created", nullable = false) + private Calendar receiptCreated; + + /** + * Primary key + */ + @Id + @GeneratedValue (strategy = GenerationType.AUTO) + @Column (name = "receipt_id", nullable = false, updatable = false) + private Long receiptId; + + /** + * Payment type (cash, credit card, EC card ...) + */ + @Basic (optional = false) + @Column (name = "receipt_payment_type", nullable = false) + @Enumerated (EnumType.STRING) + private PaymentType receiptPaymentType; + + /** + * Seller instance + */ + @JoinColumn (name = "receipt_seller_id", referencedColumnName = "company_id", nullable = false, updatable = false) + @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH, optional = false) + private BusinessContact receiptSeller; + + /** + * Which user this receipt belongs to + */ + @JoinColumn (name = "receipt_user_id", referencedColumnName = "user_id", nullable = false, updatable = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + private User receiptUser; + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getReceiptCreated () { + return this.receiptCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setReceiptCreated (final Calendar receiptCreated) { + this.receiptCreated = receiptCreated; + } + + @Override + public Long getReceiptId () { + return this.receiptId; + } + + @Override + public void setReceiptId (final Long receiptId) { + this.receiptId = receiptId; + } + + @Override + public PaymentType getReceiptPaymentType () { + return this.receiptPaymentType; + } + + @Override + public void setReceiptPaymentType (final PaymentType receiptPaymentType) { + this.receiptPaymentType = receiptPaymentType; + } + + @Override + public BusinessContact getReceiptSeller () { + return this.receiptSeller; + } + + @Override + public void setReceiptSeller (final BusinessContact receiptSeller) { + this.receiptSeller = receiptSeller; + } + + @Override + public User getReceiptUser () { + return this.receiptUser; + } + + @Override + public void setReceiptUser (final User receiptUser) { + this.receiptUser = receiptUser; + } + +} diff --git a/src/org/mxchange/jfinancials/model/receipt/entry/BillableReceiptEntry.java b/src/org/mxchange/jfinancials/model/receipt/entry/BillableReceiptEntry.java new file mode 100644 index 0000000..3d6dc5a --- /dev/null +++ b/src/org/mxchange/jfinancials/model/receipt/entry/BillableReceiptEntry.java @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2017 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.jfinancials.model.receipt.entry; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jfinancials.model.receipt.Billable; +import org.mxchange.jshopcore.model.product.Product; + +/** + * An interface for receipt entries + *

+ * @author Roland Haeder + */ +public interface BillableReceiptEntry extends Serializable { + + /** + * Getter when this receipt entry has been created in database + *

+ * @return When this entry has been created + */ + Calendar getEntryCreated (); + + /** + * Setter when this receipt entry has been created in database + *

+ * @param entryCreated When this entry has been created + */ + void setEntryCreated (final Calendar entryCreated); + + /** + * Getter for primary key + *

+ * @return Primary key + */ + Long getEntryId (); + + /** + * Setter for primary key + *

+ * @param entryId Primary key + */ + void setEntryId (final Long entryId); + + /** + * Getter for receipt instance + *

+ * @return Receipt instance + */ + Billable getEntryReceipt (); + + /** + * Setter for receipt instance + *

+ * @param entryReceipt Receipt instance + */ + void setEntryReceipt (final Billable entryReceipt); + + /** + * Getter for linked product + *

+ * @return Product + */ + Product getEntryProduct (); + + /** + * Setter for linked product + *

+ * @param entryProduct Product + */ + void setEntryProduct (final Product entryProduct); + + /** + * Getter for product quantity + *

+ * @return Product quantity + */ + Long getEntryProductQuantity (); + + /** + * Setter for product quantity + *

+ * @param entryProductQuantity Product quantity + */ + void setEntryProductQuantity (final Long entryProductQuantity); + + /** + * Getter for product single price (copied from GenericProduct) + *

+ * @return Product single price + */ + Float getEntryProductPrice (); + + /** + * Setter for product single price (copied from GenericProduct) + *

+ * @param entryProductPrice Product single price + */ + void setEntryProductPrice (final Float entryProductPrice); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jfinancials/model/receipt/entry/ReceiptEntry.java b/src/org/mxchange/jfinancials/model/receipt/entry/ReceiptEntry.java new file mode 100644 index 0000000..c744b1e --- /dev/null +++ b/src/org/mxchange/jfinancials/model/receipt/entry/ReceiptEntry.java @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2017 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.jfinancials.model.receipt.entry; + +import java.util.Calendar; +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.Index; +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.mxchange.jfinancials.model.receipt.Billable; +import org.mxchange.jfinancials.model.receipt.Receipt; +import org.mxchange.jshopcore.model.product.GenericProduct; +import org.mxchange.jshopcore.model.product.Product; + +/** + * A class for entryReceipt entries + *

+ * @author Roland Haeder + */ +@Entity (name = "receipt_entries") +@Table ( + name = "receipt_entries", + indexes = { + @Index (name = "entry_receipt_product", columnList = "entry_receipt_id,entry_product_id", unique = true) + } +) +@SuppressWarnings ("PersistenceUnitPresent") +public class ReceiptEntry implements BillableReceiptEntry { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 126_498_698_378_571L; + + /** + * When this entry has been created in database + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "entry_created", nullable = false) + private Calendar entryCreated; + + /** + * Primary key + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "entry_id", nullable = false, updatable = false) + private Long entryId; + + /** + * Product being linked in this entryReceipt item + */ + @JoinColumn (name = "entry_product_id", referencedColumnName = "product_id", nullable = false, updatable = false, unique = true) + @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.ALL, optional = false) + private Product entryProduct; + + /** + * Single product price (being copied here from GenericProduct) + */ + @Basic (optional = false) + @Column (name = "entry_product_price", nullable = false) + private Float entryProductPrice; + + /** + * Product quantity + */ + @Basic (optional = false) + @Column (name = "entry_product_quantity", nullable = false) + private Long entryProductQuantity; + + /** + * Connected entryReceipt entry + */ + @JoinColumn (name = "entry_receipt_id", referencedColumnName = "receipt_id", nullable = false, updatable = false, unique = true) + @OneToOne (targetEntity = Receipt.class, cascade = CascadeType.REFRESH, optional = false) + private Billable entryReceipt; + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getEntryCreated () { + return this.entryCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setEntryCreated (final Calendar entryCreated) { + this.entryCreated = entryCreated; + } + + @Override + public Long getEntryId () { + return this.entryId; + } + + @Override + public void setEntryId (final Long entryId) { + this.entryId = entryId; + } + + @Override + public Product getEntryProduct () { + return this.entryProduct; + } + + @Override + public void setEntryProduct (final Product entryProduct) { + this.entryProduct = entryProduct; + } + + @Override + public Float getEntryProductPrice () { + return this.entryProductPrice; + } + + @Override + public void setEntryProductPrice (final Float entryProductPrice) { + this.entryProductPrice = entryProductPrice; + } + + @Override + public Long getEntryProductQuantity () { + return this.entryProductQuantity; + } + + @Override + public void setEntryProductQuantity (final Long entryProductQuantity) { + this.entryProductQuantity = entryProductQuantity; + } + + @Override + public Billable getEntryReceipt () { + return this.entryReceipt; + } + + @Override + public void setEntryReceipt (final Billable entryReceipt) { + this.entryReceipt = entryReceipt; + } + +} diff --git a/src/org/mxchange/jfinancials/receipt/Billable.java b/src/org/mxchange/jfinancials/receipt/Billable.java deleted file mode 100644 index 2b1d391..0000000 --- a/src/org/mxchange/jfinancials/receipt/Billable.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2017 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.jfinancials.receipt; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jshopcore.model.payment.PaymentType; -import org.mxchange.jusercore.model.user.User; - -/** - * An interface for receipts - *

- * @author Roland Haeder - */ -public interface Billable extends Serializable { - - /** - * Getter for when this receipt has been created in database - *

- * @return Receipt creation timestamp - */ - Calendar getReceiptCreated (); - - /** - * Setter for when this receipt has been created in database - *

- * @param receiptCreated Receipt creation timestamp - */ - void setReceiptCreated (final Calendar receiptCreated); - - /** - * Getter for primary key - *

- * @return Primary key - */ - Long getReceiptId (); - - /** - * Setter for primary key - *

- * @param receiptId Primary key - */ - void setReceiptId (final Long receiptId); - - /** - * Getter for receipt's user - *

- * @return Receipt's user - */ - User getReceiptUser (); - - /** - * Setter for receipt's user - *

- * @param receiptUser Receipt's user - */ - void setReceiptUser (final User receiptUser); - - /** - * Getter for seller instance - *

- * @return Seller instance - */ - BusinessContact getReceiptSeller (); - - /** - * Setter for seller instance - *

- * @param receiptSeller Seller instance - */ - void setReceiptSeller (final BusinessContact receiptSeller); - - /** - * Getter for payment type - *

- * @return Payment type - */ - PaymentType getReceiptPaymentType (); - - /** - * Setter for payment type - *

- * @param receiptPaymentType Payment type - */ - void setReceiptPaymentType (final PaymentType receiptPaymentType); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jfinancials/receipt/Receipt.java b/src/org/mxchange/jfinancials/receipt/Receipt.java deleted file mode 100644 index 337ac29..0000000 --- a/src/org/mxchange/jfinancials/receipt/Receipt.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2017 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.jfinancials.receipt; - -import java.util.Calendar; -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.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jcontactsbusiness.CompanyContact; -import org.mxchange.jshopcore.model.payment.PaymentType; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * - * @author Roland Haeder - */ -@Entity (name = "receipts") -@Table ( - name = "receipts" -) -@SuppressWarnings ("PersistenceUnitPresent") -public class Receipt implements Billable { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 185_867_217_461L; - - /** - * When this receipt has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "receipt_created", nullable = false) - private Calendar receiptCreated; - - /** - * Primary key - */ - @Id - @GeneratedValue (strategy = GenerationType.AUTO) - @Column (name = "receipt_id", nullable = false, updatable = false) - private Long receiptId; - - /** - * Payment type (cash, credit card, EC card ...) - */ - @Basic (optional = false) - @Column (name = "receipt_payment_type", nullable = false) - @Enumerated (EnumType.STRING) - private PaymentType receiptPaymentType; - - /** - * Seller instance - */ - @JoinColumn (name = "receipt_seller_id", referencedColumnName = "company_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH, optional = false) - private BusinessContact receiptSeller; - - /** - * Which user this receipt belongs to - */ - @JoinColumn (name = "receipt_user_id", referencedColumnName = "user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User receiptUser; - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getReceiptCreated () { - return this.receiptCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setReceiptCreated (final Calendar receiptCreated) { - this.receiptCreated = receiptCreated; - } - - @Override - public Long getReceiptId () { - return this.receiptId; - } - - @Override - public void setReceiptId (final Long receiptId) { - this.receiptId = receiptId; - } - - @Override - public PaymentType getReceiptPaymentType () { - return this.receiptPaymentType; - } - - @Override - public void setReceiptPaymentType (final PaymentType receiptPaymentType) { - this.receiptPaymentType = receiptPaymentType; - } - - @Override - public BusinessContact getReceiptSeller () { - return this.receiptSeller; - } - - @Override - public void setReceiptSeller (final BusinessContact receiptSeller) { - this.receiptSeller = receiptSeller; - } - - @Override - public User getReceiptUser () { - return this.receiptUser; - } - - @Override - public void setReceiptUser (final User receiptUser) { - this.receiptUser = receiptUser; - } - -} diff --git a/src/org/mxchange/jfinancials/receipt/entry/BillableReceiptEntry.java b/src/org/mxchange/jfinancials/receipt/entry/BillableReceiptEntry.java deleted file mode 100644 index 559119f..0000000 --- a/src/org/mxchange/jfinancials/receipt/entry/BillableReceiptEntry.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2017 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.jfinancials.receipt.entry; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jfinancials.receipt.Billable; -import org.mxchange.jshopcore.model.product.Product; - -/** - * An interface for receipt entries - *

- * @author Roland Haeder - */ -public interface BillableReceiptEntry extends Serializable { - - /** - * Getter when this receipt entry has been created in database - *

- * @return When this entry has been created - */ - Calendar getEntryCreated (); - - /** - * Setter when this receipt entry has been created in database - *

- * @param entryCreated When this entry has been created - */ - void setEntryCreated (final Calendar entryCreated); - - /** - * Getter for primary key - *

- * @return Primary key - */ - Long getEntryId (); - - /** - * Setter for primary key - *

- * @param entryId Primary key - */ - void setEntryId (final Long entryId); - - /** - * Getter for receipt instance - *

- * @return Receipt instance - */ - Billable getEntryReceipt (); - - /** - * Setter for receipt instance - *

- * @param entryReceipt Receipt instance - */ - void setEntryReceipt (final Billable entryReceipt); - - /** - * Getter for linked product - *

- * @return Product - */ - Product getEntryProduct (); - - /** - * Setter for linked product - *

- * @param entryProduct Product - */ - void setEntryProduct (final Product entryProduct); - - /** - * Getter for product quantity - *

- * @return Product quantity - */ - Long getEntryProductQuantity (); - - /** - * Setter for product quantity - *

- * @param entryProductQuantity Product quantity - */ - void setEntryProductQuantity (final Long entryProductQuantity); - - /** - * Getter for product single price (copied from GenericProduct) - *

- * @return Product single price - */ - Float getEntryProductPrice (); - - /** - * Setter for product single price (copied from GenericProduct) - *

- * @param entryProductPrice Product single price - */ - void setEntryProductPrice (final Float entryProductPrice); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jfinancials/receipt/entry/ReceiptEntry.java b/src/org/mxchange/jfinancials/receipt/entry/ReceiptEntry.java deleted file mode 100644 index 233099a..0000000 --- a/src/org/mxchange/jfinancials/receipt/entry/ReceiptEntry.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2017 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.jfinancials.receipt.entry; - -import java.util.Calendar; -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.Index; -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.mxchange.jfinancials.receipt.Billable; -import org.mxchange.jfinancials.receipt.Receipt; -import org.mxchange.jshopcore.model.product.GenericProduct; -import org.mxchange.jshopcore.model.product.Product; - -/** - * A class for entryReceipt entries - *

- * @author Roland Haeder - */ -@Entity (name = "receipt_entries") -@Table ( - name = "receipt_entries", - indexes = { - @Index (name = "entry_receipt_product", columnList = "entry_receipt_id,entry_product_id", unique = true) - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class ReceiptEntry implements BillableReceiptEntry { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 126_498_698_378_571L; - - /** - * When this entry has been created in database - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "entry_created", nullable = false) - private Calendar entryCreated; - - /** - * Primary key - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "entry_id", nullable = false, updatable = false) - private Long entryId; - - /** - * Product being linked in this entryReceipt item - */ - @JoinColumn (name = "entry_product_id", referencedColumnName = "product_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.ALL, optional = false) - private Product entryProduct; - - /** - * Single product price (being copied here from GenericProduct) - */ - @Basic (optional = false) - @Column (name = "entry_product_price", nullable = false) - private Float entryProductPrice; - - /** - * Product quantity - */ - @Basic (optional = false) - @Column (name = "entry_product_quantity", nullable = false) - private Long entryProductQuantity; - - /** - * Connected entryReceipt entry - */ - @JoinColumn (name = "entry_receipt_id", referencedColumnName = "receipt_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = Receipt.class, cascade = CascadeType.REFRESH, optional = false) - private Billable entryReceipt; - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getEntryCreated () { - return this.entryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEntryCreated (final Calendar entryCreated) { - this.entryCreated = entryCreated; - } - - @Override - public Long getEntryId () { - return this.entryId; - } - - @Override - public void setEntryId (final Long entryId) { - this.entryId = entryId; - } - - @Override - public Product getEntryProduct () { - return this.entryProduct; - } - - @Override - public void setEntryProduct (final Product entryProduct) { - this.entryProduct = entryProduct; - } - - @Override - public Float getEntryProductPrice () { - return this.entryProductPrice; - } - - @Override - public void setEntryProductPrice (final Float entryProductPrice) { - this.entryProductPrice = entryProductPrice; - } - - @Override - public Long getEntryProductQuantity () { - return this.entryProductQuantity; - } - - @Override - public void setEntryProductQuantity (final Long entryProductQuantity) { - this.entryProductQuantity = entryProductQuantity; - } - - @Override - public Billable getEntryReceipt () { - return this.entryReceipt; - } - - @Override - public void setEntryReceipt (final Billable entryReceipt) { - this.entryReceipt = entryReceipt; - } - -}