]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 15:39:19 +0000 (17:39 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 15:39:19 +0000 (17:39 +0200)
- sorted members
- added logo's local file name
- made some data nullable as it might not be available

src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java
src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java
src/org/mxchange/jcontactsbusiness/logo/BusinessLogo.java
src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java

index 67676ea4d0afbc73c5cc2313c2cf7b264bf7c508..3aab32f2cf011506b8fb8b77c84f6feebbcc7d43 100644 (file)
@@ -59,11 +59,24 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
        private Long companyBasicId;
 
        /**
-        * Company name
+        * Comments (any)
         */
-       @Basic (optional = false)
-       @Column (name = "company_name", length = 100, nullable = false, unique = true)
-       private String companyName;
+       @Lob
+       @Column (name = "company_comments")
+       private String companyComments;
+
+       /**
+        * Company's main email address (example: info@company.com)
+        */
+       @Column (name = "company_email_address", length = 100)
+       private String companyEmailAddress;
+
+       /**
+        * Company's main fax numbers: +ccxxxxxxxxxx
+        */
+       @JoinColumn (name = "company_fax_number_id")
+       @OneToMany (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+       private List<DialableFaxNumber> companyFaxNumberList;
 
        /**
         * Legal status of company (example: "Inc.", "GmbH")
@@ -80,17 +93,11 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
        private BusinessLogo companyLogo;
 
        /**
-        * Tax number
+        * Company name
         */
        @Basic (optional = false)
-       @Column (name = "company_tax_number", length = 30)
-       private String companyTaxNumber;
-
-       /**
-        * URL for company website
-        */
-       @Column (name = "company_website_url")
-       private String companyWebsiteUrl;
+       @Column (name = "company_name", length = 100, nullable = false)
+       private String companyName;
 
        /**
         * Company's main phone number: +ccxxxxxxxxxx
@@ -100,24 +107,16 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
        private List<DialableLandLineNumber> companyPhoneNumber;
 
        /**
-        * Company's main fax numbers: +ccxxxxxxxxxx
-        */
-       @JoinColumn (name = "company_fax_number_id")
-       @OneToMany (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
-       private List<DialableFaxNumber> companyFaxNumberList;
-
-       /**
-        * Company's main email address (example: info@company.com)
+        * Tax number
         */
-       @Column (name = "company_email_address", length = 100)
-       private String companyEmailAddress;
+       @Column (name = "company_tax_number", length = 30)
+       private String companyTaxNumber;
 
        /**
-        * Comments (any)
+        * URL for company website
         */
-       @Lob
-       @Column (name = "company_comments")
-       private String companyComments;
+       @Column (name = "company_website_url")
+       private String companyWebsiteUrl;
 
        @Override
        public int compareTo (final BusinessBasicData businessData) {
index 223fe5d468d41fc2d82723724d09be3879e7f257..1210be12f4e0861a25dccc869ff3e76108c646ad 100644 (file)
@@ -47,59 +47,46 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        private static final long serialVersionUID = 47_957_817_276_871_852L;
 
        /**
-        * Id number
-        */
-       @Id
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       @Column (name = "branch_id", length = 20, nullable = false, updatable = false)
-       private Long branchId;
-
-       /**
-        * Branch office's street name
-        */
-       @Basic (optional = false)
-       @Column (name = "branch_street", length = 100, nullable = false)
-       private String branchStreet;
-
-       /**
-        * Branch office's house number
+        * Branch office's city name
         */
        @Basic (optional = false)
-       @Column (name = "branch_house_number", length = 3, nullable = false)
-       private Short branchHouseNumber;
+       @Column (name = "branch_city", length = 100, nullable = false)
+       private String branchCity;
 
        /**
-        * Branch office's store (if multiple-store building)
+        * Branch office's country code
         */
-       @Column (name = "branch_store", length = 3)
-       private Short branchStore;
+       @JoinColumn (name = "branch_country_id", nullable = false)
+       @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+       private Country branchCountry;
 
        /**
-        * Branch office's suite number (if applyable)
+        * Branch office's main email address (example: branch-name@company.com)
         */
-       @Column (name = "branch_suite_number", length = 4)
-       private Short branchSuiteNumber;
+       @Column (name = "branch_email_address", length = 100)
+       private String branchEmailAddress;
 
        /**
-        * Branch office's ZIP code
+        * Branch office's main fax number: +ccxxxxxxxxxx
         */
-       @Basic (optional = false)
-       @Column (name = "branch_zip_code", length = 6, nullable = false)
-       private Integer branchZipCode;
+       @JoinColumn (name = "branch_fax_number_id")
+       @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+       private DialableFaxNumber branchFaxNumber;
 
        /**
-        * Branch office's city name
+        * Branch office's house number
         */
        @Basic (optional = false)
-       @Column (name = "branch_city", length = 100, nullable = false)
-       private String branchCity;
+       @Column (name = "branch_house_number", length = 3, nullable = false)
+       private Short branchHouseNumber;
 
        /**
-        * Branch office's country code
+        * Id number
         */
-       @JoinColumn (name = "branch_country_id", nullable = false)
-       @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
-       private Country branchCountry;
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "branch_id", length = 20, nullable = false, updatable = false)
+       private Long branchId;
 
        /**
         * Branch office's main phone number: +ccxxxxxxxxxx
@@ -109,17 +96,30 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        private DialableLandLineNumber branchPhoneNumber;
 
        /**
-        * Branch office's main fax number: +ccxxxxxxxxxx
+        * Branch office's store (if multiple-store building)
         */
-       @JoinColumn (name = "branch_fax_number_id")
-       @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
-       private DialableFaxNumber branchFaxNumber;
+       @Column (name = "branch_store", length = 3)
+       private Short branchStore;
 
        /**
-        * Branch office's main email address (example: branch-name@company.com)
+        * Branch office's street name
         */
-       @Column (name = "branch_email_address", length = 100)
-       private String branchEmailAddress;
+       @Basic (optional = false)
+       @Column (name = "branch_street", length = 100, nullable = false)
+       private String branchStreet;
+
+       /**
+        * Branch office's suite number (if applyable)
+        */
+       @Column (name = "branch_suite_number", length = 4)
+       private Short branchSuiteNumber;
+
+       /**
+        * Branch office's ZIP code
+        */
+       @Basic (optional = false)
+       @Column (name = "branch_zip_code", length = 6, nullable = false)
+       private Integer branchZipCode;
 
        @Override
        public int compareTo (final BranchOffice branchOffice) {
@@ -176,6 +176,16 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
                this.branchHouseNumber = branchHouseNumber;
        }
 
+       @Override
+       public Long getBranchId () {
+               return this.branchId;
+       }
+
+       @Override
+       public void setBranchId (final Long branchId) {
+               this.branchId = branchId;
+       }
+
        @Override
        public DialableLandLineNumber getBranchPhoneNumber () {
                return this.branchPhoneNumber;
@@ -225,14 +235,4 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        public void setBranchZipCode (final Integer branchZipCode) {
                this.branchZipCode = branchZipCode;
        }
-
-       @Override
-       public Long getBranchId () {
-               return this.branchId;
-       }
-
-       @Override
-       public void setBranchId (final Long branchId) {
-               this.branchId = branchId;
-       }
 }
index c95c5c6359c1c3542650706b6e758b8d3275e402..78f68d59a6c75b102c0b45196474437b76c8f446 100644 (file)
@@ -16,7 +16,6 @@
  */
 package org.mxchange.jcontactsbusiness.employee;
 
-import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -51,26 +50,18 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
         */
        private static final long serialVersionUID = 48_959_819_859_812_076L;
 
-       /**
-        * Id number
-        */
-       @Id
-       @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       private Long employeeId;
-
        /**
         * Branch office the employee works at
         */
        @JoinColumn (name = "employee_branch_id")
-       @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL, orphanRemoval = true)
+       @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
        private BranchOffice employeeBranchOffice;
 
        /**
         * Department the employee works at
         */
-       @JoinColumn (name = "employee_department_id", nullable = false)
-       @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL, optional = false)
+       @JoinColumn (name = "employee_department_id")
+       @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL)
        private Department employeeDepartment;
 
        /**
@@ -79,6 +70,14 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        @Column (name = "employee_email_address", length = 30)
        private String employeeEmailAddress;
 
+       /**
+        * Id number
+        */
+       @Id
+       @Column (name = "employee_id", length = 20, nullable = false, updatable = false)
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       private Long employeeId;
+
        /**
         * Employee's business mobile number
         */
