]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 19 Jan 2023 07:51:06 +0000 (08:51 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 19 Jan 2023 07:51:06 +0000 (08:51 +0100)
- 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)

src/java/org/mxchange/jjobs/validator/jobs/skill/JobsSkillNameValidator.java
web/WEB-INF/faces-config.xml
web/admin/jobs/skill/admin_skill_list.xhtml

index ce41db10f6c3da1ed8e6f529f4d22ad48e0344e9..0858be90abc2f14699d2398cd2e09f2868dfa525 100644 (file)
@@ -40,6 +40,29 @@ public class JobsSkillNameValidator extends BaseStringValidator {
         */
        private static JobsSkillListWebViewController SKILL_LIST_CONTROLLER;
 
+       /**
+        * Attribute checkExisting
+        */
+       private Boolean checkExisting;
+
+       /**
+        * Getter for checkExisting attribute
+        * <p>
+        * @return Attribute checkExisting
+        */
+       public Boolean getCheckExisting () {
+               return this.checkExisting;
+       }
+
+       /**
+        * Setter for checkExisting attribute
+        * <p>
+        * @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
index 725957b00b9c49d9ee6424aa21fdcc7ef008d7c5..7af1426133a4b50a54cd897413ec8d9dfaa57d24 100644 (file)
                        <to-view-id>/admin/jobs/skill/admin_skill_list.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <navigation-rule>
+               <from-view-id>/admin/jobs/skill/admin_skill_list.xhtml</from-view-id>
+               <navigation-case>
+                       <from-outcome>admin_show_skill</from-outcome>
+                       <to-view-id>/admin/jobs/skill/admin_skill_show.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_edit_skill</from-outcome>
+                       <to-view-id>/admin/jobs/skill/admin_skill_edit.xhtml</to-view-id>
+               </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_delete_skill</from-outcome>
+                       <to-view-id>/admin/jobs/skill/admin_skill_delete.xhtml</to-view-id>
+               </navigation-case>
+       </navigation-rule>
        <navigation-rule>
                <from-view-id>/user/login_index.xhtml</from-view-id>
                <navigation-case>
index cc0a3ccfe59eedf933f0b06a4688b08429af1e65..d6b5d88d92842f0e6f8aab554e9fdf553f1fa467 100644 (file)
@@ -94,7 +94,7 @@
                                        filterable="false"
                                        >
                                        <p:link
-                                               outcome="admin_show_basic_data"
+                                               outcome="admin_show_skill"
                                                value="#{skill.skillId}"
                                                title="#{msg.ADMIN_LINK_SHOW_SKILL_TITLE}"
                                                >
                                        >
                                        <p:menuButton value="#{msg.OPTIONS}">
                                                <p:menuitem
-                                                       outcome="admin_show_basic_data"
+                                                       outcome="admin_show_skill"
                                                        value="#{msg.ADMIN_LINK_SHOW_SHORT}"
                                                        title="#{msg.ADMIN_LINK_SHOW_SKILL_TITLE}"
                                                        >
                                                </p:menuitem>
 
                                                <p:menuitem
-                                                       outcome="admin_edit_basic_data"
+                                                       outcome="admin_edit_skill"
                                                        value="#{msg.ADMIN_LINK_EDIT_SHORT}"
                                                        title="#{msg.ADMIN_LINK_EDIT_SKILL_TITLE}"
                                                        >
                                                        <f:param name="skillId" value="#{skill.skillId}" />
                                                </p:menuitem>
 
-                                               <p:menuitem outcome="admin_delete_basic_data">
+                                               <p:menuitem outcome="admin_delete_skill">
                                                        <h:outputText
                                                                styleClass="link-danger"
                                                                value="#{msg.ADMIN_LINK_DELETE_SHORT}"
                                                        <p:outputLabel for="skillStatus" value="#{msg.ADMIN_SKILL_STATUS}" />
                                                        <p:selectOneMenu
                                                                id="skillStatus"
+                                                               value="#{adminSkillActionController.skillStatus}"
                                                                filter="true"
                                                                filterMatchMode="contains"
                                                                >