]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
The country code is now handled by jcountry-core
authorRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 20:28:19 +0000 (22:28 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 20:28:19 +0000 (22:28 +0200)
src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java
src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java
src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java
src/org/mxchange/jcontactsbusiness/headquarters/HeadQuartersData.java

index d53166916a60a6511d114e73d4bd18d5962b608d..b7cde6e042ff7be8cef75d994ba43fa1ce0aea3e 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jcontactsbusiness.branch;
 
 import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
 
 /**
  * A POJI for branch offices
@@ -170,12 +171,12 @@ public interface BranchOffice extends Serializable {
         * <p>
         * @return Branch office's country code
         */
-       public String getBranchCountryCode ();
+       public Country getBranchCountry ();
 
        /**
         * Setter for branch office's country code
         * <p>
         * @param branchCountryCode Branch office's country code
         */
-       public void setBranchCountryCode (final String branchCountryCode);
+       public void setBranchCountry (final Country branchCountryCode);
 }
index 09628bdd9dd066a3eb993c6e4f5642832bd3d40c..3dc45842d307fa15e70e0ba593953e41540550ad 100644 (file)
 package org.mxchange.jcontactsbusiness.branch;
 
 import javax.persistence.Basic;
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
 
 /**
  * A POJO for company branch offices
@@ -89,9 +94,9 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        /**
         * Branch office's country code
         */
-       @Basic (optional = false)
-       @Column (name = "branch_country_code", length = 100, nullable = false)
-       private String branchCountryCode;
+       @JoinColumn (name = "branch_country_code", nullable = false)
+       @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+       private Country branchCountry;
 
        /**
         * Branch office's main phone number: +ccxxxxxxxxxx
@@ -127,13 +132,13 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        }
 
        @Override
-       public String getBranchCountryCode () {
-               return this.branchCountryCode;
+       public Country getBranchCountry () {
+               return this.branchCountry;
        }
 
        @Override
-       public void setBranchCountryCode (final String branchCountryCode) {
-               this.branchCountryCode = branchCountryCode;
+       public void setBranchCountry (final Country branchCountry) {
+               this.branchCountry = branchCountry;
        }
 
        @Override
index 46ca20e6f28929a4c96e5447e0a3c255dfc5873a..496251148275b6b558563277c291435b2dcea5d5 100644 (file)
 package org.mxchange.jcontactsbusiness.headquarters;
 
 import javax.persistence.Basic;
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
 
 /**
  * A POJO for company headquarts data
  * <p>
  * @author Roland Haeder
  */
-@Entity (name = "headquarters")
-@Table (name = "headquarters")
+@Entity (name = "company_headquarters")
+@Table (name = "company_headquarters")
 public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<HeadQuartersData> {
 
        /**
@@ -48,9 +53,9 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        /**
         * Headquarter's country code
         */
-       @Basic (optional = false)
-       @Column (name = "headquarters_country_code", length = 2, nullable = false)
-       private String headquartersCountryCode;
+       @JoinColumn (name = "headquarters_country_code", nullable = false)
+       @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+       private Country headquartersCountry;
 
        /**
         * Headquarters' house number
@@ -63,8 +68,8 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
         * Id number
         */
        @Id
-       @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
        @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "headquarters_id", length = 20, nullable = false, updatable = false)
        private Long headquartersId;
 
        /**
@@ -109,13 +114,13 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        }
 
        @Override
-       public String getHeadquartersCountryCode () {
-               return this.headquartersCountryCode;
+       public Country getHeadquartersCountry () {
+               return this.headquartersCountry;
        }
 
        @Override
-       public void setHeadquartersCountryCode (final String headquartersCountryCode) {
-               this.headquartersCountryCode = headquartersCountryCode;
+       public void setHeadquartersCountry (final Country headquartersCountry) {
+               this.headquartersCountry = headquartersCountry;
        }
 
        @Override
index ae6690f30e9e4b5830fc337b71f8d6c88742f040..0073062be1920e4a3cd2dbd8384a9415cc000fd1 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jcontactsbusiness.headquarters;
 
 import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
 
 /**
  * A POJI for headquarters data
@@ -44,14 +45,14 @@ public interface HeadQuartersData extends Serializable {
         * <p>
         * @return Headquarters' country code
         */
-       public String getHeadquartersCountryCode ();
+       public Country getHeadquartersCountry ();
 
        /**
         * Setter for headquarters' country code
         * <p>
         * @param headquartersCountryCode Headquarters' country code
         */
-       public void setHeadquartersCountryCode (final String headquartersCountryCode);
+       public void setHeadquartersCountry (final Country headquartersCountryCode);
 
        /**
         * Getter for headquarters' house number