]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 13 Mar 2018 22:21:16 +0000 (23:21 +0100)
committerRoland Häder <roland@mxchange.org>
Tue, 13 Mar 2018 22:27:11 +0000 (23:27 +0100)
- updated persistence.xml with new entities (bonus cards and such)
- added (not done with with this commit) new project dependencies, like
  juser-activity-lib, jcustomer-core and jcustomer-lib
- implemented protected methodsfor creating managed instances of Product
- receipt items now reference an "item manufacturer" which is a BasicData
  instance
- discounts may be added multiple times, so never consider them as being added
- ignore more string for internationalization
- changed copyright to Free Software Foundation

Signed-off-by: Roland Häder <roland@mxchange.org>
nbproject/build-impl.xml
nbproject/project.properties
nbproject/project.xml
src/conf/persistence.xml
src/java/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java
src/java/org/mxchange/jfinancials/database/product/BaseFinancialsProductDatabaseBean.java
src/java/org/mxchange/jfinancials/model/income/FinancialIncomeSessionBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/model/receipt/FinancialAdminReceiptSessionBean.java
src/java/org/mxchange/jfinancials/model/receipt/FinancialReceiptSessionBean.java
src/java/org/mxchange/jfinancials/model/receipt_item/FinancialAdminReceiptItemSessionBean.java
src/java/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItemSessionBean.java

