From: Roland Häder Date: Sun, 10 May 2020 04:05:43 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=42510c66a5436605eea0588f3bdbe0392bf04430;p=jfinancials-ejb.git Please cherry-pick: - implemented business method updateDepartment() including mergeDepartmentData() which does the actual merger and sets entry-updated timestamp - renamed getDetached() to mergeFooData() as "get" is strictly for getters - TODO: Rename setFoo() to something else! - sorted members (automatically by NetBeans IDE) Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java index 9444613..ef70d30 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/department/FinancialsAdminDepartmentSessionBean.java @@ -22,6 +22,7 @@ import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException; +import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.employee.Employable; @@ -143,6 +144,48 @@ public class FinancialsAdminDepartmentSessionBean extends BaseFinancialsEnterpri return department; } + @Override + public Department updateDepartment (final Department department) throws DepartmentNotFoundException { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateDepartment(): department={1} - CALLED!", this.getClass().getSimpleName(), department)); //NOI18N + + // Validate parameter + if (null == department) { + // Throw NPE + throw new NullPointerException("department is null"); //NOI18N + } else if (department.getDepartmentId() instanceof Long) { + // Should not happen + throw new IllegalArgumentException("department.departmentId should not be set."); //NOI18N + } else if (department.getDepartmentCompany() == null) { + // Throw NPE + throw new NullPointerException("department.departmentCompany is null"); //NOI18N + } else if (department.getDepartmentCompany().getBasicDataId() == null) { + // Throw NPE again + throw new NullPointerException("department.departmentCompany.basicDataId is null"); //NOI18N + } else if (department.getDepartmentCompany().getBasicDataId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("department.departmentCompany.basicDataId={0} is invalid", department.getDepartmentCompany().getBasicDataId())); //NOI18N + } else if (department.getDepartmentI18nKey() == null) { + // Throw NPE + throw new NullPointerException("department.departmentName is null"); //NOI18N + } else if (department.getDepartmentI18nKey().isEmpty()) { + // Throw IAE + throw new NullPointerException("department.departmentName is empty"); //NOI18N + } else if (!this.isDepartmentFound(department)) { + // Already added, abort here + throw new DepartmentNotFoundException(department); + } + + // Merge data + final Department updatedDepartment = this.mergeDepartmentData(department); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateDepartment(): updatedDepartment={1} - EXIT!", this.getClass().getSimpleName(), updatedDepartment)); + + // Return updated instance + return updatedDepartment; + } + /** * Checks if given department's address is already persisted. The whole * (persisted) list is being loaded and each address is being matched diff --git a/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java index c86456e..1178783 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java @@ -33,6 +33,7 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices; import org.mxchange.jcontactsbusiness.model.department.Department; +import org.mxchange.jcontactsbusiness.model.department.Departments; import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition; @@ -733,150 +734,6 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { this.getLoggerBeanLocal().logTrace("setAllPhoneEntriesCreated: EXIT!"); //NOI18N } - /** - * Returns a detached instance from given mobile instance - *

- * @param mobileNumber Mobile instance - * @param fetchedNumber Found mobile number in database - *

