import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarters;
import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition;
-import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
import org.mxchange.jcontactsbusiness.model.jobposition.JobPositions;
import org.mxchange.jcoreutils.Comparables;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
*/
@JoinColumn (name = "employee_position_id")
@OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH)
- private JobPosition employeeJobPosition;
+ private HireableJobPosition employeeJobPosition;
/**
* Employee's business mobile number
// Init comparisons
final int[] comparators = {
+ // First employee's number
+ // First employee's number
+ // First employee's number
// First employee's number
StringUtils.compareIgnoreCase(this.getEmployeeNumber(), employable.getEmployeeNumber()),
// ... finally contact data
StringUtils.compareIgnoreCase(this.getEmployeeEmailAddress(), employable.getEmployeeEmailAddress()),
// ... company data (BasicData)
this.getEmployeeBasicData().compareTo(employable.getEmployeeBasicData()),
- // ... job position
JobPositions.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()),
// ... department
Departments.compare(this.getEmployeeDepartment(), employable.getEmployeeDepartment()),
}
@Override
- public JobPosition getEmployeeJobPosition () {
+ public HireableJobPosition getEmployeeJobPosition () {
return this.employeeJobPosition;
}
@Override
- public void setEmployeeJobPosition (final JobPosition employeeJobPosition) {
+ public void setEmployeeJobPosition (final HireableJobPosition employeeJobPosition) {
this.employeeJobPosition = employeeJobPosition;
}
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
import org.mxchange.jcontactsbusiness.model.department.Department;
import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
+import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
import org.mxchange.jusercore.model.user.User;
* <p>
* @return Employable's position
*/
- JobPosition getEmployeeJobPosition ();
+ HireableJobPosition getEmployeeJobPosition ();
/**
* Setter for employee's position
* <p>
* @param employeePosition Employable's position
*/
- void setEmployeeJobPosition (final JobPosition employeePosition);
+ void setEmployeeJobPosition (final HireableJobPosition employeePosition);
/**
* Getter for user owner instance
import java.util.Date;
import java.util.Objects;
import javax.persistence.Basic;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
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 javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.model.jobposition.status.JobPositionStatus;
import org.mxchange.jcoreutils.Comparables;
+import org.mxchange.jusercore.model.user.LoginUser;
+import org.mxchange.jusercore.model.user.User;
/**
* A POJO for job positions
name = "company_job_positions"
)
@SuppressWarnings ("PersistenceUnitPresent")
-public class EmployeePosition implements JobPosition {
+public class EmployeePosition implements HireableJobPosition {
/**
* Serial number
@Transient
private static final long serialVersionUID = 18_427_587_187_609L;
+ /**
+ * User who has added this job position
+ */
+ @JoinColumn (name = "job_position_added_user_id", referencedColumnName = "user_id", updatable = false)
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+ private User jobPositionAddedUser;
+
/**
* Timestamp when this entry has been created
*/
@Column (name = "job_position_created", nullable = false, updatable = false)
private Date jobPositionCreated;
+ /**
+ * When this job position (offer) was deleted
+ */
+ @Column (name = "job_position_deleted")
+ @Temporal (TemporalType.TIMESTAMP)
+ private Date jobPositionDeleted;
+
+ /**
+ * When this job position (offer) has expired
+ */
+ @Column (name = "job_position_expired")
+ @Temporal (TemporalType.TIMESTAMP)
+ private Date jobPositionExpired;
+
+ /**
+ * When a new employed was hired for this job position
+ */
+ @Column (name = "job_position_hired")
+ @Temporal (TemporalType.TIMESTAMP)
+ private Date jobPositionHired;
+
/**
* Id number
*/
@Column (name = "job_position_name", nullable = false, unique = true)
private String jobPositionName;
+ /**
+ * When this job position (offer) starts
+ */
+ @Basic (optional = false)
+ @Column (name = "job_position_start", nullable = false)
+ @Temporal (TemporalType.DATE)
+ private Date jobPositionStart;
+
+ /**
+ * Job position status
+ */
+ @Basic (optional = false)
+ @Column (name = "job_position_status", nullable = false)
+ @Enumerated (EnumType.STRING)
+ private JobPositionStatus jobPositionStatus;
+
/**
* Timestamp when this entry has been created
*/
private Date jobPositionUpdated;
@Override
- public int compareTo (final JobPosition jobPosition) {
+ public int compareTo (final HireableJobPosition jobPosition) {
// Check parameter on null-reference and equality to this
if (null == jobPosition) {
// Should not happen
// Init comparisons
final int[] comparators = {
- // First position name ...
+ // First added by which user ...
+ this.getJobPositionAddedUser().compareTo(jobPosition.getJobPositionAddedUser()),
+ // ... next name
this.getJobPositionName().compareToIgnoreCase(jobPosition.getJobPositionName())
};
return false;
}
- final JobPosition other = (JobPosition) object;
+ final HireableJobPosition other = (HireableJobPosition) object;
if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) {
return false;
} else if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
return false;
+ } else if (!Objects.equals(this.getJobPositionAddedUser(), other.getJobPositionAddedUser())) {
+ return false;
}
return true;
}
+ @Override
+ public User getJobPositionAddedUser () {
+ return this.jobPositionAddedUser;
+ }
+
+ @Override
+ public void setJobPositionAddedUser (final User jobPositionAddedUser) {
+ this.jobPositionAddedUser = jobPositionAddedUser;
+ }
+
@Override
@SuppressWarnings ("ReturnOfDateField")
public Date getJobPositionCreated () {
this.jobPositionUpdated = jobPositionUpdated;
}
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getJobPositionDeleted () {
+ return this.jobPositionDeleted;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setJobPositionDeleted (final Date jobPositionDeleted) {
+ this.jobPositionDeleted = jobPositionDeleted;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getJobPositionExpired () {
+ return this.jobPositionExpired;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setJobPositionExpired (final Date jobPositionExpired) {
+ this.jobPositionExpired = jobPositionExpired;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getJobPositionHired () {
+ return this.jobPositionHired;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setJobPositionHired (final Date jobPositionHired) {
+ this.jobPositionHired = jobPositionHired;
+ }
+
+ @Override
+ @SuppressWarnings ("ReturnOfDateField")
+ public Date getJobPositionStart () {
+ return this.jobPositionStart;
+ }
+
+ @Override
+ @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+ public void setJobPositionStart (final Date jobPositionStart) {
+ this.jobPositionStart = jobPositionStart;
+ }
+
+ @Override
+ public JobPositionStatus getJobPositionStatus () {
+ return this.jobPositionStatus;
+ }
+
+ @Override
+ public void setJobPositionStatus (final JobPositionStatus jobPositionStatus) {
+ this.jobPositionStatus = jobPositionStatus;
+ }
+
@Override
public int hashCode () {
int hash = 7;
hash = 37 * hash + Objects.hashCode(this.getJobPositionId());
hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
+ hash = 37 * hash + Objects.hashCode(this.getJobPositionAddedUser());
return hash;
}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * 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.model.jobposition;
+
+import java.io.Serializable;
+import java.util.Date;
+import org.mxchange.jcontactsbusiness.model.jobposition.status.JobPositionStatus;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A POJI for job positions
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface HireableJobPosition extends Comparable<HireableJobPosition>, Serializable {
+
+ /**
+ * Getter for id number
+ * <p>
+ * @return Id number
+ */
+ Long getJobPositionId ();
+
+ /**
+ * Setter for id number
+ * <p>
+ * @param jobPositionId Id number
+ */
+ void setJobPositionId (final Long jobPositionId);
+
+ /**
+ * Getter for job position name
+ * <p>
+ * @return Job position name
+ */
+ String getJobPositionName ();
+
+ /**
+ * Setter for job position name
+ * <p>
+ * @param jobPositionName Job position name
+ */
+ void setJobPositionName (final String jobPositionName);
+
+ /**
+ * Getter for timestamp when this entry has been created
+ * <p>
+ * @return Timestamp when this entry has been created
+ */
+ Date getJobPositionCreated ();
+
+ /**
+ * Setter for timestamp when this entry has been created
+ * <p>
+ * @param jobPositionCreated Timestamp when this entry has been created
+ */
+ void setJobPositionCreated (final Date jobPositionCreated);
+
+ /**
+ * Getter for timestamp when this entry has been updated
+ * <p>
+ * @return Timestamp when this entry has been updated
+ */
+ Date getJobPositionUpdated ();
+
+ /**
+ * Setter for timestamp when this entry has been updated
+ * <p>
+ * @param jobPositionUpdated Timestamp when this entry has been updated
+ */
+ void setJobPositionUpdated (final Date jobPositionUpdated);
+
+ /**
+ * Getter for job position start
+ * <p>
+ * @return Job position start
+ */
+ Date getJobPositionStart ();
+
+ /**
+ * Setter for job position start
+ * <p>
+ * @param jobPositionStart Job position start
+ */
+ void setJobPositionStart (final Date jobPositionStart);
+
+ /**
+ * Getter for job position status
+ * <p>
+ * @return Job position status
+ */
+ JobPositionStatus getJobPositionStatus ();
+
+ /**
+ * Setter for job position status
+ * <p>
+ * @param jobPositionStatus Job position status
+ */
+ void setJobPositionStatus (final JobPositionStatus jobPositionStatus);
+
+ /**
+ * Getter for when this job position was deleted by user
+ * <p>
+ * @return When this job position was deleted by user
+ */
+ Date getJobPositionDeleted ();
+
+ /**
+ * Setter for when this job position was deleted by user
+ * <p>
+ * @param jobPositionDeleted When this job position was deleted by user
+ */
+ void setJobPositionDeleted (final Date jobPositionDeleted);
+
+ /**
+ * Getter for when this job position has expired
+ * <p>
+ * @return When this job position has expired
+ */
+ Date getJobPositionExpired ();
+
+ /**
+ * Setter for when this job position has expired
+ * <p>
+ * @param jobPositionExpired When this job position has expired
+ */
+ void setJobPositionExpired (final Date jobPositionExpired);
+
+ /**
+ * Getter for when employee was hired for this job position
+ * <p>
+ * @return When employee was hired for this job position
+ */
+ Date getJobPositionHired ();
+
+ /**
+ * Setter for when employee was hired for this job position
+ * <p>
+ * @param jobPositionHired When employee was hired for this job position
+ */
+ void setJobPositionHired (final Date jobPositionHired);
+
+ /**
+ * Getter for user who added this job position
+ * <p>
+ * @return User who added this job position
+ */
+ User getJobPositionAddedUser ();
+
+ /**
+ * Setter for user who added this job position
+ * <p>
+ * @param jobPositionAddedUser User who added this job position
+ */
+ void setJobPositionAddedUser (final User jobPositionAddedUser);
+
+ @Override
+ boolean equals (final Object object);
+
+ @Override
+ int hashCode ();
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2018 Free Software Foundation
- *
- * 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.model.jobposition;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * A POJI for job positions
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface JobPosition extends Comparable<JobPosition>, Serializable {
-
- /**
- * Getter for id number
- * <p>
- * @return Id number
- */
- Long getJobPositionId ();
-
- /**
- * Setter for id number
- * <p>
- * @param jobPositionId Id number
- */
- void setJobPositionId (final Long jobPositionId);
-
- /**
- * Getter for job position name
- * <p>
- * @return Job position name
- */
- String getJobPositionName ();
-
- /**
- * Setter for job position name
- * <p>
- * @param jobPositionName Job position name
- */
- void setJobPositionName (final String jobPositionName);
-
- /**
- * Getter for timestamp when this entry has been created
- * <p>
- * @return Timestamp when this entry has been created
- */
- Date getJobPositionCreated ();
-
- /**
- * Setter for timestamp when this entry has been created
- * <p>
- * @param jobPositionCreated Timestamp when this entry has been created
- */
- void setJobPositionCreated (final Date jobPositionCreated);
-
- /**
- * Getter for timestamp when this entry has been updated
- * <p>
- * @return Timestamp when this entry has been updated
- */
- Date getJobPositionUpdated ();
-
- /**
- * Setter for timestamp when this entry has been updated
- * <p>
- * @param jobPositionUpdated Timestamp when this entry has been updated
- */
- void setJobPositionUpdated (final Date jobPositionUpdated);
-
- @Override
- boolean equals (final Object object);
-
- @Override
- int hashCode ();
-
-}
* <p>
* @return Comparison value
*/
- public static int compare (final JobPosition jobPosition1, final JobPosition jobPosition2) {
+ public static int compare (final HireableJobPosition jobPosition1, final HireableJobPosition jobPosition2) {
// Check euqality, then at least first must be given
if (Objects.equals(jobPosition1, jobPosition2)) {
// Both are same
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2019 Free Software Foundation
+ *
+ * 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.model.jobposition.status;
+
+/**
+ * An enumeration for job position status
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public enum JobPositionStatus {
+
+ /**
+ * Open job position status (open for applications)
+ */
+ OPEN("JOB_POSITION_STATUS_OPEN", "job_position_status_open"), //NOI18N
+
+ /**
+ * Hired job position status (new employee)
+ */
+ HIRED("JOB_POSITION_STATUS_HIRED", "job_position_status_hired"), //NOI18N
+
+ /**
+ * Deleted job position status (by user)
+ */
+ DELETED("JOB_POSITION_STATUS_DELETED", "job_position_status_deleted"), //NOI18N
+
+ /**
+ * Expired job position status (when no one applied for it)
+ */
+ EXPIRED("JOB_POSITION_STATUS_DELETED", "job_position_status_expired"), //NOI18N
+
+ /**
+ * Locked job position status (by administrator)
+ */
+ LOCKED("JOB_POSITION_STATUS_LOCKED", "job_position_status_locked"); //NOI18N
+
+ /**
+ * Message key for bundles
+ */
+ private final String messageKey;
+
+ /**
+ * CSS class
+ */
+ private final String styleClass;
+
+ /**
+ * Constructor with message key and CSS class
+ * <p>
+ * @param messageKey Message key
+ * @param styleClass CSS class
+ */
+ private JobPositionStatus (final String messageKey, final String styleClass) {
+ // Set all
+ this.messageKey = messageKey;
+ this.styleClass = styleClass;
+ }
+
+ /**
+ * Getter for i18n bundle message key
+ * <p>
+ * @return Message key for i18n bundles
+ */
+ public String getMessageKey () {
+ return this.messageKey;
+ }
+
+ /**
+ * Getter for CSS class
+ * <p>
+ * @return CSS class
+ */
+ public String getStyleClass () {
+ return this.styleClass;
+ }
+
+}