index 8a670fe22e11fb6b4be1a06fb5c9a76cd46e2cf4..d83805458aa1a009f1f0d571fe93259ed5e26e68 100644 (file)
@@ -851,16 +851,19 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jphone-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jphone-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jcontacts-core.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jcontacts-business-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jcontacts-business-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jproduct-core.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${file.reference.jcustomer-core.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${file.reference.jcustomer-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jproduct-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.juser-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.juser-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.juser-login-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.juser-login-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.juser-activity-core.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${file.reference.juser-activity-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.jmailer-ee.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${reference.jfinancials-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${reference.jfinancials-lib.jar}" todir="${build.classes.dir}"/>
@@ -875,23 +878,26 @@ exists or setup the property manually. For example like this:
         <basename file="${file.reference.jphone-core.jar}" property="manifest.file.reference.jphone-core.jar"/>
         <basename file="${file.reference.jphone-lib.jar}" property="manifest.file.reference.jphone-lib.jar"/>
         <basename file="${file.reference.jcontacts-core.jar}" property="manifest.file.reference.jcontacts-core.jar"/>
+        <basename file="${file.reference.jcontacts-lib.jar}" property="manifest.file.reference.jcontacts-lib.jar"/>
         <basename file="${file.reference.jcontacts-business-core.jar}" property="manifest.file.reference.jcontacts-business-core.jar"/>
         <basename file="${file.reference.jcontacts-business-lib.jar}" property="manifest.file.reference.jcontacts-business-lib.jar"/>
-        <basename file="${file.reference.jcontacts-lib.jar}" property="manifest.file.reference.jcontacts-lib.jar"/>
         <basename file="${file.reference.jproduct-core.jar}" property="manifest.file.reference.jproduct-core.jar"/>
+        <basename file="${file.reference.jcustomer-core.jar}" property="manifest.file.reference.jcustomer-core.jar"/>
+        <basename file="${file.reference.jcustomer-lib.jar}" property="manifest.file.reference.jcustomer-lib.jar"/>
         <basename file="${file.reference.jproduct-lib.jar}" property="manifest.file.reference.jproduct-lib.jar"/>
         <basename file="${file.reference.juser-core.jar}" property="manifest.file.reference.juser-core.jar"/>
         <basename file="${file.reference.juser-lib.jar}" property="manifest.file.reference.juser-lib.jar"/>
         <basename file="${file.reference.juser-login-core.jar}" property="manifest.file.reference.juser-login-core.jar"/>
         <basename file="${file.reference.juser-login-lib.jar}" property="manifest.file.reference.juser-login-lib.jar"/>
         <basename file="${file.reference.juser-activity-core.jar}" property="manifest.file.reference.juser-activity-core.jar"/>
+        <basename file="${file.reference.juser-activity-lib.jar}" property="manifest.file.reference.juser-activity-lib.jar"/>
         <basename file="${file.reference.jmailer-ee.jar}" property="manifest.file.reference.jmailer-ee.jar"/>
         <basename file="${reference.jfinancials-core.jar}" property="manifest.reference.jfinancials-core.jar"/>
         <basename file="${reference.jfinancials-lib.jar}" property="manifest.reference.jfinancials-lib.jar"/>
         <basename file="${reference.jfinancials-mailer-lib.jar}" property="manifest.reference.jfinancials-mailer-lib.jar"/>
         <basename file="${file.reference.cdi-api.jar}" property="manifest.file.reference.cdi-api.jar"/>
         <manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update">
-            <attribute name="Extension-List" value="jar-1 jar-2 jar-3 jar-4 jar-5 jar-6 jar-7 jar-8 jar-9 jar-10 jar-11 jar-12 jar-13 jar-14 jar-15 jar-16 jar-17 jar-18 jar-19 jar-20 jar-21 jar-22 "/>
+            <attribute name="Extension-List" value="jar-1 jar-2 jar-3 jar-4 jar-5 jar-6 jar-7 jar-8 jar-9 jar-10 jar-11 jar-12 jar-13 jar-14 jar-15 jar-16 jar-17 jar-18 jar-19 jar-20 jar-21 jar-22 jar-23 jar-24 jar-25 "/>
             <attribute name="jar-1-Extension-Name" value="${manifest.file.reference.jcoreee.jar}"/>
             <attribute name="jar-2-Extension-Name" value="${manifest.file.reference.jcore-logger-lib.jar}"/>
             <attribute name="jar-3-Extension-Name" value="${manifest.file.reference.jcountry-core.jar}"/>
@@ -899,21 +905,24 @@ exists or setup the property manually. For example like this:
             <attribute name="jar-5-Extension-Name" value="${manifest.file.reference.jphone-core.jar}"/>
             <attribute name="jar-6-Extension-Name" value="${manifest.file.reference.jphone-lib.jar}"/>
             <attribute name="jar-7-Extension-Name" value="${manifest.file.reference.jcontacts-core.jar}"/>
-            <attribute name="jar-8-Extension-Name" value="${manifest.file.reference.jcontacts-business-core.jar}"/>
-            <attribute name="jar-9-Extension-Name" value="${manifest.file.reference.jcontacts-business-lib.jar}"/>
-            <attribute name="jar-10-Extension-Name" value="${manifest.file.reference.jcontacts-lib.jar}"/>
+            <attribute name="jar-8-Extension-Name" value="${manifest.file.reference.jcontacts-lib.jar}"/>
+            <attribute name="jar-9-Extension-Name" value="${manifest.file.reference.jcontacts-business-core.jar}"/>
+            <attribute name="jar-10-Extension-Name" value="${manifest.file.reference.jcontacts-business-lib.jar}"/>
             <attribute name="jar-11-Extension-Name" value="${manifest.file.reference.jproduct-core.jar}"/>
-            <attribute name="jar-12-Extension-Name" value="${manifest.file.reference.jproduct-lib.jar}"/>
-            <attribute name="jar-13-Extension-Name" value="${manifest.file.reference.juser-core.jar}"/>
-            <attribute name="jar-14-Extension-Name" value="${manifest.file.reference.juser-lib.jar}"/>
-            <attribute name="jar-15-Extension-Name" value="${manifest.file.reference.juser-login-core.jar}"/>
-            <attribute name="jar-16-Extension-Name" value="${manifest.file.reference.juser-login-lib.jar}"/>
-            <attribute name="jar-17-Extension-Name" value="${manifest.file.reference.juser-activity-core.jar}"/>
-            <attribute name="jar-18-Extension-Name" value="${manifest.file.reference.jmailer-ee.jar}"/>
-            <attribute name="jar-19-Extension-Name" value="${manifest.reference.jfinancials-core.jar}"/>
-            <attribute name="jar-20-Extension-Name" value="${manifest.reference.jfinancials-lib.jar}"/>
-            <attribute name="jar-21-Extension-Name" value="${manifest.reference.jfinancials-mailer-lib.jar}"/>
-            <attribute name="jar-22-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
+            <attribute name="jar-12-Extension-Name" value="${manifest.file.reference.jcustomer-core.jar}"/>
+            <attribute name="jar-13-Extension-Name" value="${manifest.file.reference.jcustomer-lib.jar}"/>
+            <attribute name="jar-14-Extension-Name" value="${manifest.file.reference.jproduct-lib.jar}"/>
+            <attribute name="jar-15-Extension-Name" value="${manifest.file.reference.juser-core.jar}"/>
+            <attribute name="jar-16-Extension-Name" value="${manifest.file.reference.juser-lib.jar}"/>
+            <attribute name="jar-17-Extension-Name" value="${manifest.file.reference.juser-login-core.jar}"/>
+            <attribute name="jar-18-Extension-Name" value="${manifest.file.reference.juser-login-lib.jar}"/>
+            <attribute name="jar-19-Extension-Name" value="${manifest.file.reference.juser-activity-core.jar}"/>
+            <attribute name="jar-20-Extension-Name" value="${manifest.file.reference.juser-activity-lib.jar}"/>
+            <attribute name="jar-21-Extension-Name" value="${manifest.file.reference.jmailer-ee.jar}"/>
+            <attribute name="jar-22-Extension-Name" value="${manifest.reference.jfinancials-core.jar}"/>
+            <attribute name="jar-23-Extension-Name" value="${manifest.reference.jfinancials-lib.jar}"/>
+            <attribute name="jar-24-Extension-Name" value="${manifest.reference.jfinancials-mailer-lib.jar}"/>
+            <attribute name="jar-25-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
         </manifest>
     </target>
     <target depends="compile" name="library-inclusion-in-manifest">
@@ -924,16 +933,19 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jphone-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jphone-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcontacts-core.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcontacts-business-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcontacts-business-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jcontacts-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jproduct-core.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jcustomer-core.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jcustomer-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jproduct-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.juser-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.juser-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.juser-login-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.juser-login-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.juser-activity-core.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.juser-activity-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jmailer-ee.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.jfinancials-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.jfinancials-lib.jar}" todir="${dist.ear.dir}/lib"/>
index 307a88fcfdd70a4367178d931e761a6c86ef7e35..70053150a6d9c37e593c1b60f32b6374cfe5b194 100644 (file)
@@ -23,6 +23,8 @@ endorsed.classpath=
 excludes=
 file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar
 file.reference.jcontacts-business-lib.jar=lib/jcontacts-business-lib.jar
+file.reference.jcustomer-core.jar=lib/jcustomer-core.jar
+file.reference.jcustomer-lib.jar=lib/jcustomer-lib.jar
 file.reference.jfinancials-mailer.jar=lib/jfinancials-mailer.jar
 file.reference.cdi-api.jar=lib/cdi-api.jar
 file.reference.jcontacts-core.jar=lib/jcontacts-core.jar
@@ -37,6 +39,7 @@ file.reference.jphone-lib.jar=lib/jphone-lib.jar
 file.reference.jproduct-core.jar=lib/jproduct-core.jar
 file.reference.jproduct-lib.jar=lib/jproduct-lib.jar
 file.reference.juser-activity-core.jar=lib/juser-activity-core.jar
+file.reference.juser-activity-lib.jar=lib/juser-activity-lib.jar
 file.reference.juser-core.jar=lib/juser-core.jar
 file.reference.juser-lib.jar=lib/juser-lib.jar
 file.reference.juser-login-core.jar=lib/juser-login-core.jar
@@ -45,7 +48,7 @@ includes=**
 j2ee.compile.on.save=true
 j2ee.deploy.on.save=true
 j2ee.platform=1.7
-j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
+j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.enterprise-api.jar:${j2ee.server.home}/modules/javax.security.enterprise.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar
 j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
 j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
 j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
@@ -63,16 +66,19 @@ javac.classpath=\
     ${file.reference.jphone-core.jar}:\
     ${file.reference.jphone-lib.jar}:\
     ${file.reference.jcontacts-core.jar}:\
+    ${file.reference.jcontacts-lib.jar}:\
     ${file.reference.jcontacts-business-core.jar}:\
     ${file.reference.jcontacts-business-lib.jar}:\
-    ${file.reference.jcontacts-lib.jar}:\
     ${file.reference.jproduct-core.jar}:\
+    ${file.reference.jcustomer-core.jar}:\
+    ${file.reference.jcustomer-lib.jar}:\
     ${file.reference.jproduct-lib.jar}:\
     ${file.reference.juser-core.jar}:\
     ${file.reference.juser-lib.jar}:\
     ${file.reference.juser-login-core.jar}:\
     ${file.reference.juser-login-lib.jar}:\
     ${file.reference.juser-activity-core.jar}:\
+    ${file.reference.juser-activity-lib.jar}:\
     ${file.reference.jmailer-ee.jar}:\
     ${reference.jfinancials-core.jar}:\
     ${reference.jfinancials-lib.jar}:\
@@ -123,6 +129,8 @@ runmain.jvmargs=
 source.encoding=UTF-8
 source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/
 source.reference.jcontacts-business-lib.jar=../jcontacts-business-lib/src/
+source.reference.jcustomer-core.jar=../jcustomer-core/src/
+source.reference.jcustomer-lib.jar=../jcustomer-lib/src/
 source.reference.jfinancials-mailer.jar=../jfinancials-mailer/src/
 source.reference.jcontacts-core.jar=../jcontacts-core/src/
 source.reference.jcontacts-lib.jar=../jcontacts-lib/src/
@@ -136,6 +144,7 @@ source.reference.jphone-lib.jar=../jphone-lib/src/
 source.reference.jproduct-core.jar=../jproduct-core/src/
 source.reference.jproduct-lib.jar=../jproduct-lib/src/
 source.reference.juser-activity-core.jar=../juser-activity-core/src/
+source.reference.juser-activity-lib.jar=../juser-activity-lib/src/
 source.reference.juser-core.jar=../juser-core/src/
 source.reference.juser-lib.jar=../juser-lib/src/
 source.reference.juser-login-core.jar=../juser-login-core/src/
index bc504680abfdbb091c2f7e22ce1be28528df233d..b4b207e19e2cbd5b1f31682c28dc981e1deea3c8 100644 (file)
             <included-library dirs="200">file.reference.jphone-core.jar</included-library>
             <included-library dirs="200">file.reference.jphone-lib.jar</included-library>
             <included-library dirs="200">file.reference.jcontacts-core.jar</included-library>
+            <included-library dirs="200">file.reference.jcontacts-lib.jar</included-library>
             <included-library dirs="200">file.reference.jcontacts-business-core.jar</included-library>
             <included-library dirs="200">file.reference.jcontacts-business-lib.jar</included-library>
-            <included-library dirs="200">file.reference.jcontacts-lib.jar</included-library>
             <included-library dirs="200">file.reference.jproduct-core.jar</included-library>
+            <included-library dirs="200">file.reference.jcustomer-core.jar</included-library>
+            <included-library dirs="200">file.reference.jcustomer-lib.jar</included-library>
             <included-library dirs="200">file.reference.jproduct-lib.jar</included-library>
             <included-library dirs="200">file.reference.juser-core.jar</included-library>
             <included-library dirs="200">file.reference.juser-lib.jar</included-library>
             <included-library dirs="200">file.reference.juser-login-core.jar</included-library>
             <included-library dirs="200">file.reference.juser-login-lib.jar</included-library>
             <included-library dirs="200">file.reference.juser-activity-core.jar</included-library>
+            <included-library dirs="200">file.reference.juser-activity-lib.jar</included-library>
             <included-library dirs="200">file.reference.jmailer-ee.jar</included-library>
             <included-library dirs="200">reference.jfinancials-core.jar</included-library>
             <included-library dirs="200">reference.jfinancials-lib.jar</included-library>
index 61a44e2431e86374f41154091ca74180616f3da9..8ce6eb619f7f61126b2c192a9a352dcc3c5a7ed2 100644 (file)
@@ -7,7 +7,7 @@
     <class>org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice</class>
     <class>org.mxchange.jcontactsbusiness.model.department.BusinessDepartment</class>
     <class>org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee</class>
-    <class>org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters</class>
+    <class>org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter</class>
     <class>org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition</class>
     <class>org.mxchange.jcontactsbusiness.model.logo.BusinessLogo</class>
     <class>org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime</class>
@@ -25,6 +25,8 @@
     <class>org.mxchange.jusercore.model.user.LoginUser</class>
     <class>org.mxchange.jusercore.model.user.activity.UserActivityLog</class>
     <class>org.mxchange.jusercore.model.user.password_history.UserPasswordHistory</class>
+    <class>org.mxchange.jcustomercore.model.customer.ContactCustomer</class>
+    <class>org.mxchange.jfinancials.model.bonus_card.FinancialBonusCard</class>
     <exclude-unlisted-classes>false</exclude-unlisted-classes>
     <properties>
       <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
index 9e0d2b7114eeb336ddadefa9b000f45729ad3196..f2faacdfaa914abd8868778e39857cee2731ea82 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016, 2017 Roland Häder
+ * Copyright (C) 2016 - 2018 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
@@ -29,19 +29,16 @@ import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.ContactUtils;
-import org.mxchange.jcontacts.model.contact.UserContact;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
+import org.mxchange.jcontactsbusiness.model.department.Department;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters;
-import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcoreee.database.BaseDatabaseBean;
+import org.mxchange.jcoreee.bean.ejb.BaseEnterpriseBean;
 import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jcountry.model.data.CountryData;
+import org.mxchange.jfinancials.model.receipt.BillableReceipt;
 import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper;
 import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -50,8 +47,8 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumbers;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.utils.PhoneUtils;
-import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserUtils;
 
@@ -60,7 +57,7 @@ import org.mxchange.jusercore.model.user.UserUtils;
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
+public abstract class BaseFinancialsDatabaseBean extends BaseEnterpriseBean {
 
        /**
         * Serial number
@@ -103,14 +100,14 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                        throw new NullPointerException("contact is null"); //NOI18N
                } else if (contact.getContactId() == null) {
                        // Id is set
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+                       throw new NullPointerException("contact.branchId is null"); //NOI18N
                } else if (contact.getContactId() < 1) {
                        // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("contact.branchId={0} is invalid", contact.getContactId())); //NOI18N
                }
 
                // Try to find it (should be there)
-               final Contact managedContact = this.getEntityManager().find(UserContact.class, contact.getContactId());
+               final Contact managedContact = this.getEntityManager().find(contact.getClass(), contact.getContactId());
 
                // Should be there
                assert (managedContact instanceof Contact) : "managedContact is null"; //NOI18N
@@ -146,7 +143,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                }
 
                // Try to find it (should be there)
-               final Country managedCountry = this.getEntityManager().find(CountryData.class, country.getCountryId());
+               final Country managedCountry = this.getEntityManager().find(country.getClass(), country.getCountryId());
 
                // Should be there
                assert (managedCountry instanceof Country) : "managedCountry is null"; //NOI18N
@@ -182,7 +179,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                }
 
                // Try to find it (should be there)
-               final BasicData managedBasicData = this.getEntityManager().find(BusinessBasicData.class, basicData.getBasicDataId());
+               final BasicData managedBasicData = this.getEntityManager().find(basicData.getClass(), basicData.getBasicDataId());
 
                // Should be there
                assert (managedBasicData instanceof BasicData) : "managedBasicData is null"; //NOI18N
@@ -197,31 +194,31 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
        /**
         * Get back a managed instance from given branch office
         * <p>
-        * @param headquarter Unmanaged/detached branch office instance
+        * @param branchOffice Unmanaged/detached branch office instance
         * <p>
-        * @return Managed basic data instance
+        * @return Managed branch office instance
         */
-       protected BranchOffice createManaged (final BranchOffice headquarter) {
+       protected BranchOffice createManaged (final BranchOffice branchOffice) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: branchOffice={1} - CALLED!", this.getClass().getSimpleName(), branchOffice)); //NOI18N
 
                // user should not be null
-               if (null == headquarter) {
+               if (null == branchOffice) {
                        // Abort here
-                       throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getBranchId() == null) {
+                       throw new NullPointerException("branchOffice is null"); //NOI18N
+               } else if (branchOffice.getBranchId() == null) {
                        // Id is set
-                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
-               } else if (headquarter.getBranchId() < 1) {
+                       throw new NullPointerException("branchOffice.branchId is null"); //NOI18N
+               } else if (branchOffice.getBranchId() < 1) {
                        // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getBranchId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is invalid", branchOffice.getBranchId())); //NOI18N
                }
 
                // Try to find it (should be there)
-               final BranchOffice managedBranchOffice = this.getEntityManager().find(BusinessBranchOffice.class, headquarter.getBranchId());
+               final BranchOffice managedBranchOffice = this.getEntityManager().find(branchOffice.getClass(), branchOffice.getBranchId());
 
                // Should be there
-               assert (managedBranchOffice instanceof BasicData) : "managedBranchOffice is null"; //NOI18N
+               assert (managedBranchOffice instanceof BranchOffice) : "managedBranchOffice is null"; //NOI18N
 
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedBranchOffice={1} - EXIT!", this.getClass().getSimpleName(), managedBranchOffice)); //NOI18N
@@ -230,6 +227,42 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                return managedBranchOffice;
        }
 
+       /**
+        * Get back a managed instance from given department
+        * <p>
+        * @param department Unmanaged/detached department instance
+        * <p>
+        * @return Managed department instance
+        */
+       protected Department createManaged (final Department department) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: department={1} - CALLED!", this.getClass().getSimpleName(), department)); //NOI18N
+
+               // user should not be null
+               if (null == department) {
+                       // Abort here
+                       throw new NullPointerException("department is null"); //NOI18N
+               } else if (department.getDepartmentId() == null) {
+                       // Id is set
+                       throw new NullPointerException("department.departmentId is null"); //NOI18N
+               } else if (department.getDepartmentId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("department.departmentId={0} is invalid", department.getDepartmentId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Department managedDepartment = this.getEntityManager().find(department.getClass(), department.getDepartmentId());
+
+               // Should be there
+               assert (managedDepartment instanceof Department) : "managedDepartment is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedDepartment={1} - EXIT!", this.getClass().getSimpleName(), managedDepartment)); //NOI18N
+
+               // Return it
+               return managedDepartment;
+       }
+
        /**
         * Get back a managed instance from given employee
         * <p>
@@ -254,7 +287,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                }
 
                // Try to find it (should be there)
-               final Employable managedEmployee = this.getEntityManager().find(BusinessEmployee.class, employee.getEmployeeId());
+               final Employable managedEmployee = this.getEntityManager().find(employee.getClass(), employee.getEmployeeId());
 
                // Should be there
                assert (managedEmployee instanceof Employable) : "managedEmployee is null"; //NOI18N
@@ -267,39 +300,111 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
        }
 
        /**
-        * Get back a managed instance from given headquarters
+        * Get back a managed instance from given headquarter
         * <p>
-        * @param headquarters Unmanaged/detached headquarters instance
+        * @param headquarter Unmanaged/detached headquarter instance
         * <p>
         * @return Managed basic data instance
         */
-       protected Headquarter createManaged (final Headquarter headquarters) {
+       protected Headquarter createManaged (final Headquarter headquarter) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarters)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: headquarter={1} - CALLED!", this.getClass().getSimpleName(), headquarter)); //NOI18N
 
                // user should not be null
-               if (null == headquarters) {
+               if (null == headquarter) {
                        // Abort here
                        throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarters.getHeadquartersId() == null) {
+               } else if (headquarter.getHeadquarterId() == null) {
+                       // Id is set
+                       throw new NullPointerException("headquarter.headquarterId is null"); //NOI18N
+               } else if (headquarter.getHeadquarterId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquarterId={0} is invalid", headquarter.getHeadquarterId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final Headquarter managedHeadquarter = this.getEntityManager().find(headquarter.getClass(), headquarter.getHeadquarterId());
+
+               // Should be there
+               assert (managedHeadquarter instanceof BasicData) : "managedHeadquarter is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarter={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarter)); //NOI18N
+
+               // Return it
+               return managedHeadquarter;
+       }
+
+       /**
+        * Get back a managed instance from given job position
+        * <p>
+        * @param jobPosition Unmanaged/detached job position instance
+        * <p>
+        * @return Managed job position instance
+        */
+       protected JobPosition createManaged (final JobPosition jobPosition) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: jobPosition={1} - CALLED!", this.getClass().getSimpleName(), jobPosition)); //NOI18N
+
+               // user should not be null
+               if (null == jobPosition) {
+                       // Abort here
+                       throw new NullPointerException("jobPosition is null"); //NOI18N
+               } else if (jobPosition.getJobPositionId() == null) {
+                       // Id is set
+                       throw new NullPointerException("jobPosition.jobPositionId is null"); //NOI18N
+               } else if (jobPosition.getJobPositionId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("jobPosition.jobPositionId={0} is invalid", jobPosition.getJobPositionId())); //NOI18N
+               }
+
+               // Try to find it (should be there)
+               final JobPosition managedJobPosition = this.getEntityManager().find(jobPosition.getClass(), jobPosition.getJobPositionId());
+
+               // Should be there
+               assert (managedJobPosition instanceof JobPosition) : "managedJobPosition is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedJobPosition={1} - EXIT!", this.getClass().getSimpleName(), managedJobPosition)); //NOI18N
+
+               // Return it
+               return managedJobPosition;
+       }
+
+       /**
+        * Get back a managed instance from given mobile provider
+        * <p>
+        * @param mobileProvider Unmanaged/detached mobile provider instance
+        * <p>
+        * @return Managed mobile provider instance
+        */
+       protected MobileProvider createManaged (final MobileProvider mobileProvider) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: mobileProvider={1} - CALLED!", this.getClass().getSimpleName(), mobileProvider)); //NOI18N
+
+               // user should not be null
+               if (null == mobileProvider) {
+                       // Abort here
+                       throw new NullPointerException("mobileProvider is null"); //NOI18N
+               } else if (mobileProvider.getProviderId() == null) {
                        // Id is set
-                       throw new NullPointerException("headquarter.headquartersId is null"); //NOI18N
-               } else if (headquarters.getHeadquartersId() < 1) {
+                       throw new NullPointerException("mobileProvider.providerId is null"); //NOI18N
+               } else if (mobileProvider.getProviderId() < 1) {
                        // Id is set
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.headquartersId={0} is invalid", headquarters.getHeadquartersId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("mobileProvider.providerId={0} is invalid", mobileProvider.getProviderId())); //NOI18N
                }
 
                // Try to find it (should be there)
-               final Headquarter managedHeadquarters = this.getEntityManager().find(BusinessHeadquarters.class, headquarters.getHeadquartersId());
+               final MobileProvider managedMobileProvider = this.getEntityManager().find(mobileProvider.getClass(), mobileProvider.getProviderId());
 
                // Should be there
-               assert (managedHeadquarters instanceof BasicData) : "managedHeadquarters is null"; //NOI18N
+               assert (managedMobileProvider instanceof MobileProvider) : "managedMobileProvider is null"; //NOI18N
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedHeadquarters={1} - EXIT!", this.getClass().getSimpleName(), managedHeadquarters)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedMobileProvider={1} - EXIT!", this.getClass().getSimpleName(), managedMobileProvider)); //NOI18N
 
                // Return it
