file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar
file.reference.jcontacts-core.jar=lib/jcontacts-core.jar
file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar
+file.reference.jcore-utils.jar=lib/jcore-utils.jar
file.reference.jcoreee.jar=lib/jcoreee.jar
file.reference.jcountry-core.jar=lib/jcountry-core.jar
file.reference.jphone-core.jar=lib/jphone-core.jar
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.jcoreee.jar}:\
+ ${file.reference.jcore-utils.jar}:\
${file.reference.jcore-logger-lib.jar}:\
${file.reference.jcountry-core.jar}:\
${file.reference.jphone-core.jar}:\
${file.reference.juser-core.jar}:\
${file.reference.jcontacts-core.jar}:\
${file.reference.jcontacts-business-core.jar}:\
+ ${libs.commons-lang3.classpath}:\
${libs.jpa20-persistence.classpath}:\
${libs.javaee-api-7.0.classpath}
# Space-separated list of extra javac options
source.reference.jcontacts-business-core.jar=../jcore-business-core/src/
source.reference.jcontacts-core.jar=../jcontacts-core/src/
source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/
+source.reference.jcore-utils.jar=../jcore-utils/src/
source.reference.jcoreee.jar=../jcoreee/src/
source.reference.jcountry-core.jar=../jcountry-core/src/
source.reference.jphone-core.jar=../jphone-core/src/
import javax.persistence.Transient;
import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition;
import org.mxchange.jcontactsbusiness.model.jobposition.HireableJobPosition;
+import org.mxchange.jcontactsbusiness.model.utils.JobPositionUtils;
+import org.mxchange.jcoreutils.comparable.ComparableUtils;
+import org.mxchange.jcoreutils.number.SafeNumberUtils;
import org.mxchange.jjobs.model.skill.JobSkill;
import org.mxchange.jjobs.model.skill.Skillable;
+import org.mxchange.jjobs.model.utils.SkillUtils;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.utils.UserUtils;
/**
* A POJO entity for job position skills (linking job position and skill
this.skillImportance = skillImportance;
}
+ @Override
+ public int compareTo (final SkillableJobPosition skillableJobPosition) {
+ // Checkparameter and return 0 if equal
+ if (null == skillableJobPosition) {
+ // Should not happen
+ throw new NullPointerException("Parameter 'skillableJobPosition' is null"); //NOI18N
+ } else if (Objects.equals(this, skillableJobPosition)) {
+ // Same object
+ return 0;
+ }
+
+ // Init comparitors
+ final int comparitors[] = {
+ // First compare job position
+ JobPositionUtils.compare(this.getJobPosition(), skillableJobPosition.getJobPosition()),
+ // ... next skill
+ SkillUtils.compare(this.getJobSkill(), skillableJobPosition.getJobSkill()),
+ // next job importance
+ SafeNumberUtils.compare(this.getSkillImportance(), skillableJobPosition.getSkillImportance()),
+ // ... next user
+ UserUtils.compare(this.getSkillAddedUser(), skillableJobPosition.getSkillAddedUser()),
+ // ... next primary key
+ SafeNumberUtils.compare(this.getJobPositionSkillId(), skillableJobPosition.getJobPositionSkillId())
+ };
+
+ // Check all values
+ final int comparison = ComparableUtils.checkAll(comparitors);
+
+ // Return value
+ return comparison;
+ }
+
@Override
public boolean equals (final Object object) {
if (this == object) {
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-public interface SkillableJobPosition extends Serializable {
+public interface SkillableJobPosition extends Comparable<SkillableJobPosition>, Serializable {
/**
* Getter for job position skill id number
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
+import org.mxchange.jcoreutils.comparable.ComparableUtils;
+import org.mxchange.jcoreutils.enums.EnumUtils;
import org.mxchange.jjobs.model.skill.status.SkillStatus;
/**
this.skillStatus = skillStatus;
}
+ @Override
+ public int compareTo (final Skillable skill) {
+ // Checkparameter and return 0 if equal
+ if (null == skill) {
+ // Should not happen
+ throw new NullPointerException("Parameter 'skill' is null"); //NOI18N
+ } else if (Objects.equals(this, skill)) {
+ // Same object
+ return 0;
+ }
+
+ // Init comparitors
+ final int comparitors[] = {
+ // First compare status
+ EnumUtils.compare(this.getSkillStatus(), skill.getSkillStatus()),
+ // ... next name
+ StringUtils.compare(this.getSkillName(), skill.getSkillName())
+ };
+
+ // Check all values
+ final int comparison = ComparableUtils.checkAll(comparitors);
+
+ // Return value
+ return comparison;
+ }
+
@Override
public boolean equals (final Object object) {
if (this == object) {
*/
package org.mxchange.jjobs.model.skill;
-import org.mxchange.jjobs.model.skill.status.SkillStatus;
import java.io.Serializable;
import java.util.Date;
+import org.mxchange.jjobs.model.skill.status.SkillStatus;
/**
* A POJI for skills (hard and soft)
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-public interface Skillable extends Serializable {
+public interface Skillable extends Comparable<Skillable>, Serializable {
/**
* Getter for skill id
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-public interface SkillableUser extends Serializable {
+public interface SkillableUser extends Comparable<SkillableUser>, Serializable {
/**
* Getter for user skill id number
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import org.mxchange.jcoreutils.comparable.ComparableUtils;
+import org.mxchange.jcoreutils.number.SafeNumberUtils;
import org.mxchange.jjobs.model.skill.JobSkill;
import org.mxchange.jjobs.model.skill.Skillable;
+import org.mxchange.jjobs.model.utils.SkillUtils;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.utils.UserUtils;
/**
* A POJO entity for user skills
this.skillUser = skillUser;
}
+ @Override
+ public int compareTo (final SkillableUser user) {
+ // Checkparameter and return 0 if equal
+ if (null == user) {
+ // Should not happen
+ throw new NullPointerException("Parameter 'user' is null"); //NOI18N
+ } else if (Objects.equals(this, user)) {
+ // Same object
+ return 0;
+ }
+
+ // Init comparitors
+ final int comparitors[] = {
+ // First compare user
+ UserUtils.compare(this.getSkillUser(), user.getSkillUser()),
+ // Next skill
+ SkillUtils.compare(this.getJobSkill(), user.getJobSkill()),
+ // Primary key
+ SafeNumberUtils.compare(this.getUserSkillId(), user.getUserSkillId())
+ };
+
+ // Check all values
+ final int comparison = ComparableUtils.checkAll(comparitors);
+
+ // Return value
+ return comparison;
+ }
+
@Override
public boolean equals (final Object object) {
if (this == object) {
--- /dev/null
+/*
+ * Copyright (C) 2023 Roland Häder<roland@mxchange.org>
+ *
+ * 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.jjobs.model.utils;
+
+import java.util.Objects;
+import org.mxchange.jjobs.model.skill.Skillable;
+
+/**
+ * Utilities class for skills to learn and practice
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class SkillUtils {
+
+ /**
+ * Compares two skills with each other
+ * <p>
+ * @param skill1 Skill instance 1
+ * @param skill2 Skill instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final Skillable skill1, final Skillable skill2) {
+ // Check equality, then at least first must be given
+ if (Objects.equals(skill1, skill2)) {
+ // Both are same
+ return 0;
+ } else if (null == skill1) {
+ // First is null
+ return -1;
+ } else if (null == skill2) {
+ // Second is null
+ return 1;
+ }
+
+ // Invoke compare() method
+ return skill1.compareTo(skill2);
+ }
+
+ /**
+ * Utilities classes don't have constructors
+ */
+ private SkillUtils () {
+ }
+}