]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
added job position entity
authorRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 12:11:06 +0000 (14:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 12:11:06 +0000 (14:11 +0200)
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/employee/Employee.java
src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java [new file with mode: 0644]

index 31df0b148b209fc4082c86355d93c6dbe0d2c44b..c95c5c6359c1c3542650706b6e758b8d3275e402 100644 (file)
@@ -32,6 +32,8 @@ import org.mxchange.jcontactsbusiness.branch.BranchOffice;
 import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice;
 import org.mxchange.jcontactsbusiness.department.CompanyDepartment;
 import org.mxchange.jcontactsbusiness.department.Department;
+import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition;
+import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 
@@ -107,9 +109,9 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        /**
         * Employee's position (example: CEO)
         */
-       @Basic (optional = false)
-       @Column (name = "employee_status", length = 50, nullable = false)
-       private String employeePosition;
+       @JoinColumn (name = "employee_position_id", nullable = false)
+       @OneToOne (targetEntity = EmployeePosition.class, optional = false, cascade = CascadeType.ALL)
+       private JobPosition employeePosition;
 
        @Override
        public int compareTo (final Employee employee) {
@@ -197,12 +199,12 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        }
 
        @Override
-       public String getEmployeePosition () {
+       public JobPosition getEmployeePosition () {
                return this.employeePosition;
        }
 
        @Override
-       public void setEmployeePosition (final String employeePosition) {
+       public void setEmployeePosition (final JobPosition employeePosition) {
                this.employeePosition = employeePosition;
        }
 }
index 1c14cba2c0ecd2650085c248920c751050ad9276..ea64f1e44ca0aee995e903f0edb50faf2cb4b681 100644 (file)
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
 import org.mxchange.jcontactsbusiness.department.Department;
+import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 
 /**
@@ -146,12 +147,12 @@ public interface Employee extends Serializable {
         * <p>
         * @return Employee's position
         */
-       public String getEmployeePosition ();
+       public JobPosition getEmployeePosition ();
 
        /**
         * Setter for employee's position
         * <p>
         * @param employeePosition Employee's position
         */
-       public void setEmployeePosition (final String employeePosition);
+       public void setEmployeePosition (final JobPosition employeePosition);
 }
diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
new file mode 100644 (file)
index 0000000..68f2876
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.jobposition;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * A POJO for job positions
+ * <p>
+ * @author Roland Haeder
+ */
+@Entity (name = "job_positions")
+@Table (name = "job_positions")
+public class EmployeePosition implements JobPosition, Comparable<JobPosition> {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 18_427_587_187_609L;
+
+       /**
+        * Id number
+        */
+       @Id
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       @Column (name = "job_position_id", length = 20, nullable = false, updatable = false)
+       private Long jobPositionId;
+
+       /**
+        * Name/description of the job position (example: CEO)
+        */
+       @Basic (optional = false)
+       @Column (name = "job_position_name", length = 10, nullable = false, unique = true)
+       private String jobPositionName;
+
+       @Override
+       public int compareTo (final JobPosition jobPosition) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public Long getJobPositionId () {
+               return this.jobPositionId;
+       }
+
+       @Override
+       public void setJobPositionId (final Long jobPositionId) {
+               this.jobPositionId = jobPositionId;
+       }
+
+       @Override
+       public String getJobPositionName () {
+               return this.jobPositionName;
+       }
+
+       @Override
+       public void setJobPositionName (final String jobPositionName) {
+               this.jobPositionName = jobPositionName;
+       }
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java b/src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java
new file mode 100644 (file)
index 0000000..e9dc8f9
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.jobposition;
+
+import java.io.Serializable;
+
+/**
+ * A POJI for job positions
+ * <p>
+ * @author Roland Haeder
+ */
+public interface JobPosition extends Serializable {
+
+       /**
+        * Getter for id number
+        * <p>
+        * @return Id number
+        */
+       public Long getJobPositionId ();
+
+       /**
+        * Setter for id number
+        * <p>
+        * @param jobPositionId Id number
+        */
+       public void setJobPositionId (final Long jobPositionId);
+
+       /**
+        * Getter for job position name
+        * <p>
+        * @return Job position name
+        */
+       public String getJobPositionName ();
+
+       /**
+        * Setter for job position name
+        * <p>
+        * @param jobPositionName Job position name
+        */
+       public void setJobPositionName (final String jobPositionName);
+}