*/
void setIncomeId (final Long incomeId);
- /**
- * Getter for income-created timestamp
- * <p>
- * @return Income-created timestamp
- */
- Date getIncomeCreated ();
-
- /**
- * Setter for income-created timestamp
- * <p>
- * @param incomeCreated Income-created timestamp
- */
- void setIncomeCreated (final Date incomeCreated);
-
/**
* Getter for whether income is enabled
* <p>
void setIncomeTitle (final String incomeTitle);
/**
- * Getter for income-updated timestamp
+ * Getter for connected user account
* <p>
- * @return Income-updated timestamp
+ * @return Connected user account
*/
- Date getIncomeUpdated ();
+ User getIncomeUser ();
/**
- * Setter for income-updated timestamp
+ * Setter for connected user account
+ * <p>
+ * @param incomeUser Connected user account
+ */
+ void setIncomeUser (final User incomeUser);
+
+ /**
+ * Getter for income-created timestamp
* <p>
- * @param incomeUpdated Income-updated timestamp
+ * @return Income-created timestamp
*/
- void setIncomeUpdated (final Date incomeUpdated);
+ Date getIncomeEntryCreated ();
/**
- * Getter for connected user account
+ * Setter for income-created timestamp
* <p>
- * @return Connected user account
+ * @param incomeEntryCreated Income-created timestamp
*/
- User getIncomeUser ();
+ void setIncomeEntryCreated (final Date incomeEntryCreated);
/**
- * Setter for connected user account
+ * Getter for income-updated timestamp
* <p>
- * @param incomeUser Connected user account
+ * @return Income-updated timestamp
*/
- void setIncomeUser (final User incomeUser);
+ Date getIncomeEntryUpdated ();
+
+ /**
+ * Setter for income-updated timestamp
+ * <p>
+ * @param incomeEntryUpdated Income-updated timestamp
+ */
+ void setIncomeEntryUpdated (final Date incomeEntryUpdated);
@Override
boolean equals (final Object object);
package org.mxchange.jfinancials.model.income;
import java.math.BigDecimal;
+import java.text.MessageFormat;
import java.util.Date;
import java.util.Objects;
import javax.persistence.Basic;
@Transient
private static final long serialVersionUID = 173_587_690_625_524L;
+ /**
+ * Income enabled (default) or disabled (no longer receiving income but need
+ * to keep it for statistics).
+ */
+ @Basic (optional = false)
+ @Column (name = "income_enabled", nullable = false)
+ private Boolean incomeEnabled;
+
/**
* Income created timestamp
*/
@Basic (optional = false)
@Temporal (TemporalType.TIMESTAMP)
- @Column (name = "income_created", nullable = false, updatable = false)
- private Date incomeCreated;
+ @Column (name = "income_entry_created", nullable = false, updatable = false)
+ private Date incomeEntryCreated;
/**
- * Income enabled (default) or disabled (no longer receiving income but need
- * to keep it for statistics).
+ * Income updated timestamp
*/
- @Basic (optional = false)
- @Column (name = "income_enabled", nullable = false)
- private Boolean incomeEnabled;
+ @Temporal (TemporalType.TIMESTAMP)
+ @Column (name = "income_entry_updated", insertable = false)
+ private Date incomeEntryUpdated;
/**
* Income id (primary key)
@Column (name = "income_title", nullable = false)
private String incomeTitle;
- /**
- * Income updated timestamp
- */
- @Temporal (TemporalType.TIMESTAMP)
- @Column (name = "income_updated", insertable = false)
- private Date incomeUpdated;
-
/**
* Connected user account
*/
* @param incomeSingleAmount Single amount
* @param incomeInterval Interval
* @param incomeUser Connected user
+ * @param incomeEnabled Whether this income is enabled
*/
- public FinancialIncome (final String incomeTitle, final BigDecimal incomeSingleAmount, final FinancialInterval incomeInterval, final User incomeUser) {
+ public FinancialIncome (final String incomeTitle, final BigDecimal incomeSingleAmount, final FinancialInterval incomeInterval, final User incomeUser, final Boolean incomeEnabled) {
// Invoke default constructor
this();
+ // Validate all parameter
+ if (null == incomeEnabled) {
+ // Throw NPE
+ throw new NullPointerException("incomeEnabled is null"); //NOI18N
+ } else if (null == incomeInterval) {
+ // Throw NPE again
+ throw new NullPointerException("incomeInterval is null"); //NOI18N
+ } else if (null == incomeSingleAmount) {
+ // Throw NPE again
+ throw new NullPointerException("incomeSingleAmount is null"); //NOI18N
+ } else if (incomeSingleAmount.floatValue() < 0.0f) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("incomeSingleAmount={0} is not valid.", incomeSingleAmount)); //NOI18N
+ } else if (null == incomeTitle) {
+ // Throw NPE
+ throw new NullPointerException("incomeTitle is null"); //NOI18N
+ } else if (incomeTitle.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("incomeTitle is empty"); //NOI18N
+ } else if (null == incomeUser) {
+ // Throw NPE
+ throw new NullPointerException("incomeUser is null"); //NOI18N
+ } else if (incomeUser.getUserId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("incomeUser.userId is null"); //NOI18N
+ } else if (incomeUser.getUserId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("incomeUser.userId={0} is not valid.", incomeUser.getUserId())); //NOI18N
+ }
+
// Set all fields
this.incomeTitle = incomeTitle;
this.incomeSingleAmount = incomeSingleAmount;
this.incomeInterval = incomeInterval;
this.incomeUser = incomeUser;
-
- // Enable this income by default
- this.incomeEnabled = Boolean.TRUE;
+ this.incomeEnabled = incomeEnabled;
}
@Override
final BillableIncome other = (BillableIncome) object;
- if (!Objects.equals(this.getIncomeTitle(), other.getIncomeTitle())) {
+ if (!Objects.equals(this.getIncomeEnabled(), other.getIncomeEnabled())) {
return false;
} else if (!Objects.equals(this.getIncomeId(), other.getIncomeId())) {
return false;
+ } else if (!Objects.equals(this.getIncomeInterval(), other.getIncomeInterval())) {
+ return false;
+ } else if (!Objects.equals(this.getIncomeSingleAmount(), other.getIncomeSingleAmount())) {
+ return false;
+ } else if (!Objects.equals(this.getIncomeTitle(), other.getIncomeTitle())) {
+ return false;
} else if (!Objects.equals(this.getIncomeUser(), other.getIncomeUser())) {
return false;
}
+
return true;
}
+ @Override
+ public Boolean getIncomeEnabled () {
+ return this.incomeEnabled;
+ }
+
+ @Override
+ public void setIncomeEnabled (Boolean incomeEnabled) {
+ this.incomeEnabled = incomeEnabled;
+ }
+
@Override
@SuppressWarnings ("ReturnOfDateField")
- public Date getIncomeCreated () {
- return this.incomeCreated;
+ public Date getIncomeEntryCreated () {
+ return this.incomeEntryCreated;
}
@Override
@SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setIncomeCreated (Date incomeCreated) {
- this.incomeCreated = incomeCreated;
+ public void setIncomeEntryCreated (Date incomeEntryCreated) {
+ this.incomeEntryCreated = incomeEntryCreated;
}
@Override
- public Boolean getIncomeEnabled () {
- return this.incomeEnabled;
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getIncomeEntryUpdated () {
+ return this.incomeEntryUpdated;
}
@Override
- public void setIncomeEnabled (Boolean incomeEnabled) {
- this.incomeEnabled = incomeEnabled;
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setIncomeEntryUpdated (Date incomeEntryUpdated) {
+ this.incomeEntryUpdated = incomeEntryUpdated;
}
@Override
this.incomeTitle = incomeTitle;
}
- @Override
- @SuppressWarnings ("ReturnOfDateField")
- public Date getIncomeUpdated () {
- return this.incomeUpdated;
- }
-
- @Override
- @SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setIncomeUpdated (Date incomeUpdated) {
- this.incomeUpdated = incomeUpdated;
- }
-
@Override
public User getIncomeUser () {
return this.incomeUser;
public int hashCode () {
int hash = 3;
+ hash = 29 * hash + Objects.hashCode(this.getIncomeEnabled());
hash = 29 * hash + Objects.hashCode(this.getIncomeId());
+ hash = 29 * hash + Objects.hashCode(this.getIncomeInterval());
+ hash = 29 * hash + Objects.hashCode(this.getIncomeSingleAmount());
hash = 29 * hash + Objects.hashCode(this.getIncomeTitle());
hash = 29 * hash + Objects.hashCode(this.getIncomeUser());
)
@NamedQueries (
{
- @NamedQuery (name = "AllReceipts", query = "SELECT r FROM receipts AS r ORDER BY r.receiptId ASC"),
- @NamedQuery (name = "SearchAllUserReceipts", query = "SELECT r FROM receipts AS r WHERE r.receiptUser = :receiptUser ORDER BY r.receiptId ASC")
+ @NamedQuery (name = "AllReceipts", query = "SELECT r FROM receipts AS r ORDER BY r.receiptId ASC")
}
)
@SuppressWarnings ("PersistenceUnitPresent")
final BillableReceipt receipt = (BillableReceipt) object;
// Now check some distincting class fields
- if (!Objects.equals(this.getReceiptId(), receipt.getReceiptId())) {
+ if (!Objects.equals(this.getReceiptBarCodeNumber(), receipt.getReceiptBarCodeNumber())) {
return false;
- } else if (!Objects.equals(this.getReceiptNumber(), receipt.getReceiptNumber())) {
+ } else if (!Objects.equals(this.getReceiptBonusCard(), receipt.getReceiptBonusCard())) {
return false;
- } else if (!Objects.equals(this.getReceiptRegisterNumber(), receipt.getReceiptRegisterNumber())) {
+ } else if (!Objects.equals(this.getReceiptBranchOffice(), receipt.getReceiptBranchOffice())) {
return false;
- } else if (!Objects.equals(this.getReceiptSequenceNumber(), receipt.getReceiptSequenceNumber())) {
+ } else if (!Objects.equals(this.getReceiptId(), receipt.getReceiptId())) {
return false;
- } else if (!Objects.equals(this.getReceiptTransactionNumber(), receipt.getReceiptTransactionNumber())) {
+ } else if (!Objects.equals(this.getReceiptIssued(), receipt.getReceiptIssued())) {
+ return false;
+ } else if (!Objects.equals(this.getReceiptNumber(), receipt.getReceiptNumber())) {
return false;
} else if (this.getReceiptPaymentType() != receipt.getReceiptPaymentType()) {
return false;
- } else if (!Objects.equals(this.getReceiptBranchOffice(), receipt.getReceiptBranchOffice())) {
+ } else if (!Objects.equals(this.getReceiptRegisterNumber(), receipt.getReceiptRegisterNumber())) {
return false;
- } else if (!Objects.equals(this.getReceiptUser(), receipt.getReceiptUser())) {
+ } else if (!Objects.equals(this.getReceiptSellerEmployee(), receipt.getReceiptSellerEmployee())) {
return false;
- } else if (!Objects.equals(this.getReceiptIssued(), receipt.getReceiptIssued())) {
+ } else if (!Objects.equals(this.getReceiptSequenceNumber(), receipt.getReceiptSequenceNumber())) {
return false;
- } else if (!Objects.equals(this.getReceiptSellerEmployee(), receipt.getReceiptSellerEmployee())) {
+ } else if (!Objects.equals(this.getReceiptTransactionNumber(), receipt.getReceiptTransactionNumber())) {
+ return false;
+ } else if (!Objects.equals(this.getReceiptUser(), receipt.getReceiptUser())) {
return false;
}
public int hashCode () {
int hash = 5;
+ hash = 89 * hash + Objects.hashCode(this.getReceiptBarCodeNumber());
+ hash = 89 * hash + Objects.hashCode(this.getReceiptBonusCard());
+ hash = 89 * hash + Objects.hashCode(this.getReceiptBranchOffice());
hash = 89 * hash + Objects.hashCode(this.getReceiptId());
+ hash = 89 * hash + Objects.hashCode(this.getReceiptIssued());
hash = 89 * hash + Objects.hashCode(this.getReceiptNumber());
+ hash = 89 * hash + Objects.hashCode(this.getReceiptPaymentType());
hash = 89 * hash + Objects.hashCode(this.getReceiptRegisterNumber());
+ hash = 89 * hash + Objects.hashCode(this.getReceiptSellerEmployee());
hash = 89 * hash + Objects.hashCode(this.getReceiptSequenceNumber());
hash = 89 * hash + Objects.hashCode(this.getReceiptTransactionNumber());
- hash = 89 * hash + Objects.hashCode(this.getReceiptPaymentType());
- hash = 89 * hash + Objects.hashCode(this.getReceiptBranchOffice());
hash = 89 * hash + Objects.hashCode(this.getReceiptUser());
- hash = 89 * hash + Objects.hashCode(this.getReceiptSellerEmployee());
return hash;
}
package org.mxchange.jfinancials.model.receipt_item;
import java.math.BigDecimal;
+import java.text.MessageFormat;
import java.util.Date;
import java.util.Objects;
import javax.persistence.Basic;
)
@NamedQueries (
{
- @NamedQuery (name = "AllReceiptItems", query = "SELECT ri FROM receipt_items AS ri ORDER BY ri.itemId ASC"),
- @NamedQuery (name = "SearchAssignedReceiptItems", query = "SELECT ri FROM receipt_items AS ri WHERE ri.itemReceipt = :itemReceipt ORDER BY ri.itemId ASC"),
- @NamedQuery (name = "SearchAllUserReceiptItems", query = "SELECT ri FROM receipt_items AS ri JOIN receipts AS r ON ri.itemReceipt=r WHERE r.receiptUser = :receiptUser ORDER BY ri.itemId ASC")
+ @NamedQuery (name = "AllReceiptItems", query = "SELECT ri FROM receipt_items AS ri ORDER BY ri.itemId ASC")
}
)
@SuppressWarnings ("PersistenceUnitPresent")
* When this item has been updated
*/
@Temporal (TemporalType.TIMESTAMP)
- @Column (name = "item_entry_updated", insertable = false, nullable = false)
+ @Column (name = "item_entry_updated", insertable = false)
private Date itemEntryUpdated;
/**
// Call other constructor
this();
+ // Validate parameter
+ if (null == itemProduct) {
+ // Throw NPE
+ throw new NullPointerException("itemProduct is null"); //NOI18N
+ } else if (itemProduct.getProductId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("itemProduct.productId is null"); //NOI18N
+ } else if (itemProduct.getProductId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("itemProduct.productId={0} is not valid.", itemProduct.getProductId())); //NOI18N
+ } else if (null == itemProductQuantity) {
+ // Throw NPE
+ throw new NullPointerException("itemProductQuanity is null"); //NOI18N
+ } else if (itemProductQuantity.floatValue() < 0) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("itemProductQuanity={0} is not valid.", itemProductQuantity)); //NOI18N
+ } else if (null == itemReceipt) {
+ // Throw NPE
+ throw new NullPointerException("itemReceipt is null"); //NOI18N
+ } else if (itemReceipt.getReceiptId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("itemReceipt.receiptId is null"); //NOI18N
+ } else if (itemReceipt.getReceiptId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("itemReceipt.receiptId={0} is not valid.", itemReceipt.getReceiptId())); //NOI18N
+ }
+
// Set all values
this.itemProduct = itemProduct;
this.itemProductQuantity = itemProductQuantity;
return false;
} else if (!Objects.equals(this.getItemGrossPrice(), receiptItem.getItemGrossPrice())) {
return false;
+ } else if (!Objects.equals(this.getItemId(), receiptItem.getItemId())) {
+ return false;
} else if (!Objects.equals(this.getItemIsDiscount(), receiptItem.getItemIsDiscount())) {
return false;
} else if (!Objects.equals(this.getItemIsRefund(), receiptItem.getItemIsRefund())) {