]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 10 Oct 2019 20:46:53 +0000 (22:46 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 10 Oct 2019 20:46:53 +0000 (22:46 +0200)
- renamed JobPosition to HireableJobPosition (tpzo in first syllable) and added
  methods from jjobs-core as this was redundant anyway (and didn't work in the
  end)
- added JobPositionStatus (enum) from jjobs-core

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java
src/org/mxchange/jcontactsbusiness/model/employee/Employable.java
src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java
src/org/mxchange/jcontactsbusiness/model/jobposition/HireableJobPosition.java [new file with mode: 0644]
src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.java [deleted file]
src/org/mxchange/jcontactsbusiness/model/jobposition/JobPositions.java
src/org/mxchange/jcontactsbusiness/model/jobposition/status/JobPositionStatus.java [new file with mode: 0644]

index aaed9867f1ffa9a98f4c5b6e03d894c882eb83c1..f4c695aef1b3783a31d93d041565fed804c24e54 100644 (file)
@@ -49,7 +49,7 @@ import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
 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;
@@ -132,7 +132,7 @@ public class BusinessEmployee implements Employable {
         */
        @JoinColumn (name = "employee_position_id")
        @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH)
-       private JobPosition employeeJobPosition;
+       private HireableJobPosition employeeJobPosition;
 
        /**
         * Employee's business mobile number
@@ -213,6 +213,9 @@ public class BusinessEmployee implements Employable {
 
                // 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
@@ -221,7 +224,6 @@ public class BusinessEmployee implements Employable {
                        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()),
@@ -334,12 +336,12 @@ public class BusinessEmployee implements Employable {
        }
 
        @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;
        }
 
index 1eec65b9cff750648b1f6b17a27353918b184c17..7d9e16dc49ed1120f72304cae47822a4b4387865 100644 (file)
@@ -23,7 +23,7 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 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;
 
@@ -179,14 +179,14 @@ public interface Employable extends Comparable<Employable>, Serializable {
         * <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
index 7c6e933d396f7282ff674541770c0f16dad952b5..be455e3e5dbfe72b165e8b5b91afbbfa55c9a9a0 100644 (file)
@@ -19,16 +19,24 @@ package org.mxchange.jcontactsbusiness.model.jobposition;
 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
@@ -40,7 +48,7 @@ import org.mxchange.jcoreutils.Comparables;
                name = "company_job_positions"
 )
 @SuppressWarnings ("PersistenceUnitPresent")
-public class EmployeePosition implements JobPosition {
+public class EmployeePosition implements HireableJobPosition {
 
        /**
         * Serial number
@@ -48,6 +56,13 @@ public class EmployeePosition implements JobPosition {
        @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
         */
@@ -56,6 +71,27 @@ public class EmployeePosition implements JobPosition {
        @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
         */
@@ -71,6 +107,22 @@ public class EmployeePosition implements JobPosition {
        @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
         */
@@ -79,7 +131,7 @@ public class EmployeePosition implements JobPosition {
        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
@@ -91,7 +143,9 @@ public class EmployeePosition implements JobPosition {
 
                // 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())
                };
 
@@ -112,17 +166,29 @@ public class EmployeePosition implements JobPosition {
                        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 () {
@@ -167,12 +233,71 @@ public class EmployeePosition implements JobPosition {
                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;
        }
diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/HireableJobPosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/HireableJobPosition.java
new file mode 100644 (file)
index 0000000..f62913f
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * 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 ();
+
+}
diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/JobPosition.java
deleted file mode 100644 (file)
index 01e2335..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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 ();
-
-}
index a23be98391b6249af9e1216866a7c8b83135e9fa..c3d88648df62d46003e9c117d10cf0324569fb60 100644 (file)
@@ -40,7 +40,7 @@ public class JobPositions implements Serializable {
         * <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
diff --git a/src/org/mxchange/jcontactsbusiness/model/jobposition/status/JobPositionStatus.java b/src/org/mxchange/jcontactsbusiness/model/jobposition/status/JobPositionStatus.java
new file mode 100644 (file)
index 0000000..30584b4
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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;
+       }
+
+}