From c27a50af0ccaf8bb1acbb41f2b8289b5711a0dd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 6 Aug 2017 23:12:18 +0200 Subject: [PATCH] added initial entities for handling job positions, skills ... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jobposition/HireableJobPosition.java | 115 ++++++++ .../jjobs/model/jobposition/JobPosition.java | 275 ++++++++++++++++++ .../jobposition/status/JobPositionStatus.java | 91 ++++++ .../model/jobskill/JobPositionSkill.java | 217 ++++++++++++++ .../model/jobskill/SkillableJobPosition.java | 136 +++++++++ .../mxchange/jjobs/model/skill/JobSkill.java | 195 +++++++++++++ .../mxchange/jjobs/model/skill/Skillable.java | 120 ++++++++ .../jjobs/model/skill/status/SkillStatus.java | 76 +++++ .../model/user/skills/SkillableUser.java | 107 +++++++ .../jjobs/model/user/skills/UserSkill.java | 145 +++++++++ 10 files changed, 1477 insertions(+) create mode 100644 src/org/mxchange/jjobs/model/jobposition/HireableJobPosition.java create mode 100644 src/org/mxchange/jjobs/model/jobposition/JobPosition.java create mode 100644 src/org/mxchange/jjobs/model/jobposition/status/JobPositionStatus.java create mode 100644 src/org/mxchange/jjobs/model/jobskill/JobPositionSkill.java create mode 100644 src/org/mxchange/jjobs/model/jobskill/SkillableJobPosition.java create mode 100644 src/org/mxchange/jjobs/model/skill/JobSkill.java create mode 100644 src/org/mxchange/jjobs/model/skill/Skillable.java create mode 100644 src/org/mxchange/jjobs/model/skill/status/SkillStatus.java create mode 100644 src/org/mxchange/jjobs/model/user/skills/SkillableUser.java create mode 100644 src/org/mxchange/jjobs/model/user/skills/UserSkill.java diff --git a/src/org/mxchange/jjobs/model/jobposition/HireableJobPosition.java b/src/org/mxchange/jjobs/model/jobposition/HireableJobPosition.java new file mode 100644 index 0000000..7ad677b --- /dev/null +++ b/src/org/mxchange/jjobs/model/jobposition/HireableJobPosition.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.jobposition; + +import java.util.Calendar; +import org.mxchange.jcontactsbusiness.jobposition.JobPosition; +import org.mxchange.jjobs.model.jobposition.status.JobPositionStatus; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for hireable job positions + *

+ * @author Roland Häder + */ +public interface HireableJobPosition extends JobPosition { + + /** + * Getter for job position start + *

+ * @return Job position start + */ + Calendar getJobPositionStart (); + + /** + * Setter for job position start + *

+ * @param jobPositionStart Job position start + */ + void setJobPositionStart (final Calendar jobPositionStart); + + /** + * Getter for job position status + *

+ * @return Job position status + */ + JobPositionStatus getJobPositionStatus (); + + /** + * Setter for job position status + *

+ * @param jobPositionStatus Job position status + */ + void setJobPositionStatus (final JobPositionStatus jobPositionStatus); + + /** + * Getter for when this job position was deleted by user + *

+ * @return When this job position was deleted by user + */ + Calendar getJobPositionDeleted (); + + /** + * Setter for when this job position was deleted by user + *

+ * @param jobPositionDeleted When this job position was deleted by user + */ + void setJobPositionDeleted (final Calendar jobPositionDeleted); + + /** + * Getter for when this job position has expired + *

+ * @return When this job position has expired + */ + Calendar getJobPositionExpired (); + + /** + * Setter for when this job position has expired + *

+ * @param jobPositionExpired When this job position has expired + */ + void setJobPositionExpired (final Calendar jobPositionExpired); + + /** + * Getter for when employee was hired for this job position + *

+ * @return When employee was hired for this job position + */ + Calendar getJobPositionHired (); + + /** + * Setter for when employee was hired for this job position + *

+ * @param jobPositionHired When employee was hired for this job position + */ + void setJobPositionHired (final Calendar jobPositionHired); + + /** + * Getter for user who added this job position + *

+ * @return User who added this job position + */ + User getJobPositionAddedUser (); + + /** + * Setter for user who added this job position + *

+ * @param jobPositionAddedUser User who added this job position + */ + void setJobPositionAddedUser (final User jobPositionAddedUser); + +} diff --git a/src/org/mxchange/jjobs/model/jobposition/JobPosition.java b/src/org/mxchange/jjobs/model/jobposition/JobPosition.java new file mode 100644 index 0000000..5593025 --- /dev/null +++ b/src/org/mxchange/jjobs/model/jobposition/JobPosition.java @@ -0,0 +1,275 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.jobposition; + +import java.util.Calendar; +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.jjobs.model.jobposition.status.JobPositionStatus; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO entity for job positions + *

