]> git.mxchange.org Git - jjobs-war.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 26 Aug 2017 21:14:30 +0000 (23:14 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 26 Aug 2017 21:19:36 +0000 (23:19 +0200)
- renamed with project name

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java [deleted file]
src/java/org/mxchange/jjobs/validator/business/basicdata/JobsCompanyNameValidator.java [new file with mode: 0644]
web/WEB-INF/templates/base.tpl

diff --git a/src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java b/src/java/org/mxchange/jfinancials/validator/business/basicdata/FinancialsCompanyNameValidator.java
deleted file mode 100644 (file)
index b67bc4d..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.validator.business.basicdata;
-
-import java.text.MessageFormat;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.ConverterException;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.ValidatorException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
-import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-
-/**
- * A validator for company names
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesValidator ("CompanyNameValidator")
-public class FinancialsCompanyNameValidator extends BaseStringValidator {
-
-       /**
-        * Business contact EJB
-        */
-       private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 57_283_657_476_561L;
-
-       @Override
-       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // All accepted, required fields
-               String[] requiredFields = {"companyName"}; //NOI18N
-
-               // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, false);
-
-               // Convert name to string (now securely checked in BaseStringValidator)
-               String companyName = (String) value;
-
-               // Default is to check on existing names
-               Boolean checkExisting = Boolean.TRUE;
-
-               // Is attribute "allowEmptyValue" set?
-               if (component.getAttributes().containsKey("checkExisting")) { //NOI18N
-                       // Get attribute
-                       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 bean not yet set?
-               // @TODO Requires this synchronization or is it (sync) confusing the container?
-               if (null == FinancialsCompanyNameValidator.BASIC_DATA_BEAN) {
-                       // Try to get it
-                       try {
-                               // Get initial context
-                               Context initialContext = new InitialContext();
-
-                               // ... and user controller
-                               FinancialsCompanyNameValidator.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
-                       } catch (final NamingException ex) {
-                               // Continue to throw it
-                               throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-                       }
-               }
-
-               // Check if name is already used
-               Boolean nameExists = FinancialsCompanyNameValidator.BASIC_DATA_BEAN.isCompanyNameUsed(companyName);
-
-               // Is the user id valid?
-               if ((!nameExists) && (checkExisting)) {
-                       // Format message
-                       String message = MessageFormat.format("No basic data found with comany name {0}.", companyName);
-
-                       // Name does not exist
-                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N
-               } else if ((nameExists) && (!checkExisting)) {
-                       // Format message
-                       String message = MessageFormat.format("Found basic data with comany name {0}.", companyName);
-
-                       // Name already exists
-                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N
-               }
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsCompanyNameValidator.java b/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsCompanyNameValidator.java
new file mode 100644 (file)
index 0000000..bbebec9
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.validator.business.basicdata;
+
+import java.text.MessageFormat;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+
+/**
+ * A validator for company names
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesValidator ("CompanyNameValidator")
+public class JobsCompanyNameValidator extends BaseStringValidator {
+
+       /**
+        * Business contact EJB
+        */
+       private static BusinessDataSessionBeanRemote BASIC_DATA_BEAN;
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 57_283_657_476_561L;
+
+       @Override
+       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+               // All accepted, required fields
+               String[] requiredFields = {"companyName"}; //NOI18N
+
+               // Pre-validation (example: not null, not a string, empty string ...)
+               super.preValidate(context, component, value, requiredFields, false);
+
+               // Convert name to string (now securely checked in BaseStringValidator)
+               String companyName = (String) value;
+
+               // Default is to check on existing names
+               Boolean checkExisting = Boolean.TRUE;
+
+               // Is attribute "allowEmptyValue" set?
+               if (component.getAttributes().containsKey("checkExisting")) { //NOI18N
+                       // Get attribute
+                       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 bean not yet set?
+               // @TODO Requires this synchronization or is it (sync) confusing the container?
+               if (null == JobsCompanyNameValidator.BASIC_DATA_BEAN) {
+                       // Try to get it
+                       try {
+                               // Get initial context
+                               Context initialContext = new InitialContext();
+
+                               // ... and user controller
+                               JobsCompanyNameValidator.BASIC_DATA_BEAN = (BusinessDataSessionBeanRemote) initialContext.lookup("java:global/jjobs-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
+                       } catch (final NamingException ex) {
+                               // Continue to throw it
+                               throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                       }
+               }
+
+               // Check if name is already used
+               Boolean nameExists = JobsCompanyNameValidator.BASIC_DATA_BEAN.isCompanyNameUsed(companyName);
+
+               // Is the user id valid?
+               if ((!nameExists) && (checkExisting)) {
+                       // Format message
+                       String message = MessageFormat.format("No basic data found with comany name {0}.", companyName);
+
+                       // Name does not exist
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N
+               } else if ((nameExists) && (!checkExisting)) {
+                       // Format message
+                       String message = MessageFormat.format("Found basic data with comany name {0}.", companyName);
+
+                       // Name already exists
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_WARN, message, message)); //NOI18N
+               }
+       }
+
+}
index b93961d39a77a24893abda8bf636babaf28e4644..14af2dd0cb5a5c71219c9441371c3331949394bf 100644 (file)
@@ -30,7 +30,7 @@
                                <h:panelGroup styleClass="page-header-container" layout="block">
                                        <div id="page-header">
                                                <h1>
-                                                       <h:outputText value="JFinancials" />
+                                                       <h:outputText value="JJobs" />
                                                        <h:outputText value=" - " />
                                                        <ui:insert name="title">
                                                                <h:outputText value="Default title" />