]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 12 Oct 2017 19:58:59 +0000 (21:58 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 12 Oct 2017 19:58:59 +0000 (21:58 +0200)
- departmentName was not localizable, let's rename it to departmentI18nKey then

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/exceptions/department/DepartmentAlreadyAddedException.java
src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartment.java
src/org/mxchange/jcontactsbusiness/model/department/Department.java
src/org/mxchange/jcontactsbusiness/model/department/Departments.java

index fcd231b0e28ee3da55520877c4fa1a6f9af02206..0f679b98cad742cfa4d4bef8d8cfb1d435088992 100644 (file)
@@ -37,7 +37,7 @@ public class DepartmentAlreadyAddedException extends Exception {
         * @param department Company department that is already found
         */
        public DepartmentAlreadyAddedException (final Department department) {
-               super(MessageFormat.format("Company department with name {0} already created.", department.getDepartmentName()));
+               super(MessageFormat.format("Company department with i18n key {0} already created.", department.getDepartmentI18nKey()));
        }
 
        /**
index 90a7f85b61917d4ab56ba29878aab95a1ec575a5..be6fd1d69d7dd23a29755e2604b24a8ea5dafda0 100644 (file)
@@ -95,6 +95,13 @@ public class CompanyDepartment implements Department {
        @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
        private HeadquartersData departmentHeadquarters;
 
+       /**
+        * Department i18n key
+        */
+       @Basic (optional = false)
+       @Column (name = "department_i18n_key", length = 100, nullable = false)
+       private String departmentI18nKey;
+
        /**
         * Id number
         */
@@ -110,13 +117,6 @@ public class CompanyDepartment implements Department {
        @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
        private Employee departmentLead;
 
-       /**
-        * Department name
-        */
-       @Basic (optional = false)
-       @Column (name = "department_name", length = 100, nullable = false)
-       private String departmentName;
-
        /**
         * User owner instance
         */
@@ -154,7 +154,7 @@ public class CompanyDepartment implements Department {
 
                // Set all fields
                this.departmentCompany = departmentCompany;
-               this.departmentName = departmentName;
+               this.departmentI18nKey = departmentName;
        }
 
        @Override
@@ -171,7 +171,7 @@ public class CompanyDepartment implements Department {
                        return false;
                } else if (!Objects.equals(this.getDepartmentCompany(), other.getDepartmentCompany())) {
                        return false;
-               } else if (!Objects.equals(this.getDepartmentName(), other.getDepartmentName())) {
+               } else if (!Objects.equals(this.getDepartmentI18nKey(), other.getDepartmentI18nKey())) {
                        return false;
                }
 
@@ -220,6 +220,16 @@ public class CompanyDepartment implements Department {
                this.departmentHeadquarters = departmentHeadquarters;
        }
 
+       @Override
+       public String getDepartmentI18nKey () {
+               return this.departmentI18nKey;
+       }
+
+       @Override
+       public void setDepartmentI18nKey (final String departmentI18nKey) {
+               this.departmentI18nKey = departmentI18nKey;
+       }
+
        @Override
        public Long getDepartmentId () {
                return this.departmentId;
@@ -240,16 +250,6 @@ public class CompanyDepartment implements Department {
                this.departmentLead = departmentLead;
        }
 
-       @Override
-       public String getDepartmentName () {
-               return this.departmentName;
-       }
-
-       @Override
-       public void setDepartmentName (final String departmentName) {
-               this.departmentName = departmentName;
-       }
-
        @Override
        public User getDepartmentUserOwner () {
                return this.departmentUserOwner;
@@ -266,7 +266,7 @@ public class CompanyDepartment implements Department {
 
                hash = 53 * hash + Objects.hashCode(this.getDepartmentId());
                hash = 53 * hash + Objects.hashCode(this.getDepartmentCompany());
-               hash = 53 * hash + Objects.hashCode(this.getDepartmentName());
+               hash = 53 * hash + Objects.hashCode(this.getDepartmentI18nKey());
 
                return hash;
        }
index 860d2e2ea6d02dd5f4262cdd2687fc266035bff5..9583a731ef1e3854d46cbc1e1267e5dc3e4db41a 100644 (file)
@@ -102,18 +102,18 @@ public interface Department extends Serializable {
        void setDepartmentLead (final Employee departmentLead);
 
        /**
-        * Getter for department name
+        * Getter for department i18n key
         * <p>
-        * @return Department name
+        * @return Department i18n key
         */
-       String getDepartmentName ();
+       String getDepartmentI18nKey ();
 
        /**
-        * Setter for department name
+        * Setter for department i18n key
         * <p>
-        * @param departmentName Department name
+        * @param departmentI18nKey Department i18n key
         */
-       void setDepartmentName (final String departmentName);
+       void setDepartmentI18nKey (final String departmentI18nKey);
 
        /**
         * Getter for user owner instance
index 033c7369b8c30646326d6878dd6bab20a5c6c4f1..1ca7605139deb506472b1cea58f744b20d4aac77 100644 (file)
@@ -54,26 +54,26 @@ public class Departments implements Serializable {
                } else if (department1.getDepartmentCompany() == null) {
                        // Throw NPE again
                        throw new NullPointerException("department1.departmentCompany is null"); //NOI18N
-               } else if (department1.getDepartmentName() == null) {
+               } else if (department1.getDepartmentI18nKey() == null) {
                        // Throw it again
                        throw new NullPointerException("department1.departmentName is null"); //NOI18N
-               } else if (department1.getDepartmentName().isEmpty()) {
+               } else if (department1.getDepartmentI18nKey().isEmpty()) {
                        // Throw IAE
                        throw new IllegalArgumentException("department1.departmentName is empty"); //NOI18N
                } else if (department2.getDepartmentCompany() == null) {
                        // Throw NPE again
                        throw new NullPointerException("department2.departmentCompany is null"); //NOI18N
-               } else if (department2.getDepartmentName() == null) {
+               } else if (department2.getDepartmentI18nKey() == null) {
                        // Throw it again
                        throw new NullPointerException("department2.departmentName is null"); //NOI18N
-               } else if (department2.getDepartmentName().isEmpty()) {
+               } else if (department2.getDepartmentI18nKey().isEmpty()) {
                        // Throw IAE
                        throw new IllegalArgumentException("department2.departmentName is empty"); //NOI18N
                }
 
                // Same company and same name?
                boolean isSame = ((Objects.equals(department1.getDepartmentCompany(), department2.getDepartmentCompany())) &&
-                                                 (Objects.equals(department1.getDepartmentName(), department2.getDepartmentName())));
+                                                 (Objects.equals(department1.getDepartmentI18nKey(), department2.getDepartmentI18nKey())));
 
                // Return it
                return isSame;