From 6479f7aeb5296d8e751e59bfb84e67475d1ed89f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 11 Oct 2015 17:39:19 +0200 Subject: [PATCH] Continued: - sorted members - added logo's local file name - made some data nullable as it might not be available --- .../basicdata/CompanyBasicData.java | 53 +++++---- .../branch/CompanyBranchOffice.java | 104 +++++++++--------- .../employee/CompanyEmployee.java | 30 +++-- .../headquarters/CompanyHeadQuartersData.java | 68 ++++++------ .../jcontactsbusiness/logo/BusinessLogo.java | 14 +++ .../jcontactsbusiness/logo/CompanyLogo.java | 19 +++- 6 files changed, 158 insertions(+), 130 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java index 67676ea..3aab32f 100644 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -59,11 +59,24 @@ public class CompanyBasicData implements BusinessBasicData, Comparable companyFaxNumberList; /** * Legal status of company (example: "Inc.", "GmbH") @@ -80,17 +93,11 @@ public class CompanyBasicData implements BusinessBasicData, Comparable companyPhoneNumber; /** - * Company's main fax numbers: +ccxxxxxxxxxx - */ - @JoinColumn (name = "company_fax_number_id") - @OneToMany (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) - private List 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) { diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index 223fe5d..1210be1 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -47,59 +47,46 @@ public class CompanyBranchOffice implements BranchOffice, Comparable { */ 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 { @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'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'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 diff --git a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java index aa5479b..12776ee 100644 --- a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java +++ b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java @@ -61,6 +61,13 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable + * @return Logo's local file name + */ + public String getLogoFileName (); + + /** + * Setter for logo's local file name + *

+ * @param logoFileName Logo's local file name + */ + public void setLogoFileName (final String logoFileName); + /** * Getter for logo's id number *

diff --git a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java index 4ce7ceb..59b3b86 100644 --- a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java +++ b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java @@ -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 { */ 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 { 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 { public void setLogoId (final Long logoId) { this.logoId = logoId; } - } -- 2.39.5