@@ -89,8 +88,7 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        /**
         * Employee's number
         */
-       @Basic (optional = false)
-       @Column (name = "employee_number", length = 20, nullable = false)
+       @Column (name = "employee_number", length = 20)
        private String employeeNumber;
 
        /**
@@ -109,8 +107,8 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        /**
         * Employee's position (example: CEO)
         */
-       @JoinColumn (name = "employee_position_id", nullable = false)
-       @OneToOne (targetEntity = EmployeePosition.class, optional = false, cascade = CascadeType.ALL)
+       @JoinColumn (name = "employee_position_id")
+       @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.ALL)
        private JobPosition employeePosition;
 
        @Override
index aa5479b8834ea2bc19e510b698574664e189d0ca..12776ee3f1b4c4c3666f3beeab56f3ed50bc03bf 100644 (file)
@@ -61,6 +61,13 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
        private Country headquartersCountry;
 
+       /**
+        * Headquarters' fax number
+        */
+       @JoinColumn (name = "headquarters_fax_number_id")
+       @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
+       private DialableFaxNumber headquartersFaxNumber;
+
        /**
         * Headquarters' house number
         */
@@ -76,6 +83,13 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
        private Long headquartersId;
 
+       /**
+        * Headquarters' phone number
+        */
+       @JoinColumn (name = "headquarters_phone_number_id")
+       @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
+       private DialableLandLineNumber headquartersPhoneNumber;
+
        /**
         * Headquarters' store number (multi-store building only)
         */
