From cd8de7c101dc19a8c9ad887883ee9a122a75df0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 19 Jan 2023 08:51:06 +0100 Subject: [PATCH] Continued: - attributes from registered validators are not exposed in component's attribute list, they need to be set and read by setter/getter - added missing navigation rules - fixed navigation outcomes (copy-paste) - also added missing 'value="#{controller.attribute}"' (ops) --- .../jobs/skill/JobsSkillNameValidator.java | 45 ++++++++++--------- web/WEB-INF/faces-config.xml | 15 +++++++ web/admin/jobs/skill/admin_skill_list.xhtml | 9 ++-- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/java/org/mxchange/jjobs/validator/jobs/skill/JobsSkillNameValidator.java b/src/java/org/mxchange/jjobs/validator/jobs/skill/JobsSkillNameValidator.java index ce41db10..0858be90 100644 --- a/src/java/org/mxchange/jjobs/validator/jobs/skill/JobsSkillNameValidator.java +++ b/src/java/org/mxchange/jjobs/validator/jobs/skill/JobsSkillNameValidator.java @@ -40,6 +40,29 @@ public class JobsSkillNameValidator extends BaseStringValidator { */ private static JobsSkillListWebViewController SKILL_LIST_CONTROLLER; + /** + * Attribute checkExisting + */ + private Boolean checkExisting; + + /** + * Getter for checkExisting attribute + *

+ * @return Attribute checkExisting + */ + public Boolean getCheckExisting () { + return this.checkExisting; + } + + /** + * Setter for checkExisting attribute + *

+ * @param checkExisting + */ + public void setCheckExisting (final Boolean checkExisting) { + this.checkExisting = checkExisting; + } + /** * Serial number */ @@ -56,24 +79,6 @@ public class JobsSkillNameValidator extends BaseStringValidator { // Convert name to string (now securely checked in BaseStringValidator) final String skillName = (String) value; - // Default is to check on existing names - Boolean checkExisting = Boolean.TRUE; - - // Is attribute "checkExisting" set? - if (component.getAttributes().containsKey("checkExisting")) { //NOI18N - // Get attribute - final Object attribute = component.getAttributes().get("checkExisting"); //NOI18N - - // Make sure, it is Boolean as no String is accepted anymore - if (!(attribute instanceof String)) { - // Not valid attribute, please use "true" or "false" (default) - throw new IllegalArgumentException("checkExisting must be of type String. Please use \"true\" or \"false\" for f:attribute value."); //NOI18N - } - - // Securely cast it - checkExisting = Boolean.parseBoolean((String) attribute); - } - // Is the instance there? if (null == SKILL_LIST_CONTROLLER) { // Get bean from CDI directly @@ -86,13 +91,13 @@ public class JobsSkillNameValidator extends BaseStringValidator { // Is the user id valid? if ((!nameExists) && (checkExisting)) { // Format message - final String message = MessageFormat.format("No basic data found with comany name {0}.", skillName); + final String message = MessageFormat.format("No skill found with name {0}.", skillName); // Name does not exist throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N } else if ((nameExists) && (!checkExisting)) { // Format message - final String message = MessageFormat.format("Found basic data with comany name {0}.", skillName); + final String message = MessageFormat.format("Found skillwith name {0}.", skillName); // Name already exists throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 725957b0..7af14261 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -173,6 +173,21 @@ /admin/jobs/skill/admin_skill_list.xhtml + + /admin/jobs/skill/admin_skill_list.xhtml + + admin_show_skill + /admin/jobs/skill/admin_skill_show.xhtml + + + admin_edit_skill + /admin/jobs/skill/admin_skill_edit.xhtml + + + admin_delete_skill + /admin/jobs/skill/admin_skill_delete.xhtml + + /user/login_index.xhtml diff --git a/web/admin/jobs/skill/admin_skill_list.xhtml b/web/admin/jobs/skill/admin_skill_list.xhtml index cc0a3ccf..d6b5d88d 100644 --- a/web/admin/jobs/skill/admin_skill_list.xhtml +++ b/web/admin/jobs/skill/admin_skill_list.xhtml @@ -94,7 +94,7 @@ filterable="false" > @@ -160,7 +160,7 @@ > @@ -168,14 +168,14 @@ - + -- 2.39.5