- * @return Detached instance - */ - protected DialableMobileNumber getDetached (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: mobileNumber={0},fetchedNumber={1} - CALLED!", mobileNumber, fetchedNumber)); //NOI18N - - // Should be valid - if (null == mobileNumber) { - // Throw NPE - throw new NullPointerException("mobileNumber is null"); //NOI18N - } else if (fetchedNumber.getMobileId() == null) { - // ..and again - throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N - } - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getMobileId())); //NOI18N - - // Init query instance - final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getMobileId()); - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N - - // Default is null - DialableMobileNumber detachedNumber = null; - - // Is there a difference? - if (!MobileNumbers.isSameMobileNumber(mobileNumber, fetchedNumber)) { - // @TODO Copy all to foundNumber, then merge - - // Merge this entry - detachedNumber = this.getEntityManager().merge(foundNumber); - } - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N - - // Return it - return detachedNumber; - } - - /** - * Returns a detached instance from given land-line instance - *

- * @param landLineNumber Land-line instance - * @param fetchedNumber Found land-line number in database - *

- * @return Detached instance - */ - protected DialableLandLineNumber getDetached (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: landLineNumber={0},fetchedNumber={1} - CALLED!", landLineNumber, fetchedNumber)); //NOI18N - - // Should be valid - if (null == landLineNumber) { - // Throw NPE - throw new NullPointerException("landLineNumber is null"); //NOI18N - } else if (fetchedNumber.getPhoneId() == null) { - // ..and again - throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N - } - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N - - // Init query instance - final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId()); - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N - - // Default is null - DialableLandLineNumber detachedNumber = null; - - // Is there a difference? - if (!LandLineNumbers.isSameLandLineNumber(landLineNumber, fetchedNumber)) { - // @TODO Copy all to foundNumber, then merge - - // Merge this entry - detachedNumber = this.getEntityManager().merge(foundNumber); - } - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N - - // Return it - return detachedNumber; - } - - /** - * Returns a detached instance from given fax instance - *

- * @param faxNumber Fax instance - * @param fetchedNumber Found fax number in database - *

- * @return Detached instance - */ - protected DialableFaxNumber getDetached (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) { - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: faxNumber={0},fetchedNumber={1} - CALLED!", faxNumber, fetchedNumber)); //NOI18N - - // Should be valid - if (null == faxNumber) { - // Throw NPE - throw new NullPointerException("faxNumber is null"); //NOI18N - } else if (fetchedNumber.getPhoneId() == null) { - // ..and again - throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N - } - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N - - // Init query instance - final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId()); - - // Debug message - this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N - - // Default is null - DialableFaxNumber detachedNumber = null; - - // Is there a difference? - if (!FaxNumbers.isSameFaxNumber(faxNumber, fetchedNumber)) { - // @TODO Copy all to foundNumber, then merge - - // Merge this entry - detachedNumber = this.getEntityManager().merge(foundNumber); - } - - // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N - - // Return it - return detachedNumber; - } - /** * Merges given branch office's data *

@@ -894,7 +751,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { throw new NullPointerException("detachedBranchOffice is null"); //NOI18N } else if (detachedBranchOffice.getBranchId() == null) { // Throw NPE again - throw new NullPointerException("detachedBranchOffice.branchId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedBranchOffice.branchId is null"); //NOI18N } else if (detachedBranchOffice.getBranchId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedBranchOffice.branchId ={0} is not valid.", detachedBranchOffice.getBranchId())); //NOI18N @@ -942,7 +799,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { throw new NullPointerException("detachedContact is null"); //NOI18N } else if (detachedContact.getContactId() == null) { // Throw NPE again - throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedContact.contactId is null"); //NOI18N } else if (detachedContact.getContactId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedContact.contactId={0} is not valid.", detachedContact.getContactId())); //NOI18N @@ -988,7 +845,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { throw new NullPointerException("detachedContact is null"); //NOI18N } else if (detachedContact.getContactId() == null) { // Throw NPE again - throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedContact.contactId is null"); //NOI18N } else if (detachedContact.getContactId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedContact.contactId={0} is not valid.", detachedContact.getContactId())); //NOI18N @@ -1075,6 +932,200 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { this.getLoggerBeanLocal().logTrace("mergeContactsMobileLandLineFaxNumbers: EXIT!"); //NOI18N } + /** + * Merges given department's data + *

+ * @param detachedDepartment Department instance to merge + *

+ * @return Detached contact instance + */ + protected Department mergeDepartmentData (final Department detachedDepartment) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeDepartmentData: detachedDepartment={0} - CALLED!", detachedDepartment)); //NOI18N + + // The contact instance must be valid + if (null == detachedDepartment) { + // Throw NPE again + throw new NullPointerException("detachedDepartment is null"); //NOI18N + } else if (detachedDepartment.getDepartmentId() == null) { + // Throw NPE again + throw new NullPointerException("detachedDepartment.departmentId is null"); //NOI18N + } else if (detachedDepartment.getDepartmentId() < 1) { + // Not valid + throw new IllegalStateException(MessageFormat.format("detachedDepartment.departmentId ={0} is not valid.", detachedDepartment.getDepartmentId())); //NOI18N + } + + // Set updated timestamp + detachedDepartment.setDepartmentEntryUpdated(new Date()); + + // Get contact from it and find it + final Department foundDepartment = this.getEntityManager().find(detachedDepartment.getClass(), detachedDepartment.getDepartmentId()); + + // Should be found + assert (foundDepartment instanceof Department) : MessageFormat.format("Department with id {0} not found, but should be.", detachedDepartment.getDepartmentId()); //NOI18N + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("mergeDepartmentData: foundContact.contactId={0}", foundDepartment.getDepartmentId())); //NOI18N + + // Copy all + Departments.copyDepartmentData(detachedDepartment, foundDepartment); + + // Merge contact instance + final Department managedDepartment = this.getEntityManager().merge(foundDepartment); + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeDepartmentData: managedDepartment={0} - EXIT!", managedDepartment)); //NOI18N + + // Return detached contact + return managedDepartment; + } + + /** + * Returns a detached instance from given fax instance merged into current. + *

+ * @param faxNumber Fax instance + * @param fetchedNumber Found fax number in database + *

+ * @return Detached instance + */ + protected DialableFaxNumber mergeFaxNumberData (final DialableFaxNumber faxNumber, final DialableFaxNumber fetchedNumber) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: faxNumber={0},fetchedNumber={1} - CALLED!", faxNumber, fetchedNumber)); //NOI18N + + // Should be valid + if (null == faxNumber) { + // Throw NPE + throw new NullPointerException("faxNumber is null"); //NOI18N + } else if (fetchedNumber.getPhoneId() == null) { + // ..and again + throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N + } + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N + + // Init query instance + final DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId()); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N + + // Default is null + DialableFaxNumber detachedNumber = null; + + // Is there a difference? + if (!FaxNumbers.isSameFaxNumber(faxNumber, fetchedNumber)) { + // @TODO Copy all to foundNumber, then merge + + // Merge this entry + detachedNumber = this.getEntityManager().merge(foundNumber); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N + + // Return it + return detachedNumber; + } + + /** + * Returns a detached instance from given land-line instance merged with + * current. + *

+ * @param landLineNumber Land-line instance + * @param fetchedNumber Found land-line number in database + *

+ * @return Detached instance + */ + protected DialableLandLineNumber mergeLandLineNumberData (final DialableLandLineNumber landLineNumber, final DialableLandLineNumber fetchedNumber) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: landLineNumber={0},fetchedNumber={1} - CALLED!", landLineNumber, fetchedNumber)); //NOI18N + + // Should be valid + if (null == landLineNumber) { + // Throw NPE + throw new NullPointerException("landLineNumber is null"); //NOI18N + } else if (fetchedNumber.getPhoneId() == null) { + // ..and again + throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N + } + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N + + // Init query instance + final DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId()); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N + + // Default is null + DialableLandLineNumber detachedNumber = null; + + // Is there a difference? + if (!LandLineNumbers.isSameLandLineNumber(landLineNumber, fetchedNumber)) { + // @TODO Copy all to foundNumber, then merge + + // Merge this entry + detachedNumber = this.getEntityManager().merge(foundNumber); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N + + // Return it + return detachedNumber; + } + + /** + * Returns a detached instance from given mobile instance merged with + * current. + *

+ * @param mobileNumber Mobile instance + * @param fetchedNumber Found mobile number in database + *

+ * @return Detached instance + */ + protected DialableMobileNumber mergeMobileNumberData (final DialableMobileNumber mobileNumber, final DialableMobileNumber fetchedNumber) { + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: mobileNumber={0},fetchedNumber={1} - CALLED!", mobileNumber, fetchedNumber)); //NOI18N + + // Should be valid + if (null == mobileNumber) { + // Throw NPE + throw new NullPointerException("mobileNumber is null"); //NOI18N + } else if (fetchedNumber.getMobileId() == null) { + // ..and again + throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N + } + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getMobileId())); //NOI18N + + // Init query instance + final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getMobileId()); + + // Debug message + this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N + + // Default is null + DialableMobileNumber detachedNumber = null; + + // Is there a difference? + if (!MobileNumbers.isSameMobileNumber(mobileNumber, fetchedNumber)) { + // @TODO Copy all to foundNumber, then merge + + // Merge this entry + detachedNumber = this.getEntityManager().merge(foundNumber); + } + + // Trace message + this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N + + // Return it + return detachedNumber; + } + /** * Sends an email with given subject line, template name to given recipient * and user data @@ -1218,7 +1269,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { // Is the fax number set? if (other.getContactMobileNumber() instanceof DialableMobileNumber) { // Copy mobile number - contact.setContactMobileNumber(this.getDetached(other.getContactMobileNumber(), contact.getContactMobileNumber())); + contact.setContactMobileNumber(this.mergeMobileNumberData(other.getContactMobileNumber(), contact.getContactMobileNumber())); } else { // Null it contact.setContactMobileNumber(null); @@ -1236,7 +1287,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { // Is the land-line number set? if (other.getContactLandLineNumber() instanceof DialableLandLineNumber) { // Copy land-line number - contact.setContactLandLineNumber(this.getDetached(other.getContactLandLineNumber(), contact.getContactLandLineNumber())); + contact.setContactLandLineNumber(this.mergeLandLineNumberData(other.getContactLandLineNumber(), contact.getContactLandLineNumber())); } else { // Null it contact.setContactLandLineNumber(null); @@ -1254,7 +1305,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { // Is the fax number set? if (other.getContactFaxNumber() instanceof DialableFaxNumber) { // Copy fax number - contact.setContactFaxNumber(this.getDetached(other.getContactFaxNumber(), contact.getContactFaxNumber())); + contact.setContactFaxNumber(this.mergeFaxNumberData(other.getContactFaxNumber(), contact.getContactFaxNumber())); } else { // Null it contact.setContactFaxNumber(null); @@ -1286,7 +1337,7 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { throw new NullPointerException("contact is null"); //NOI18N } else if (contact.getContactId() == null) { // Throw NPE again - throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N + throw new NullPointerException("contact.contactId is null"); //NOI18N } else if (contact.getContactId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java index 0c0b503..a36c4ca 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java @@ -58,7 +58,7 @@ public abstract class BaseFinancialsReceiptEnterpriseBean extends BaseFinancials throw new NullPointerException("detachedReceipt is null"); //NOI18N } else if (detachedReceipt.getReceiptId() == null) { // Throw NPE again - throw new NullPointerException("detachedReceipt.receiptId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedReceipt.receiptId is null"); //NOI18N } else if (detachedReceipt.getReceiptId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedReceipt.receiptId={0} is not valid.", detachedReceipt.getReceiptId())); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java index 51e27e8..cf4ac8a 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java @@ -58,7 +58,7 @@ public abstract class BaseFinancialsReceiptItemEnterpriseBean extends BaseFinanc throw new NullPointerException("detachedReceiptItem is null"); //NOI18N } else if (detachedReceiptItem.getItemId() == null) { // Throw NPE again - throw new NullPointerException("detachedReceiptItem.itemId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedReceiptItem.itemId is null"); //NOI18N } else if (detachedReceiptItem.getItemId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedReceipt.itemId={0} is not valid.", detachedReceiptItem.getItemId())); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java index afd47f5..7cdb129 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java @@ -144,7 +144,7 @@ public abstract class BaseFinancialsProductEnterpriseBean extends BaseFinancials throw new NullPointerException("detachedProduct is null"); //NOI18N } else if (detachedProduct.getProductId() == null) { // Throw NPE again - throw new NullPointerException("detachedProduct.productId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedProduct.productId is null"); //NOI18N } else if (detachedProduct.getProductId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedProduct.productId={0} is not valid.", detachedProduct.getProductId())); //NOI18N @@ -192,7 +192,7 @@ public abstract class BaseFinancialsProductEnterpriseBean extends BaseFinancials throw new NullPointerException("detachedCategory is null"); //NOI18N } else if (detachedCategory.getCategoryId() == null) { // Throw NPE again - throw new NullPointerException("detachedCategory.categoryId is null"); //NOI18N //NOI18N + throw new NullPointerException("detachedCategory.categoryId is null"); //NOI18N } else if (detachedCategory.getCategoryId() < 1) { // Not valid throw new IllegalStateException(MessageFormat.format("detachedCategory.categoryId={0} is not valid.", detachedCategory.getCategoryId())); //NOI18N