-               return managedHeadquarters;
+               return managedMobileProvider;
        }
 
        /**
@@ -335,7 +440,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                }
 
                // Try to find it (should be there)
-               final User managedUser = this.getEntityManager().find(LoginUser.class, user.getUserId());
+               final User managedUser = this.getEntityManager().find(user.getClass(), user.getUserId());
 
                // Should be there
                assert (managedUser instanceof User) : "managedUser is null"; //NOI18N
@@ -347,6 +452,51 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                return managedUser;
        }
 
+       /**
+        * Get back a managed instance from given receipt
+        * <p>
+        * @param receipt Unmanaged/detached receipt instance
+        * <p>
+        * @return Managed receipt instance
+        */
+       protected BillableReceipt createManaged (final BillableReceipt receipt) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: receipt={1} - CALLED!", this.getClass().getSimpleName(), receipt)); //NOI18N
+
+               // receipt should not be null
+               if (null == receipt) {
+                       // Abort here
+                       throw new NullPointerException("receipt is null"); //NOI18N
+               } else if (receipt.getReceiptId() == null) {
+                       // Id is set
+                       throw new NullPointerException("receipt.receiptId is null"); //NOI18N
+               } else if (receipt.getReceiptId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptId={0} is invalid", receipt.getReceiptId())); //NOI18N
+               } else if (receipt.getReceiptBranchOffice() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("receipt.receiptBranchOffice is null"); //NOI18N
+               } else if (receipt.getReceiptBranchOffice().getBranchId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("receipt.receiptBranchOffice.contactId is null"); //NOI18N
+               } else if (receipt.getReceiptBranchOffice().getBranchId() < 1) {
+                       // Not valid id number
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptBranchOffice.contactId={0} is not valid", receipt.getReceiptBranchOffice().getBranchId())); //NOI18N#
+               }
+
+               // Try to find it (should be there)
+               final BillableReceipt managedReceipt = this.getEntityManager().find(receipt.getClass(), receipt.getReceiptId());
+
+               // Should be there
+               assert (managedReceipt instanceof BillableReceipt) : "managedReceipt is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedReceipt={1} - EXIT!", this.getClass().getSimpleName(), managedReceipt)); //NOI18N
+
+               // Return it
+               return managedReceipt;
+       }
+
        /**
         * Sets created timestamp on all opening times.
         * <p>
@@ -360,10 +510,10 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                // Validate parameter
                if (null == openingTimes) {
                        // Throw NPE
-                       throw new NullPointerException("openingTimes is null");
+                       throw new NullPointerException("openingTimes is null"); //NOI18N
                } else if (openingTimes.isEmpty()) {
                        // Throw IAE
-                       throw new IllegalArgumentException("openingTimes is empty");
+                       throw new IllegalArgumentException("openingTimes is empty"); //NOI18N
                }
 
                // Walk through whole list
@@ -371,7 +521,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                        // Id should not be set
                        if (openingTime.getOpeningId() != null) {
                                // Abort here
-                               throw new IllegalStateException("openingTime.openingId is not null");
+                               throw new IllegalStateException("openingTime.openingId is not null"); //NOI18N
                        }
 
                        // Set created timestamp
@@ -394,7 +544,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                        throw new NullPointerException("contact is null"); //NOI18N
                } else if (contact.getContactId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is unexpected.", contact.getContactId()));
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is unexpected.", contact.getContactId())); //NOI18N
                }
 
                // Get all phone instances
@@ -451,7 +601,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                        throw new NullPointerException("branchOffice is null"); //NOI18N
                } else if (branchOffice.getBranchId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is unexpected.", branchOffice.getBranchId()));
+                       throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is unexpected.", branchOffice.getBranchId())); //NOI18N
                }
 
                // Get all phone instances
@@ -486,7 +636,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
        /**
         * Updates all branch office's phone entry's created timestamps
         * <p>
-        * @param headquarter Headquarters instance to update
+        * @param headquarter Headquarter instance to update
         */
        protected void setAllPhoneEntriesCreated (final Headquarter headquarter) {
                // Trace message
@@ -496,14 +646,14 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                if (null == headquarter) {
                        // Throw NPE again
                        throw new NullPointerException("headquarter is null"); //NOI18N
-               } else if (headquarter.getHeadquartersId() != null) {
+               } else if (headquarter.getHeadquarterId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquarter.branchId={0} is unexpected.", headquarter.getHeadquartersId()));
+                       throw new IllegalArgumentException(MessageFormat.format("headquarter.branchId={0} is unexpected.", headquarter.getHeadquarterId())); //NOI18N
                }
 
                // Get all phone instances
-               final DialableLandLineNumber landLineNumber = headquarter.getHeadquartersLandLineNumber();
-               final DialableFaxNumber faxNumber = headquarter.getHeadquartersFaxNumber();
+               final DialableLandLineNumber landLineNumber = headquarter.getHeadquarterLandLineNumber();
+               final DialableFaxNumber faxNumber = headquarter.getHeadquarterFaxNumber();
 
                // Debug message
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("setAllPhoneEntriesCreated: landLineNumber={0},faxNumber={1}", landLineNumber, faxNumber)); //NOI18N
@@ -545,7 +695,7 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
                        throw new NullPointerException("basicData is null"); //NOI18N
                } else if (basicData.getBasicDataId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is unexpected.", basicData.getBasicDataId()));
+                       throw new IllegalArgumentException(MessageFormat.format("basicData.basicDataId={0} is unexpected.", basicData.getBasicDataId())); //NOI18N
                }
 
                // Get all phone instances