+ * @author Roland Häder + */ +@Entity (name = "open_job_position") +@Table ( + name = "open_job_position" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class JobPosition implements HireableJobPosition { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 547_102_736_712_809_694L; + + /** + * 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; + + /** + * When this entry has been created + */ + @Basic (optional = false) + @Column (name = "job_position_created", nullable = false, updatable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionCreated; + + /** + * When this job position (offer) was deleted + */ + @Column (name = "job_position_deleted") + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionDeleted; + + /** + * When this job position (offer) has expired + */ + @Column (name = "job_position_expired") + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionExpired; + + /** + * When a new employed was hired for this job position + */ + @Column (name = "job_position_hired") + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionHired; + + /** + * Id number (primary key) + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "job_position_id", nullable = false, updatable = false) + private Long jobPositionId; + + /** + * Name of the position (example: Store Worker) + */ + @Basic (optional = false) + @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 Calendar jobPositionStart; + + /** + * Job position status + */ + @Basic (optional = false) + @Column (name = "job_position_status", nullable = false) + @Enumerated (EnumType.STRING) + private JobPositionStatus jobPositionStatus; + + /** + * When this entry has been created + */ + @Column (name = "job_position_updated", insertable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionUpdated; + + @Override + public boolean equals (final Object object) { + if (this == object) { + return true; + } else if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final HireableJobPosition other = (HireableJobPosition) object; + + if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) { + return false; + } else if (!Objects.equals(this.getJobPositionId(), other.getJobPositionId())) { + 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 Calendar getJobPositionCreated () { + return this.jobPositionCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionCreated (final Calendar jobPositionCreated) { + this.jobPositionCreated = jobPositionCreated; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionDeleted () { + return this.jobPositionDeleted; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionDeleted (final Calendar jobPositionDeleted) { + this.jobPositionDeleted = jobPositionDeleted; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionExpired () { + return this.jobPositionExpired; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionExpired (final Calendar jobPositionExpired) { + this.jobPositionExpired = jobPositionExpired; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionHired () { + return this.jobPositionHired; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionHired (final Calendar jobPositionHired) { + this.jobPositionHired = jobPositionHired; + } + + @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; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionStart () { + return this.jobPositionStart; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionStart (final Calendar jobPositionStart) { + this.jobPositionStart = jobPositionStart; + } + + @Override + public JobPositionStatus getJobPositionStatus () { + return this.jobPositionStatus; + } + + @Override + public void setJobPositionStatus (final JobPositionStatus jobPositionStatus) { + this.jobPositionStatus = jobPositionStatus; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionUpdated () { + return this.jobPositionUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionUpdated (final Calendar jobPositionUpdated) { + this.jobPositionUpdated = jobPositionUpdated; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 37 * hash + Objects.hashCode(this.getJobPositionId()); + hash = 37 * hash + Objects.hashCode(this.getJobPositionName()); + + return hash; + } + +} diff --git a/src/org/mxchange/jjobs/model/jobposition/status/JobPositionStatus.java b/src/org/mxchange/jjobs/model/jobposition/status/JobPositionStatus.java new file mode 100644 index 0000000..3c70d85 --- /dev/null +++ b/src/org/mxchange/jjobs/model/jobposition/status/JobPositionStatus.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.jobposition.status; + +/** + * An enumeration for job position status + *

+ * @author Roland Häder + */ +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 + *

+ * @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 + *

+ * @return Message key for i18n bundles + */ + public String getMessageKey () { + return this.messageKey; + } + + /** + * Getter for CSS class + *

+ * @return CSS class + */ + public String getStyleClass () { + return this.styleClass; + } + +} diff --git a/src/org/mxchange/jjobs/model/jobskill/JobPositionSkill.java b/src/org/mxchange/jjobs/model/jobskill/JobPositionSkill.java new file mode 100644 index 0000000..67c6050 --- /dev/null +++ b/src/org/mxchange/jjobs/model/jobskill/JobPositionSkill.java @@ -0,0 +1,217 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.jobskill; + +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +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.jjobs.model.jobposition.HireableJobPosition; +import org.mxchange.jjobs.model.jobposition.JobPosition; +import org.mxchange.jjobs.model.skill.JobSkill; +import org.mxchange.jjobs.model.skill.Skillable; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO entity for job position skills (linking job position and skill + * together) + *

+ * @author Roland Häder + */ +@Entity (name = "job_skills") +@Table ( + name = "jobs_skills" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class JobPositionSkill implements SkillableJobPosition { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 186_757_123_896_419L; + + /** + * Linked job position + */ + @JoinColumn (name = "skill_job_position_id", referencedColumnName = "job_position_id", updatable = false, nullable = false) + @OneToOne (cascade = CascadeType.ALL, targetEntity = JobPosition.class, optional = false) + private HireableJobPosition jobPosition; + + /** + * When this entry has been created + */ + @Basic (optional = false) + @Column (name = "skill_job_created", nullable = false, updatable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionSkillCreated; + + /** + * Id number (primary key + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "skill_job_id", nullable = false, updatable = false) + private Long jobPositionSkillId; + + /** + * When this entry has been updated + */ + @Column (name = "skill_job_updated", insertable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar jobPositionSkillUpdated; + + /** + * Link to skill entity + */ + @JoinColumn(name = "skill_job_skill_id", nullable = false,updatable = false, referencedColumnName = "skill_id") + @OneToOne (cascade = CascadeType.REFRESH, targetEntity = JobSkill.class) + private Skillable jobSkill; + + /** + * User added this skill (optional as administrators can add skills, + * too) + */ + @JoinColumn (name = "skill_job_user_id", referencedColumnName = "user_id") + @OneToOne (cascade = CascadeType.REFRESH, targetEntity = LoginUser.class) + private User skillAddedUser; + + /** + * Skill importance (0=unimportant, 10=very important) + */ + @Basic (optional = false) + @Column (name = "skill_job_importance", nullable = false) + private Short skillImportance; + + @Override + public boolean equals (final Object object) { + if (this == object) { + return true; + } else if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final SkillableJobPosition other = (SkillableJobPosition) object; + + if (!Objects.equals(this.getJobPositionSkillId(), other.getJobPositionSkillId())) { + return false; + } else if (!Objects.equals(this.getSkillImportance(), other.getSkillImportance())) { + return false; + } + + return true; + } + + @Override + public HireableJobPosition getJobPosition () { + return this.jobPosition; + } + + @Override + public void setJobPosition (final HireableJobPosition jobPosition) { + this.jobPosition = jobPosition; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionSkillCreated () { + return this.jobPositionSkillCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionSkillCreated (final Calendar jobPositionSkillCreated) { + this.jobPositionSkillCreated = jobPositionSkillCreated; + } + + @Override + public Long getJobPositionSkillId () { + return this.jobPositionSkillId; + } + + @Override + public void setJobPositionSkillId (final Long jobPositionSkillId) { + this.jobPositionSkillId = jobPositionSkillId; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getJobPositionSkillUpdated () { + return this.jobPositionSkillUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setJobPositionSkillUpdated (final Calendar jobPositionSkillUpdated) { + this.jobPositionSkillUpdated = jobPositionSkillUpdated; + } + + @Override + public Skillable getJobSkill () { + return this.jobSkill; + } + + @Override + public void setJobSkill (final Skillable jobSkill) { + this.jobSkill = jobSkill; + } + + @Override + public User getSkillAddedUser () { + return this.skillAddedUser; + } + + @Override + public void setSkillAddedUser (final User skillAddedUser) { + this.skillAddedUser = skillAddedUser; + } + + @Override + public Short getSkillImportance () { + return this.skillImportance; + } + + @Override + public void setSkillImportance (final Short skillImportance) { + this.skillImportance = skillImportance; + } + + @Override + public int hashCode () { + int hash = 5; + + hash = 41 * hash + Objects.hashCode(this.getJobPositionSkillId()); + hash = 41 * hash + Objects.hashCode(this.getSkillImportance()); + + return hash; + } + +} diff --git a/src/org/mxchange/jjobs/model/jobskill/SkillableJobPosition.java b/src/org/mxchange/jjobs/model/jobskill/SkillableJobPosition.java new file mode 100644 index 0000000..1595bf2 --- /dev/null +++ b/src/org/mxchange/jjobs/model/jobskill/SkillableJobPosition.java @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.jobskill; + +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jjobs.model.jobposition.HireableJobPosition; +import org.mxchange.jjobs.model.skill.Skillable; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for jobPosition's skills + *

+ * @author Roland Häder + */ +public interface SkillableJobPosition extends Serializable { + + /** + * Getter for job position skill id number + *

+ * @return Job position skill id number + */ + Long getJobPositionSkillId (); + + /** + * Setter for job position skill id number + *

+ * @param jobPositionSkillId Job position skill id number + */ + void setJobPositionSkillId (final Long jobPositionSkillId); + + /** + * Getter for job position skill created timestamp + *

+ * @return Job position skill created timestamp + */ + Calendar getJobPositionSkillCreated (); + + /** + * Setter for job position skill created timestamp + *

+ * @param jobPositionSkillCreated Job position skill created timestamp + */ + void setJobPositionSkillCreated (final Calendar jobPositionSkillCreated); + + /** + * Getter for job position skill updated timestamp + *

+ * @return Job position skill updated timestamp + */ + Calendar getJobPositionSkillUpdated (); + + /** + * Setter for job position skill updated timestamp + *

+ * @param jobPositionSkillUpdated Job position skill updated timestamp + */ + void setJobPositionSkillUpdated (final Calendar jobPositionSkillUpdated); + + /** + * Getter for job skill + *

+ * @return Job skill + */ + Skillable getJobSkill (); + + /** + * Setter for job skill + *

+ * @param jobSkill Job skill + */ + void setJobSkill (final Skillable jobSkill); + + /** + * Getter for job position id from this link (to skill) + *

+ * @return Job position id + */ + HireableJobPosition getJobPosition (); + + /** + * Setter for job position id from this link (to skill) + *

+ * @param jobPosition Job position id + */ + void setJobPosition (final HireableJobPosition jobPosition); + + /** + * Getter for skill importance (0 = unrelevant, 10 = very relevant) + *

+ * @return Skill importance + */ + Short getSkillImportance (); + + /** + * Setter for skill importance (0 = unrelevant, 10 = very relevant) + *

+ * @param skillImportance Skill importance + */ + void setSkillImportance (final Short skillImportance); + + /** + * Getter for user instance who has added this skill + *

+ * @return User instance + */ + User getSkillAddedUser (); + + /** + * Setter for user instance who has added this skill + *

+ * @param skillAddedUser User instance + */ + void setSkillAddedUser (final User skillAddedUser); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jjobs/model/skill/JobSkill.java b/src/org/mxchange/jjobs/model/skill/JobSkill.java new file mode 100644 index 0000000..3b72324 --- /dev/null +++ b/src/org/mxchange/jjobs/model/skill/JobSkill.java @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.skill; + +import org.mxchange.jjobs.model.skill.status.SkillStatus; +import java.util.Calendar; +import java.util.Objects; +import javax.persistence.Basic; +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.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * A POJO entity for skills + *

+ * @author Roland Häder + */ +@Entity (name = "skills") +@Table ( + name = "skills" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class JobSkill implements Skillable { + + /** + * Serial number + */ + @Transient + private static final long serialVersionUID = 185435718692L; + + /** + * When this entry has been created + */ + @Basic (optional = false) + @Column (name = "skill_created", nullable = false, updatable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar skillCreated; + + /** + * Id number (primary key) + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "skill_id", nullable = false, updatable = false) + private Long skillId; + + /** + * When this entry has been last locked + */ + @Column (name = "skill_last_locked", insertable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar skillLastLocked; + + /** + * Skill name + */ + @Basic (optional = false) + @Column (name = "skill_name", nullable = false, unique = true) + private String skillName; + + /** + * Skill status + */ + @Basic (optional = false) + @Enumerated (EnumType.STRING) + @Column (name = "skill_status", nullable = false) + private SkillStatus skillStatus; + + /** + * When this entry has been updated + */ + @Column (name = "skill_updated", insertable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar skillUpdated; + + @Override + public boolean equals (final Object object) { + if (this == object) { + return true; + } else if (null == object) { + return false; + } else if (this.getClass() != object.getClass()) { + return false; + } + + final Skillable other = (Skillable) object; + + if (!Objects.equals(this.getSkillName(), other.getSkillName())) { + return false; + } else if (!Objects.equals(this.getSkillId(), other.getSkillId())) { + return false; + } + + return true; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getSkillCreated () { + return this.skillCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setSkillCreated (final Calendar skillCreated) { + this.skillCreated = skillCreated; + } + + @Override + public Long getSkillId () { + return this.skillId; + } + + @Override + public void setSkillId (final Long skillId) { + this.skillId = skillId; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getSkillLastLocked () { + return this.skillLastLocked; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setSkillLastLocked (final Calendar skillLastLocked) { + this.skillLastLocked = skillLastLocked; + } + + @Override + public String getSkillName () { + return this.skillName; + } + + @Override + public void setSkillName (final String skillName) { + this.skillName = skillName; + } + + @Override + public SkillStatus getSkillStatus () { + return this.skillStatus; + } + + @Override + public void setSkillStatus (final SkillStatus skillStatus) { + this.skillStatus = skillStatus; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getSkillUpdated () { + return this.skillUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setSkillUpdated (final Calendar skillUpdated) { + this.skillUpdated = skillUpdated; + } + + @Override + public int hashCode () { + int hash = 7; + + hash = 97 * hash + Objects.hashCode(this.getSkillId()); + hash = 97 * hash + Objects.hashCode(this.getSkillName()); + + return hash; + } + +} diff --git a/src/org/mxchange/jjobs/model/skill/Skillable.java b/src/org/mxchange/jjobs/model/skill/Skillable.java new file mode 100644 index 0000000..6bc3da6 --- /dev/null +++ b/src/org/mxchange/jjobs/model/skill/Skillable.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.skill; + +import org.mxchange.jjobs.model.skill.status.SkillStatus; +import java.io.Serializable; +import java.util.Calendar; + +/** + * A POJI for skills (hard and soft) + *

+ * @author Roland Häder + */ +public interface Skillable extends Serializable { + + /** + * Getter for skill id + *

+ * @return Skill id + */ + Long getSkillId (); + + /** + * Setter for skill id + *

+ * @param skillId Skill id + */ + void setSkillId (final Long skillId); + + /** + * Getter for skill name + *

+ * @return Skill name + */ + String getSkillName (); + + /** + * Setter for skill name + *

+ * @param skillName Skill name + */ + void setSkillName (final String skillName); + + /** + * Getter for skill created timestamp + *

+ * @return Skill created timestamp + */ + Calendar getSkillCreated (); + + /** + * Setter for skill created timestamp + *

+ * @param skillCreated Skill created timestamp + */ + void setSkillCreated (final Calendar skillCreated); + + /** + * Getter for skill updated timestamp + *

+ * @return Skill updated timestamp + */ + Calendar getSkillUpdated (); + + /** + * Setter for skill updated timestamp + *

+ * @param skillUpdated Skill updated timestamp + */ + void setSkillUpdated (final Calendar skillUpdated); + + /** + * Getter for skill last locked timestamp + *

+ * @return Skill last locked timestamp + */ + Calendar getSkillLastLocked (); + + /** + * Setter for skill last locked timestamp + *

+ * @param skillLastLocked Skill last locked timestamp + */ + void setSkillLastLocked (final Calendar skillLastLocked); + + /** + * Getter for skill status + *

+ * @return Skill status + */ + SkillStatus getSkillStatus (); + + /** + * Getter for skill status + *

+ * @param skillStatus Skill status + */ + void setSkillStatus (final SkillStatus skillStatus); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jjobs/model/skill/status/SkillStatus.java b/src/org/mxchange/jjobs/model/skill/status/SkillStatus.java new file mode 100644 index 0000000..7a60802 --- /dev/null +++ b/src/org/mxchange/jjobs/model/skill/status/SkillStatus.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.skill.status; + +/** + * An enumeration for skills + *

+ * @author Roland Häder + */ +public enum SkillStatus { + + /** + * Unlocked (added, can be used) + */ + UNLOCKED("SKILL_STATUS_UNLOCKED", "skill_status_unlocked"), //NOI18N + + /** + * Locked by administrator + */ + LOCKED("SKILL_STATUS_LOCKED", "skill_status_locked"); //NOI18N + + /** + * Message key for i18n bundles + */ + private final String messageKey; + + /** + * CSS class + */ + private final String styleClass; + + /** + * Constructor with message key for i18n bundles and CSS class + *

+ * @param messageKey Message key for i18n bundles + * @param styleClass CSS class + */ + private SkillStatus (final String messageKey, final String styleClass) { + // Set al + this.messageKey = messageKey; + this.styleClass = styleClass; + } + + /** + * Getter for message key + *

+ * @return Message key + */ + public String getMessageKey () { + return this.messageKey; + } + + /** + * CSS class + *

+ * @return CSS class + */ + public String getStyleClass () { + return this.styleClass; + } + +} diff --git a/src/org/mxchange/jjobs/model/user/skills/SkillableUser.java b/src/org/mxchange/jjobs/model/user/skills/SkillableUser.java new file mode 100644 index 0000000..276de73 --- /dev/null +++ b/src/org/mxchange/jjobs/model/user/skills/SkillableUser.java @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.user.skills; + +import org.mxchange.jjobs.model.skill.Skillable; +import java.io.Serializable; +import java.util.Calendar; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for user's skills + *

+ * @author Roland Häder + */ +public interface SkillableUser extends Serializable { + + /** + * Getter for user skill id number + *

+ * @return User skill id number + */ + Long getUserSkillId (); + + /** + * Setter for user skill id number + *

+ * @param userSkillId User skill id number + */ + void setUserSkillId (final Long userSkillId); + + /** + * Getter for user skill created timestamp + *

+ * @return Job position skill created timestamp + */ + Calendar getUserSkillCreated (); + + /** + * Setter for user skill created timestamp + *

+ * @param userSkillCreated Job position skill created timestamp + */ + void setUserSkillCreated (final Calendar userSkillCreated); + + /** + * Getter for user skill updated timestamp + *

+ * @return Job position skill updated timestamp + */ + Calendar getUserSkillUpdated (); + + /** + * Setter for user skill updated timestamp + *

+ * @param userSkillUpdated Job position skill updated timestamp + */ + void setUserSkillUpdated (final Calendar userSkillUpdated); + + /** + * Getter for job skill + *

+ * @return Job skill + */ + Skillable getJobSkill (); + + /** + * Setter for job skill + *

+ * @param jobSkill Job skill + */ + void setJobSkill (final Skillable jobSkill); + + /** + * Getter for user instance + *

+ * @return User instance + */ + User getSkillUser (); + + /** + * Setter for user instance + *

+ * @param skillUser User instance + */ + void setSkillUser (final User skillUser); + + @Override + boolean equals (final Object object); + + @Override + int hashCode (); + +} diff --git a/src/org/mxchange/jjobs/model/user/skills/UserSkill.java b/src/org/mxchange/jjobs/model/user/skills/UserSkill.java new file mode 100644 index 0000000..5380924 --- /dev/null +++ b/src/org/mxchange/jjobs/model/user/skills/UserSkill.java @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * 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 . + */ +package org.mxchange.jjobs.model.user.skills; + +import org.mxchange.jjobs.model.skill.JobSkill; +import org.mxchange.jjobs.model.skill.Skillable; +import java.util.Calendar; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +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 org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO entity for user skills + * + * @author Roland Häder + */ +@Entity (name = "user_skills") +@Table ( + name = "user_skills" +) +@SuppressWarnings ("PersistenceUnitPresent") +public class UserSkill implements SkillableUser { + + /** + * Serial number + */ + private static final long serialVersionUID = 12_837_674_186_902L; + + /** + * Link to skills entity + */ + @JoinColumn (name = "user_skill_id", referencedColumnName = "skill_id", nullable = false, updatable = false) + @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = JobSkill.class) + private Skillable jobSkill; + + /** + * Link to user entity + */ + @JoinColumn (name = "user_skill_user_id", referencedColumnName = "user_id", nullable = false, updatable = false) + @OneToOne (cascade = CascadeType.REFRESH, optional = false, targetEntity = LoginUser.class) + private User skillUser; + + /** + * When this entry has been created + */ + @Basic (optional = false) + @Column (name = "user_skill_created", nullable = false, updatable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar userSkillCreated; + + /** + * Id number (primary key) + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "user_skill_entry_id", nullable = false, updatable = false) + private Long userSkillId; + + /** + * When this entry has been updated + */ + @Column (name = "user_skill_updated", insertable = false) + @Temporal (TemporalType.TIMESTAMP) + private Calendar userSkillUpdated; + + @Override + public Skillable getJobSkill () { + return this.jobSkill; + } + + @Override + public void setJobSkill (final Skillable jobSkill) { + this.jobSkill = jobSkill; + } + + @Override + public User getSkillUser () { + return this.skillUser; + } + + @Override + public void setSkillUser (final User skillUser) { + this.skillUser = skillUser; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getUserSkillCreated () { + return this.userSkillCreated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setUserSkillCreated (final Calendar userSkillCreated) { + this.userSkillCreated = userSkillCreated; + } + + @Override + public Long getUserSkillId () { + return this.userSkillId; + } + + @Override + public void setUserSkillId (final Long userSkillId) { + this.userSkillId = userSkillId; + } + + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getUserSkillUpdated () { + return this.userSkillUpdated; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setUserSkillUpdated (final Calendar userSkillUpdated) { + this.userSkillUpdated = userSkillUpdated; + } + +} -- 2.39.5