@@ -102,20 +116,6 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        @Column (name = "headquarters_zip_code", length = 6, nullable = false)
        private Integer headquartersZipCode;
 
-       /**
-        * Headquarters' phone number
-        */
-       @JoinColumn (name = "headquarters_phone_number_id")
-       @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
-       private DialableLandLineNumber headquartersPhoneNumber;
-
-       /**
-        * Headquarters' fax number
-        */
-       @JoinColumn (name = "headquarters_fax_number_id")
-       @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL)
-       private DialableFaxNumber headquartersFaxNumber;
-
        @Override
        public int compareTo (final HeadQuartersData headQuartersData) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
@@ -141,6 +141,16 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
                this.headquartersCountry = headquartersCountry;
        }
 
+       @Override
+       public DialableFaxNumber getHeadquartersFaxNumber () {
+               return this.headquartersFaxNumber;
+       }
+
+       @Override
+       public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
+               this.headquartersFaxNumber = headquartersFaxNumber;
+       }
+
        @Override
        public Short getHeadquartersHouseNumber () {
                return this.headquartersHouseNumber;
@@ -161,6 +171,16 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
                this.headquartersId = headquartersId;
        }
 
+       @Override
+       public DialableLandLineNumber getHeadquartersPhoneNumber () {
+               return this.headquartersPhoneNumber;
+       }
+
+       @Override
+       public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
+               this.headquartersPhoneNumber = headquartersPhoneNumber;
+       }
+
        @Override
        public Short getHeadquartersStore () {
                return this.headquartersStore;
@@ -200,24 +220,4 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        public void setHeadquartersZipCode (final Integer headquartersZipCode) {
                this.headquartersZipCode = headquartersZipCode;
        }
-
-       @Override
-       public DialableLandLineNumber getHeadquartersPhoneNumber () {
-               return this.headquartersPhoneNumber;
-       }
-
-       @Override
-       public void setHeadquartersPhoneNumber (final DialableLandLineNumber headquartersPhoneNumber) {
-               this.headquartersPhoneNumber = headquartersPhoneNumber;
-       }
-
-       @Override
-       public DialableFaxNumber getHeadquartersFaxNumber () {
-               return this.headquartersFaxNumber;
-       }
-
-       @Override
-       public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber) {
-               this.headquartersFaxNumber = headquartersFaxNumber;
-       }
 }
index 3304ff7266dbc3e2f248ca7a762ae9ab34951315..062259e0ffc0001c9a0a18f15c9dfc697e5f915b 100644 (file)
@@ -25,6 +25,20 @@ import java.io.Serializable;
  */
 public interface BusinessLogo extends Serializable {
 
+       /**
+        * Getter for logo's local file name
+        * <p>
+        * @return Logo's local file name
+        */
+       public String getLogoFileName ();
+
+       /**
+        * Setter for logo's local file name
+        * <p>
+        * @param logoFileName Logo's local file name
+        */
+       public void setLogoFileName (final String logoFileName);
+
        /**
         * Getter for logo's id number
         * <p>
index 4ce7ceb89bbb8e8e7896b020f2a990b96b569d82..59b3b860d33007db585681b4d0bd443818491054 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.logo;
 
+import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -37,6 +38,13 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
         */
        private static final long serialVersionUID = 475_871_875_718_751_285L;
 
+       /**
+        * Local file name of the logo (relative to /resources/logos/)
+        */
+       @Basic (optional = false)
+       @Column (name = "logo_file_name", nullable = false, unique = true, updatable = false)
+       private String logoFileName;
+
        /**
         * Id number
         */
@@ -50,6 +58,16 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public String getLogoFileName () {
+               return this.logoFileName;
+       }
+
+       @Override
+       public void setLogoFileName (final String logoFileName) {
+               this.logoFileName = logoFileName;
+       }
+
        @Override
        public Long getLogoId () {
                return this.logoId;
@@ -59,5 +77,4 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
        public void setLogoId (final Long logoId) {
                this.logoId = logoId;
        }
-
 }