index 6331338df66fe9959b9cc70ccb53acffe5a4e5b9..bf5b5d0e55ebf9def34ca4d43e152da930de4401 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jfinancials.database.product;
 import java.text.MessageFormat;
 import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
 import org.mxchange.jproduct.model.category.Category;
+import org.mxchange.jproduct.model.product.Product;
 
 /**
  * A general bean for product-related methods that can be generalized.
@@ -51,16 +52,16 @@ public abstract class BaseFinancialsProductDatabaseBean extends BaseFinancialsDa
                if (null == category) {
                        // Throw NPE
                        throw new NullPointerException("category is null");
-               } else if(category.getCategoryI18nKey() == null) {
+               } else if (category.getCategoryI18nKey() == null) {
                        // Throw it again
                        throw new NullPointerException("category.categoryTitle is null");
                } else if (category.getCategoryI18nKey().isEmpty()) {
                        // Throw it again
                        throw new IllegalArgumentException("category.categoryTitle is empty");
-               } else if(category.getCategoryId() == null) {
+               } else if (category.getCategoryId() == null) {
                        // Throw it again
                        throw new NullPointerException("category.categoryId is null");
-               } else if(category.getCategoryId() < 1) {
+               } else if (category.getCategoryId() < 1) {
                        // Throw it again
                        throw new IllegalArgumentException(MessageFormat.format("category.categoryId={0} is not valid.", category.getCategoryId()));
                }
@@ -78,4 +79,43 @@ public abstract class BaseFinancialsProductDatabaseBean extends BaseFinancialsDa
                return managedCategory;
        }
 
+       /**
+        * Creates a managed instance from given product instance
+        * <p>
+        * @param product Unmanaged product instance
+        * <p>
+        * @return Managed instance
+        */
+       protected Product createManaged (final Product product) {
+               // Validate parameter
+               if (null == product) {
+                       // Throw NPE
+                       throw new NullPointerException("product is null");
+               } else if (product.getProductI18nKey() == null) {
+                       // Throw it again
+                       throw new NullPointerException("product.productTitle is null");
+               } else if (product.getProductI18nKey().isEmpty()) {
+                       // Throw it again
+                       throw new IllegalArgumentException("product.productTitle is empty");
+               } else if (product.getProductId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("product.productId is null");
+               } else if (product.getProductId() < 1) {
+                       // Throw it again
+                       throw new IllegalArgumentException(MessageFormat.format("product.productId={0} is not valid.", product.getProductId()));
+               }
+
+               // Try to find it
+               final Product managedProduct = this.getEntityManager().find(product.getClass(), product.getProductId());
+
+               // Should be there
+               assert (managedProduct instanceof Product) : "managedProduct is null"; //NOI18N
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.createManaged: managedProduct={1} - EXIT!", this.getClass().getSimpleName(), managedProduct)); //NOI18N
+
+               // Return it
+               return managedProduct;
+       }
+
 }
