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;
/**
* 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) {
}
@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;
}
}
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;
/**
* <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);
}
--- /dev/null
+/*
+ * 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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);
+}