diff --git a/src/java/org/mxchange/jfinancials/model/income/FinancialIncomeSessionBean.java b/src/java/org/mxchange/jfinancials/model/income/FinancialIncomeSessionBean.java
new file mode 100644 (file)
index 0000000..f039c00
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2017, 2018 Free Software Foundation
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.model.income;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import javax.ejb.Stateless;
+import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
+
+/**
+ * A stateless bean for general purposes for incomes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Stateless (name = "financialIncome", description = "A stateless session bean for handling income.")
+public class FinancialIncomeSessionBean extends BaseFinancialsDatabaseBean implements FinancialIncomeSessionBeanRemote {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 659_868_076_723_741L;
+
+       @Override
+       public BillableIncome addIncome (final BillableIncome income) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addIncome(): income={1} - CALLED!", this.getClass().getSimpleName(), income)); //NOI18N
+
+               // Validate parameter
+               if (null == income) {
+                       // Throw NPE
+                       throw new NullPointerException("income is null"); //NOI18N
+               } else if (income.getIncomeId() != null) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("income.incomeId={0} is not expected.", income.getIncomeId())); //NOI18N
+               } else if (income.getIncomeEnabled() == null) {
+                       // Throw it again
+                       throw new NullPointerException("income.incomeEnabled is null"); //NOI18N
+               } else if (income.getIncomeInterval() == null) {
+                       // Throw it again
+                       throw new NullPointerException("income.incomeInterval is null"); //NOI18N
+               } else if (income.getIncomeSingleAmount() == null) {
+                       // Throw it again
+                       throw new NullPointerException("income.incomeSingleAmount is null"); //NOI18N
+               } else if (income.getIncomeSingleAmount() < 0) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("income.incomeSingleAmount={0} is invalid.", income.getIncomeSingleAmount())); //NOI18N
+               } else if (income.getIncomeTitle() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("income.incomeTitle is null"); //NOI18N
+               } else if (income.getIncomeTitle().isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("income.incomeTitle is empty"); //NOI18N
+               } else if (income.getIncomeUser() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("income.incomeUser is null"); //NOI18N
+               } else if (income.getIncomeUser().getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("income.incomeUser.userId is null"); //NOI18N
+               } else if (income.getIncomeUser().getUserId() < 0) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("income.incomeUser.userId={0} is invalid.", income.getIncomeUser().getUserId())); //NOI18N
+               }
+
+               // Add created instance
+               income.setIncomeCreated(new Date());
+
+               // Persist it
+               this.getEntityManager().persist(income);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addIncome(): income.incomeId={1} - EXIT!", this.getClass().getSimpleName(), income.getIncomeId())); //NOI18N
+
+               // Return it
+               return income;
+       }
+
+}
index ee4754c1aff5c1e104e998f0ca48f6c10fa5716a..f5e1de68012b6e5252c7fac54ad37bc837be9b16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Häder
+ * Copyright (C) 2017, 2018 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -47,36 +47,36 @@ public class FinancialAdminReceiptSessionBean extends BaseFinancialsDatabaseBean
        @Override
        public BillableReceipt addReceipt (final BillableReceipt receipt) throws ReceiptAlreadyAddedException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt={1} - CALLED!", this.getClass().getSimpleName(), receipt));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt={1} - CALLED!", this.getClass().getSimpleName(), receipt)); //NOI18N
 
                // Validate parameter
                if (null == receipt) {
                        // Throw NPE
-                       throw new NullPointerException("receipt is null");
+                       throw new NullPointerException("receipt is null"); //NOI18N
                } else if (receipt.getReceiptId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptId={0} is not expected.", receipt.getReceiptId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptId={0} is not expected.", receipt.getReceiptId())); //NOI18N
                } else if (receipt.getReceiptIssued() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receipt.receiptIssued is null");
+                       throw new NullPointerException("receipt.receiptIssued is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice() == null) {
                        // Throw it again
-                       throw new NullPointerException("receipt.receiptBranchOffice is null");
+                       throw new NullPointerException("receipt.receiptBranchOffice is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice().getBranchId() == null) {
                        // Throw it again
-                       throw new NullPointerException("receipt.receiptBranchOffice.branchId is null");
+                       throw new NullPointerException("receipt.receiptBranchOffice.branchId is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice().getBranchId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptBranchOffice.branchId={0} is not valid.", receipt.getReceiptBranchOffice().getBranchId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptBranchOffice.branchId={0} is not valid.", receipt.getReceiptBranchOffice().getBranchId())); //NOI18N
                } else if (receipt.getReceiptPaymentType() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receipt.receiptPaymentType is null");
+                       throw new NullPointerException("receipt.receiptPaymentType is null"); //NOI18N
                } else if ((receipt.getReceiptUser() instanceof User) && receipt.getReceiptUser().getUserId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receipt.receiptUser.userId is null");
+                       throw new NullPointerException("receipt.receiptUser.userId is null"); //NOI18N
                } else if ((receipt.getReceiptUser() instanceof User) && receipt.getReceiptUser().getUserId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("receipt.receiptUser.userId={0} is not valid", receipt.getReceiptUser().getUserId()));
+                       throw new NullPointerException(MessageFormat.format("receipt.receiptUser.userId={0} is not valid", receipt.getReceiptUser().getUserId())); //NOI18N
                } else if (this.receiptBean.isReceiptRegistered(receipt)) {
                        // Has already been registered
                        throw new ReceiptAlreadyAddedException(receipt);
@@ -107,7 +107,7 @@ public class FinancialAdminReceiptSessionBean extends BaseFinancialsDatabaseBean
                this.getEntityManager().persist(receipt);
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), receipt.getReceiptId()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), receipt.getReceiptId())); //NOI18N
 
                // Return it
                return receipt;
index a7da53d043b5620486fd99b7d92cf07f26ea1bba..1ebe94c05626e199e8fd41c3b733bbf62b7f1a5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Häder
+ * Copyright (C) 2017, 2018 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -42,36 +42,36 @@ public class FinancialReceiptSessionBean extends BaseFinancialsDatabaseBean impl
        @Override
        public BillableReceipt addReceipt (final BillableReceipt receipt) throws ReceiptAlreadyAddedException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt={1} - CALLED!", this.getClass().getSimpleName(), receipt));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt={1} - CALLED!", this.getClass().getSimpleName(), receipt)); //NOI18N
 
                // Validate parameter
                if (null == receipt) {
                        // Throw NPE
-                       throw new NullPointerException("receipt is null");
+                       throw new NullPointerException("receipt is null"); //NOI18N
                } else if (receipt.getReceiptId() != null) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptId={0} is not expected.", receipt.getReceiptId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptId={0} is not expected.", receipt.getReceiptId())); //NOI18N
                } else if (receipt.getReceiptIssued() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receipt.receiptIssued is null");
+                       throw new NullPointerException("receipt.receiptIssued is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice() == null) {
                        // Throw it again
-                       throw new NullPointerException("receipt.receiptBranchOffice is null");
+                       throw new NullPointerException("receipt.receiptBranchOffice is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice().getBranchId() == null) {
                        // Throw it again
-                       throw new NullPointerException("receipt.receiptBranchOffice.branchId is null");
+                       throw new NullPointerException("receipt.receiptBranchOffice.branchId is null"); //NOI18N
                } else if (receipt.getReceiptBranchOffice().getBranchId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptBranchOffice.branchId={0} is not valid.", receipt.getReceiptBranchOffice().getBranchId()));
+                       throw new IllegalArgumentException(MessageFormat.format("receipt.receiptBranchOffice.branchId={0} is not valid.", receipt.getReceiptBranchOffice().getBranchId())); //NOI18N
                } else if (receipt.getReceiptPaymentType() == null) {
                        // Throw NPE
-                       throw new NullPointerException("receipt.receiptPaymentType is null");
+                       throw new NullPointerException("receipt.receiptPaymentType is null"); //NOI18N
                } else if ((receipt.getReceiptUser() instanceof User) && receipt.getReceiptUser().getUserId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("receipt.receiptUser.userId is null");
+                       throw new NullPointerException("receipt.receiptUser.userId is null"); //NOI18N
                } else if ((receipt.getReceiptUser() instanceof User) && receipt.getReceiptUser().getUserId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("receipt.receiptUser.userId={0} is not valid", receipt.getReceiptUser().getUserId()));
+                       throw new NullPointerException(MessageFormat.format("receipt.receiptUser.userId={0} is not valid", receipt.getReceiptUser().getUserId())); //NOI18N
                } else if (this.isReceiptRegistered(receipt)) {
                        // Has already been registered
                        throw new ReceiptAlreadyAddedException(receipt);
@@ -84,7 +84,7 @@ public class FinancialReceiptSessionBean extends BaseFinancialsDatabaseBean impl
                this.getEntityManager().persist(receipt);
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), receipt.getReceiptId()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.addReceipt(): receipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), receipt.getReceiptId())); //NOI18N
 
                // Return it
                return receipt;
@@ -94,16 +94,16 @@ public class FinancialReceiptSessionBean extends BaseFinancialsDatabaseBean impl
        @SuppressWarnings ("unchecked")
        public List<BillableReceipt> allReceipts () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allReceipts(): CALLED!", this.getClass().getSimpleName()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allReceipts(): CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Query all
-               final Query query = this.getEntityManager().createNamedQuery("AllReceipts");
+               final Query query = this.getEntityManager().createNamedQuery("AllReceipts"); //NOI18N
 
                // Get all
                final List<BillableReceipt> receipts = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allReceipts(): receipts.size()={1} EXIT!", this.getClass().getSimpleName(), receipts.size()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allReceipts(): receipts.size()={1} EXIT!", this.getClass().getSimpleName(), receipts.size())); //NOI18N
 
                // Return it
                return receipts;
@@ -113,31 +113,31 @@ public class FinancialReceiptSessionBean extends BaseFinancialsDatabaseBean impl
        @SuppressWarnings ("unchecked")
        public List<BillableReceipt> allUsersReceipts (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsersReceipts(): user={1} - CALLED!", this.getClass().getSimpleName(), user));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsersReceipts(): user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // Validate parameter
                if (null == user) {
                        // Throw NPE
-                       throw new NullPointerException("user is null");
+                       throw new NullPointerException("user is null"); //NOI18N
                } else if (user.getUserId() == null) {
                        // Throw it again
-                       throw new NullPointerException("user.userId is null");
+                       throw new NullPointerException("user.userId is null"); //NOI18N
                } else if (user.getUserId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId()));
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
                }
 
                // Query all
-               final Query query = this.getEntityManager().createNamedQuery("SearchAllUserReceipts");
+               final Query query = this.getEntityManager().createNamedQuery("SearchAllUserReceipts"); //NOI18N
 
                // Add parameter
-               query.setParameter("receiptUser", user);
+               query.setParameter("receiptUser", user); //NOI18N
 
                // Get all
                final List<BillableReceipt> receipts = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsersReceipts(): receipts.size()={1} EXIT!", this.getClass().getSimpleName(), receipts.size()));
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsersReceipts(): receipts.size()={1} EXIT!", this.getClass().getSimpleName(), receipts.size())); //NOI18N
 
                // Return it
                return receipts;
@@ -164,7 +164,7 @@ public class FinancialReceiptSessionBean extends BaseFinancialsDatabaseBean impl
                                // Yes, then stop searching
                                isFound = true;
                                break;
-                       } else if (Receipts.isSameReceipt(foundReceipt, receipt)){
+                       } else if (Receipts.isSameReceipt(foundReceipt, receipt)) {
                                // Yes, then stop searching
                                isFound = true;
                                break;
index 00846afb2533796ebdaacf53c2c2dea97586c195..56253f325badb43432f159a886db5470c53e257f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Häder
+ * Copyright (C) 2017, 2018 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -21,7 +21,8 @@ import java.util.Date;
 import java.util.List;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
-import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jfinancials.database.product.BaseFinancialsProductDatabaseBean;
 import org.mxchange.jfinancials.exceptions.receipt_item.ReceiptItemAlreadyAddedException;
 
 /**
@@ -30,7 +31,7 @@ import org.mxchange.jfinancials.exceptions.receipt_item.ReceiptItemAlreadyAddedE
  * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "adminFinancialReceiptItem", description = "A stateless session bean for administrative purposes for receipt itemss.")
-public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabaseBean implements FinancialAdminReceiptItemSessionBeanRemote {
+public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsProductDatabaseBean implements FinancialAdminReceiptItemSessionBeanRemote {
 
        /**
         * Serial number
@@ -40,7 +41,7 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabase
        /**
         * General EJB
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/financialReceiptItem!org.mxchange.jfinancials.model.receipt.item.FinancialReceiptItemSessionBeanRemote")
+       @EJB (lookup = "java:global/jfinancials-ejb/financialReceiptItem!org.mxchange.jfinancials.model.receipt_item.FinancialReceiptItemSessionBeanRemote")
        private FinancialReceiptItemSessionBeanRemote receiptItemBean;
 
        @Override
@@ -61,7 +62,10 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabase
                } else if (receiptItem.getItemProduct().getProductId() < 1) {
                        // Throw IAE
                        throw new IllegalArgumentException(MessageFormat.format("receiptItem.itemProduct.productId={0} is invalid.", receiptItem.getItemProduct().getProductId())); //NOI18N
-               } else if (receiptItem.getItemProductQuantity() < 1) {
+               } else if (receiptItem.getItemProductQuantity() == null) {
+                       // Throw it again
+                       throw new NullPointerException("receiptItem.itemProductQuantity is null"); //NOI18N
+               } else if (receiptItem.getItemProductQuantity().doubleValue() <= 0.0) {
                        // Throw IAE again
                        throw new IllegalArgumentException(MessageFormat.format("receiptItem.itemProductQuantity={0} is invalid.", receiptItem.getItemProductQuantity())); //NOI18N
                } else if (receiptItem.getItemReceipt() == null) {
@@ -78,6 +82,21 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabase
                        throw new ReceiptItemAlreadyAddedException(receiptItem);
                }
 
+               // Make product managed
+               receiptItem.setItemProduct(this.createManaged(receiptItem.getItemProduct()));
+
+               // Make receipt managed
+               receiptItem.setItemReceipt(this.createManaged(receiptItem.getItemReceipt()));
+
+               // Is a manufacturer/producer set?
+               if (receiptItem.getItemManufacturer() instanceof BasicData) {
+                       // Then get managed instance from it
+                       final BasicData basicData = this.createManaged(receiptItem.getItemManufacturer());
+
+                       // Set it back
+                       receiptItem.setItemManufacturer(basicData);
+               }
+
                // Add created timestamp
                receiptItem.setItemCreated(new Date());
 
@@ -102,6 +121,12 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabase
                // Default is not found
                boolean isFound = false;
 
+               // Is the item type a discount?
+               if (receiptItem.getItemIsDiscount()) {
+                       // Yes, then allow it multiple items
+                       return false;
+               }
+
                /*
                 * Get all receipt's receipt items. No need to look global as people may
                 * buy the same item again and again ... ;-)
@@ -111,7 +136,7 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsDatabase
                // Loop through all entries
                for (final BillableReceiptItem item : receiptItems) {
                        // Is it the same item?
-                       if (ReceiptItems.isSameReceiptItem(item, receiptItem)) {
+                       if (ReceiptItems.isSameReceiptItem(item, receiptItem) && (!item.getItemIsRefund())) {
                                // Found it
                                isFound = true;
                                break;
index 260874970c3939f64e4b681150571e5feeb54029..b2b8cf02dc5b4304622dbe74d5b1e7305b257281 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Häder
+ * Copyright (C) 2017, 2018 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -57,7 +57,10 @@ public class FinancialReceiptItemSessionBean extends BaseFinancialsDatabaseBean
                } else if (receiptItem.getItemProduct().getProductId() < 1) {
                        // Throw IAE
                        throw new IllegalArgumentException(MessageFormat.format("receiptItem.itemProduct.productId={0} is invalid.", receiptItem.getItemProduct().getProductId())); //NOI18N
-               } else if (receiptItem.getItemProductQuantity() < 1) {
+               } else if (receiptItem.getItemProductQuantity() == null) {
+                       // Throw it again
+                       throw new NullPointerException("receiptItem.itemProductQuantity is null"); //NOI18N
+               } else if (receiptItem.getItemProductQuantity().doubleValue() <= 0.0) {
                        // Throw IAE again
                        throw new IllegalArgumentException(MessageFormat.format("receiptItem.itemProductQuantity={0} is invalid.", receiptItem.getItemProductQuantity())); //NOI18N
                } else if (receiptItem.getItemReceipt() == null) {