]> git.mxchange.org Git - jcoreee.git/commitdiff
Renaming season is not yet over ... ;-)
authorRoland Haeder <roland@mxchange.org>
Sat, 5 Sep 2015 13:03:15 +0000 (15:03 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 5 Sep 2015 13:03:15 +0000 (15:03 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

26 files changed:
build.xml
dist.sh
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
src/org/mxchange/jcoreee/BaseServletSystem.java [new file with mode: 0644]
src/org/mxchange/jcoreee/beans/BaseFrameworkBean.java [new file with mode: 0644]
src/org/mxchange/jcoreee/beans/FrameworkBean.java [new file with mode: 0644]
src/org/mxchange/jcoreee/filter/servlet/BaseServletFilter.java [new file with mode: 0644]
src/org/mxchange/jcoreee/filter/servlet/utf8/Utf8ServletFilter.java [new file with mode: 0644]
src/org/mxchange/jcoreee/validator/BaseObjectValidator.java [new file with mode: 0644]
src/org/mxchange/jcoreee/validator/bool/BaseBooleanValidator.java [new file with mode: 0644]
src/org/mxchange/jcoreee/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java [new file with mode: 0644]
src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java [new file with mode: 0644]
src/org/mxchange/jcoreee/validator/string/names/NameValidator.java [new file with mode: 0644]
src/org/mxchange/jcoreejb/BaseServletSystem.java [deleted file]
src/org/mxchange/jcoreejb/beans/BaseFrameworkBean.java [deleted file]
src/org/mxchange/jcoreejb/beans/FrameworkBean.java [deleted file]
src/org/mxchange/jcoreejb/filter/servlet/BaseServletFilter.java [deleted file]
src/org/mxchange/jcoreejb/filter/servlet/utf8/Utf8ServletFilter.java [deleted file]
src/org/mxchange/jcoreejb/validator/BaseObjectValidator.java [deleted file]
src/org/mxchange/jcoreejb/validator/bool/BaseBooleanValidator.java [deleted file]
src/org/mxchange/jcoreejb/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java [deleted file]
src/org/mxchange/jcoreejb/validator/string/BaseStringValidator.java [deleted file]
src/org/mxchange/jcoreejb/validator/string/names/NameValidator.java [deleted file]

index 03162943e34ec6762987dc1d3923e0274c51c34b..6c4e6fe29c4c549c26db0facd5420bc8702d2de8 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -7,8 +7,8 @@
 <!-- the Compile on Save feature is turned off for the project. -->
 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
 <!-- in the project's Project Properties dialog box.-->
-<project name="jcore-ejb" default="default" basedir=".">
-    <description>Builds, tests, and runs the project jcore-ejb.</description>
+<project name="jcoreee" default="default" basedir=".">
+    <description>Builds, tests, and runs the project jcoreee.</description>
     <import file="nbproject/build-impl.xml"/>
     <!--
 
@@ -58,7 +58,7 @@
 
     An example of overriding the target for project execution could look like this:
 
-        <target name="run" depends="jcore-ejb-impl.jar">
+        <target name="run" depends="jcoreee-impl.jar">
             <exec dir="bin" executable="launcher.exe">
                 <arg file="${dist.jar}"/>
             </exec>
diff --git a/dist.sh b/dist.sh
index d31902f980f853c1c03effa59cde0bf134e0d8f8..0135af4359137c9f6cc4ca37fe54ee94ce97e395 100755 (executable)
--- a/dist.sh
+++ b/dist.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-NAME="jcore-ejb"
+NAME="jcoreee"
 LIST=`find ../*/lib/${NAME}.jar`
 LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`"
 
index 614c780302be363d2e36dd954a4206f908f66aff..5ba63b12f25e57e1ddadcc4dcf3d9be20541cc1a 100644 (file)
@@ -19,7 +19,7 @@ is divided into following sections:
   - cleanup
 
         -->
-<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="jcore-ejb-impl">
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="jcoreee-impl">
     <fail message="Please build using Ant 1.8.0 or higher.">
         <condition>
             <not>
@@ -468,7 +468,7 @@ is divided into following sections:
                     </fileset>
                 </union>
                 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
-                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="jcore-ejb" testname="TestNG tests" workingDir="${work.dir}">
+                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="jcoreee" testname="TestNG tests" workingDir="${work.dir}">
                     <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
                     <propertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -619,7 +619,7 @@ is divided into following sections:
                 <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
                     <isset property="test.method"/>
                 </condition>
-                <condition else="-suitename jcore-ejb -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
+                <condition else="-suitename jcoreee -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
                     <matches pattern=".*\.xml" string="@{testClass}"/>
                 </condition>
                 <delete dir="${build.test.results.dir}" quiet="true"/>
@@ -911,7 +911,7 @@ is divided into following sections:
         <delete file="${built-jar.properties}" quiet="true"/>
     </target>
     <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
-        <echo level="warn" message="Cycle detected: jcore-ejb was already built"/>
+        <echo level="warn" message="Cycle detected: jcoreee was already built"/>
     </target>
     <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
         <mkdir dir="${build.dir}"/>
@@ -1396,7 +1396,7 @@ is divided into following sections:
         <delete file="${built-clean.properties}" quiet="true"/>
     </target>
     <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
-        <echo level="warn" message="Cycle detected: jcore-ejb was already built"/>
+        <echo level="warn" message="Cycle detected: jcoreee was already built"/>
     </target>
     <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
         <mkdir dir="${build.dir}"/>
index 4ba34ae119301d8d631ece320ad6c517d6dfc1dc..622716b95e04aeee21980548314d300d920323e5 100644 (file)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=3641d4bf
-build.xml.script.CRC32=fb3c526a
+build.xml.data.CRC32=4032bd34
+build.xml.script.CRC32=3357aa22
 build.xml.stylesheet.CRC32=8064a381@1.75.2.48
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=3641d4bf
-nbproject/build-impl.xml.script.CRC32=93112dc4
+nbproject/build-impl.xml.data.CRC32=4032bd34
+nbproject/build-impl.xml.script.CRC32=29041c33
 nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
index 6982d965ce2a9b9907d2200a19a5bbeb04bead2d..797dd3a60690c72fbad9c4f610db6d7db8ae2d34 100644 (file)
@@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=true
 annotation.processing.processors.list=
 annotation.processing.run.all.processors=true
 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=jcore-ejb
+application.title=jcoreee
 application.vendor=Roland Haeder
 auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
 build.classes.dir=${build.dir}/classes
@@ -26,7 +26,7 @@ debug.test.classpath=\
 dist.archive.excludes=
 # This directory is removed when the project is cleaned:
 dist.dir=dist
-dist.jar=${dist.dir}/jcore-ejb.jar
+dist.jar=${dist.dir}/jcoreee.jar
 dist.javadoc.dir=${dist.dir}/javadoc
 endorsed.classpath=
 excludes=
index 473995e2480f19e9bdf901874fe109043752ce90..386475b113a7b71d59c4790221cfed418cacabd9 100644 (file)
@@ -3,7 +3,7 @@
     <type>org.netbeans.modules.java.j2seproject</type>
     <configuration>
         <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
-            <name>jcore-ejb</name>
+            <name>jcoreee</name>
             <source-roots>
                 <root id="src.dir"/>
             </source-roots>
diff --git a/src/org/mxchange/jcoreee/BaseServletSystem.java b/src/org/mxchange/jcoreee/BaseServletSystem.java
new file mode 100644 (file)
index 0000000..10ce7b6
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee;
+
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ * A general shop class
+ * @author Roland Haeder
+ */
+public class BaseServletSystem extends BaseFrameworkSystem {
+}
diff --git a/src/org/mxchange/jcoreee/beans/BaseFrameworkBean.java b/src/org/mxchange/jcoreee/beans/BaseFrameworkBean.java
new file mode 100644 (file)
index 0000000..295adf3
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.beans;
+
+import javax.enterprise.context.Dependent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ * A general bean class. Do not put things in here that are not serializable.
+ * The logger is currently not serializable, so you will get error messages.
+ *
+ * @author Roland Haeder
+ */
+@Dependent
+public abstract class BaseFrameworkBean implements FrameworkBean {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 83258139481372814L;
+
+       /**
+        * Class' logger
+        */
+       private final Logger LOG;
+
+       /**
+        * Initializer
+        */
+       {
+               // Get logger
+               this.LOG = LogManager.getLogger(this);
+       }
+
+       /**
+        * Protected constructor, please don't add init() call here.
+        */
+       protected BaseFrameworkBean () {
+       }
+
+       /**
+        * Getter for logger
+        *
+        * @return Logger
+        */
+       protected Logger getLogger () {
+               return this.LOG;
+       }
+
+       /**
+        * Super initialization method. Do not set @PostConstruct here. If you overwrite this method, please call it
+        * before (!) your own initialization.
+        *
+        * @throws RuntimeException If something unexpected happens
+        */
+       @Override
+       public void init () throws RuntimeException {
+               // Empty for now
+       }
+}
diff --git a/src/org/mxchange/jcoreee/beans/FrameworkBean.java b/src/org/mxchange/jcoreee/beans/FrameworkBean.java
new file mode 100644 (file)
index 0000000..744317e
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.beans;
+
+import java.io.Serializable;
+
+/**
+ * A general bean interface
+ *
+ * @author Roland Haeder
+ */
+public interface FrameworkBean extends Serializable {
+
+       /**
+        * Initializes this bean, mostly done with @PostConstruct
+        *
+        * @throws RuntimeException If something happens, no checked exceptions are allowed
+        */
+       public void init () throws RuntimeException;
+}
diff --git a/src/org/mxchange/jcoreee/filter/servlet/BaseServletFilter.java b/src/org/mxchange/jcoreee/filter/servlet/BaseServletFilter.java
new file mode 100644 (file)
index 0000000..aaf7b69
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.filter.servlet;
+
+import java.text.MessageFormat;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ * A general servlet filter class. If you need to override init() or
+ * destroy() please always call the super method first and handle over all
+ * parameter.
+ *
+ * @author Roland Haeder
+ */
+public abstract class BaseServletFilter extends BaseFrameworkSystem implements Filter {
+       /**
+        * Configuration instance
+        */
+       private FilterConfig config;
+
+       /**
+        * Destroys this filter
+        */
+       @Override
+       public void destroy () {
+               // Unset config instance
+               this.setConfig(null);
+       }
+
+       /**
+        * Initializes this filter
+        *
+        * @param filterConfig Filter configuration
+        * @throws ServletException 
+        */
+       @Override
+       public void init (final FilterConfig filterConfig) throws ServletException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("filterConfig={0} - CALLED!", filterConfig)); //NOI18N
+
+               // Set config instance
+               this.setConfig(filterConfig);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+
+       /**
+        * Configuration instance
+        * @return the config
+        */
+       protected final FilterConfig getConfig () {
+               return this.config;
+       }
+
+       /**
+        * Configuration instance
+        * @param config the config to set
+        */
+       private void setConfig (final FilterConfig config) {
+               this.config = config;
+       }
+}
diff --git a/src/org/mxchange/jcoreee/filter/servlet/utf8/Utf8ServletFilter.java b/src/org/mxchange/jcoreee/filter/servlet/utf8/Utf8ServletFilter.java
new file mode 100644 (file)
index 0000000..9489991
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.filter.servlet.utf8;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import org.mxchange.jcoreee.filter.servlet.BaseServletFilter;
+
+/**
+ * A HTTP filter for setting UTF-8 character encoding.
+ *
+ * @author Roland Haeder
+ */
+public class Utf8ServletFilter extends BaseServletFilter implements Filter {
+       /**
+        * Filter to set UTF-8 encoding
+        *
+        * @param request ServletRequest instance
+        * @param response ServletResponse instance
+        * @param chain FilterChain instance
+        * @throws IOException
+        * @throws ServletException
+        */
+       @Override
+       public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("request={0},response={1},chain={2} - CALLED!", request, response, chain)); //NOI18N
+
+               // Call super method
+               chain.doFilter(request, response);
+
+               // Set response/request both to UTF-8
+               request.setCharacterEncoding("UTF-8"); //NOI18N
+               response.setCharacterEncoding("UTF-8"); //NOI18N
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java b/src/org/mxchange/jcoreee/validator/BaseObjectValidator.java
new file mode 100644 (file)
index 0000000..6630944
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.validator;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.ResourceBundle;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcore.BaseFrameworkSystem;
+import org.mxchange.jcore.FrameworkInterface;
+
+/**
+ * A general object validation class. Please implement javax.faces.validator.Validator
+ * (with import line!) and call preValidate(). You also may want to try out some
+ * other BaseFooValidator classes before directly inheriting from this class.
+ *
+ * @author Roland Haeder
+ */
+public abstract class BaseObjectValidator extends BaseFrameworkSystem implements FrameworkInterface, Validator {
+
+       /**
+        * Needs to be implemented as the Validator interface needs to be implemented.
+        *
+        * @param context
+        * @param component
+        * @param value
+        * @throws ValidatorException 
+        */
+       @Override
+       abstract public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException;
+
+       /**
+        * Initializes resource bundle
+        *
+        * @param FacesContext instance
+        */
+       private void initResourceBundle (final FacesContext context) {
+               // Is it set?
+               if (null == this.getBundle()) {
+                       // Set it now
+                       setBundle(ResourceBundle.getBundle("org.mxchange.localization.bundle", context.getViewRoot().getLocale()));
+               }
+       }
+
+       /**
+        * Pre-validation of value, e.g. not null
+        *
+        * @param context FacesContext instance
+        * @param component UIComponent instance
+        * @param value Value to check
+        * @param requiredFields Array of required field names (ending with)
+        * @throws ValidatorException If something more horrible went wrong
+        */
+       protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
+
+               // Set resource bundle
+               this.initResourceBundle(context);
+
+               // Init message and key
+               FacesMessage facesMessage = null;
+               String errKey = "error.unknown_id"; //NOI18N
+
+               // Get client id
+               String clientId = component.getClientId();
+
+               // Default is no field is valid
+               boolean isValidField = false;
+
+               for (final String field : requiredFields) {
+                       // Get logger
+                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
+
+                       // Is it the same?
+                       if (clientId.endsWith(field)) {
+                               // Is valid field
+                               isValidField = true;
+
+                               // Is it null?
+                               if (null == value) {
+                                       errKey = String.format("error.%s.is_null", field); //NOI18N
+
+                                       // Value it null
+                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
+                               }
+
+                               // Abort here
+                               break;
+                       }
+               }
+
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("isValidField={0}", isValidField)); //NOI18N
+
+               // Valid field?
+               if (!isValidField) {
+                       // Invalid field
+                       facesMessage = new FacesMessage(MessageFormat.format(errKey, clientId));
+               }
+
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
+
+               // Is it not null?
+               if (null != facesMessage) {
+                       throw new ValidatorException(facesMessage);
+               }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jcoreee/validator/bool/BaseBooleanValidator.java b/src/org/mxchange/jcoreee/validator/bool/BaseBooleanValidator.java
new file mode 100644 (file)
index 0000000..b67b5e7
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.validator.bool;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.BaseObjectValidator;
+
+/**
+ * A general boolean value validator.
+ *
+ * @author BalusC
+ * @author Roland Haeder
+ */
+public abstract class BaseBooleanValidator extends BaseObjectValidator implements Validator {
+
+       @Override
+       public void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
+
+               // Pre-validate
+               super.preValidate(context, component, value, requiredFields);
+
+               // Get client id and init message + key
+               String clientId = component.getClientId();
+               FacesMessage facesMessage = null;
+
+               // So far all fine, no check if the field is fine
+               for (final String field : requiredFields) {
+                       // Debug message
+                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
+
+                       // Is it the same?
+                       if (clientId.endsWith(field)) {
+                               // Compare value's type
+                               if (!(value instanceof Boolean)) {
+                                       // Value is not right type
+                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(String.format("error.%s.is_not_boolean", field))); //NOI18N
+                                       break;
+                               }
+
+                               // Cast to string
+                               Boolean bool = (Boolean) value;
+
+                               // Is it false?
+                               if (bool.equals(Boolean.FALSE)) {
+                                       // Default message
+                                       String requiredMessage = ((UIInput) component).getRequiredMessage();
+
+                                       if (null == requiredMessage) {
+                                               Object label = component.getAttributes().get("label"); //NOI18N
+
+                                               // Check if label is null, or zero length
+                                               if ((null == label) || (label instanceof CharSequence && ((CharSequence) label).length() == 0)) {
+                                                       label = component.getValueExpression("label"); //NOI18N
+                                               }
+
+                                               // Label is still null?
+                                               if (null == label) {
+                                                       label = component.getClientId(context);
+                                               }
+
+                                               // Set message
+                                               requiredMessage = MessageFormat.format(UIInput.REQUIRED_MESSAGE_ID, label);
+
+                                               // Set value to false in UI component
+                                               ((ValueHolder) component).setValue(Boolean.FALSE);
+                                       }
+
+                                       // Abort processing here
+                                       facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage);
+                                       break;
+                               }
+                       }
+               }
+
+               // Is facesMessage set?
+               if (facesMessage != null) {
+                       // Abort here
+                       throw new ValidatorException(facesMessage);
+               }
+       }
+}
diff --git a/src/org/mxchange/jcoreee/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java b/src/org/mxchange/jcoreee/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java
new file mode 100644 (file)
index 0000000..9b14869
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.validator.bool.privacy_terms;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.bool.BaseBooleanValidator;
+
+/**
+ * A validator for privacy and terms checkboxes
+ *
+ * @author Roland Haeder
+ */
+public class PrivacyTermsCheckboxValidator extends BaseBooleanValidator implements Validator {
+
+       @Override
+       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+
+               // All accepted, required fields
+               String[] requiredFileds = {"privacy", "terms"}; //NOI18N
+
+               // Pre-validation (e.g. not null, not a string, empty string ...)
+               super.preValidate(context, component, value, requiredFileds);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java b/src/org/mxchange/jcoreee/validator/string/BaseStringValidator.java
new file mode 100644 (file)
index 0000000..c7316a2
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.validator.string;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.BaseObjectValidator;
+
+/**
+ * A general string validation class. You normally want to inherit from this
+ * class for many form fields, e.g. surname, street name, city name and such.
+ *
+ * @author Roland Haeder
+ */
+public abstract class BaseStringValidator extends BaseObjectValidator {
+
+       @Override
+       protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},fields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
+
+               // Pre-validate (e.g. on null)
+               super.preValidate(context, component, value, requiredFields);
+
+               // Get client id and init message + key
+               String clientId = component.getClientId();
+               FacesMessage facesMessage = null;
+               String errKey;
+
+               // So far all fine, no check if the field is fine
+               for (final String field : requiredFields) {
+                       // Debug message
+                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
+
+                       // Is it the same?
+                       if (clientId.endsWith(field)) {
+                               // Compare value's type
+                               if (!(value instanceof String)) {
+                                       // Value is empty
+                                       errKey = String.format("error.%s.is_not_string", field); //NOI18N
+
+                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
+                               }
+
+                               // Cast to string
+                               String str = (String) value;
+
+                               // Is it empty?
+                               if (str.isEmpty()) {
+                                       // Value is empty
+                                       errKey = String.format("error.%s.is_empty", field); //NOI18N
+
+                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
+                               }
+                       }
+               }
+
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
+
+               // Is it not null?
+               if (null != facesMessage) {
+                       throw new ValidatorException(facesMessage);
+               }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jcoreee/validator/string/names/NameValidator.java b/src/org/mxchange/jcoreee/validator/string/names/NameValidator.java
new file mode 100644 (file)
index 0000000..8325169
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.jcoreee.validator.string.names;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+
+/**
+ * A validation class for names, such as first name or family name.
+ *
+ * @author Roland Haeder
+ */
+public class NameValidator extends BaseStringValidator implements Validator {
+       @Override
+       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+
+               // All accepted, required fields
+               String[] requiredFileds = {"firstName", "familyName", "city", "street"}; //NOI18N
+
+               // Pre-validation (e.g. not null, not a string, empty string ...)
+               super.preValidate(context, component, value, requiredFileds);
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+}
diff --git a/src/org/mxchange/jcoreejb/BaseServletSystem.java b/src/org/mxchange/jcoreejb/BaseServletSystem.java
deleted file mode 100644 (file)
index 97a7714..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb;
-
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * A general shop class
- * @author Roland Haeder
- */
-public class BaseServletSystem extends BaseFrameworkSystem {
-}
diff --git a/src/org/mxchange/jcoreejb/beans/BaseFrameworkBean.java b/src/org/mxchange/jcoreejb/beans/BaseFrameworkBean.java
deleted file mode 100644 (file)
index 7facda6..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.beans;
-
-import javax.enterprise.context.Dependent;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-/**
- * A general bean class. Do not put things in here that are not serializable.
- * The logger is currently not serializable, so you will get error messages.
- *
- * @author Roland Haeder
- */
-@Dependent
-public abstract class BaseFrameworkBean implements FrameworkBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 83258139481372814L;
-
-       /**
-        * Class' logger
-        */
-       private final Logger LOG;
-
-       /**
-        * Initializer
-        */
-       {
-               // Get logger
-               this.LOG = LogManager.getLogger(this);
-       }
-
-       /**
-        * Protected constructor, please don't add init() call here.
-        */
-       protected BaseFrameworkBean () {
-       }
-
-       /**
-        * Getter for logger
-        *
-        * @return Logger
-        */
-       protected Logger getLogger () {
-               return this.LOG;
-       }
-
-       /**
-        * Super initialization method. Do not set @PostConstruct here. If you overwrite this method, please call it
-        * before (!) your own initialization.
-        *
-        * @throws RuntimeException If something unexpected happens
-        */
-       @Override
-       public void init () throws RuntimeException {
-               // Empty for now
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/beans/FrameworkBean.java b/src/org/mxchange/jcoreejb/beans/FrameworkBean.java
deleted file mode 100644 (file)
index 37599c1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.beans;
-
-import java.io.Serializable;
-
-/**
- * A general bean interface
- *
- * @author Roland Haeder
- */
-public interface FrameworkBean extends Serializable {
-
-       /**
-        * Initializes this bean, mostly done with @PostConstruct
-        *
-        * @throws RuntimeException If something happens, no checked exceptions are allowed
-        */
-       public void init () throws RuntimeException;
-}
diff --git a/src/org/mxchange/jcoreejb/filter/servlet/BaseServletFilter.java b/src/org/mxchange/jcoreejb/filter/servlet/BaseServletFilter.java
deleted file mode 100644 (file)
index f4e7ddb..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.filter.servlet;
-
-import java.text.MessageFormat;
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * A general servlet filter class. If you need to override init() or
- * destroy() please always call the super method first and handle over all
- * parameter.
- *
- * @author Roland Haeder
- */
-public abstract class BaseServletFilter extends BaseFrameworkSystem implements Filter {
-       /**
-        * Configuration instance
-        */
-       private FilterConfig config;
-
-       /**
-        * Destroys this filter
-        */
-       @Override
-       public void destroy () {
-               // Unset config instance
-               this.setConfig(null);
-       }
-
-       /**
-        * Initializes this filter
-        *
-        * @param filterConfig Filter configuration
-        * @throws ServletException 
-        */
-       @Override
-       public void init (final FilterConfig filterConfig) throws ServletException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("filterConfig={0} - CALLED!", filterConfig)); //NOI18N
-
-               // Set config instance
-               this.setConfig(filterConfig);
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-
-       /**
-        * Configuration instance
-        * @return the config
-        */
-       protected final FilterConfig getConfig () {
-               return this.config;
-       }
-
-       /**
-        * Configuration instance
-        * @param config the config to set
-        */
-       private void setConfig (final FilterConfig config) {
-               this.config = config;
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/filter/servlet/utf8/Utf8ServletFilter.java b/src/org/mxchange/jcoreejb/filter/servlet/utf8/Utf8ServletFilter.java
deleted file mode 100644 (file)
index 29d0cdf..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.filter.servlet.utf8;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import org.mxchange.jcoreejb.filter.servlet.BaseServletFilter;
-
-/**
- * A HTTP filter for setting UTF-8 character encoding.
- *
- * @author Roland Haeder
- */
-public class Utf8ServletFilter extends BaseServletFilter implements Filter {
-       /**
-        * Filter to set UTF-8 encoding
-        *
-        * @param request ServletRequest instance
-        * @param response ServletResponse instance
-        * @param chain FilterChain instance
-        * @throws IOException
-        * @throws ServletException
-        */
-       @Override
-       public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("request={0},response={1},chain={2} - CALLED!", request, response, chain)); //NOI18N
-
-               // Call super method
-               chain.doFilter(request, response);
-
-               // Set response/request both to UTF-8
-               request.setCharacterEncoding("UTF-8"); //NOI18N
-               response.setCharacterEncoding("UTF-8"); //NOI18N
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/validator/BaseObjectValidator.java b/src/org/mxchange/jcoreejb/validator/BaseObjectValidator.java
deleted file mode 100644 (file)
index 6ee76ce..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.validator;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.ResourceBundle;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import org.mxchange.jcore.BaseFrameworkSystem;
-import org.mxchange.jcore.FrameworkInterface;
-
-/**
- * A general object validation class. Please implement javax.faces.validator.Validator
- * (with import line!) and call preValidate(). You also may want to try out some
- * other BaseFooValidator classes before directly inheriting from this class.
- *
- * @author Roland Haeder
- */
-public abstract class BaseObjectValidator extends BaseFrameworkSystem implements FrameworkInterface, Validator {
-
-       /**
-        * Needs to be implemented as the Validator interface needs to be implemented.
-        *
-        * @param context
-        * @param component
-        * @param value
-        * @throws ValidatorException 
-        */
-       @Override
-       abstract public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException;
-
-       /**
-        * Initializes resource bundle
-        *
-        * @param FacesContext instance
-        */
-       private void initResourceBundle (final FacesContext context) {
-               // Is it set?
-               if (null == this.getBundle()) {
-                       // Set it now
-                       setBundle(ResourceBundle.getBundle("org.mxchange.localization.bundle", context.getViewRoot().getLocale()));
-               }
-       }
-
-       /**
-        * Pre-validation of value, e.g. not null
-        *
-        * @param context FacesContext instance
-        * @param component UIComponent instance
-        * @param value Value to check
-        * @param requiredFields Array of required field names (ending with)
-        * @throws ValidatorException If something more horrible went wrong
-        */
-       protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
-
-               // Set resource bundle
-               this.initResourceBundle(context);
-
-               // Init message and key
-               FacesMessage facesMessage = null;
-               String errKey = "error.unknown_id"; //NOI18N
-
-               // Get client id
-               String clientId = component.getClientId();
-
-               // Default is no field is valid
-               boolean isValidField = false;
-
-               for (final String field : requiredFields) {
-                       // Get logger
-                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
-
-                       // Is it the same?
-                       if (clientId.endsWith(field)) {
-                               // Is valid field
-                               isValidField = true;
-
-                               // Is it null?
-                               if (null == value) {
-                                       errKey = String.format("error.%s.is_null", field); //NOI18N
-
-                                       // Value it null
-                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
-                               }
-
-                               // Abort here
-                               break;
-                       }
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("isValidField={0}", isValidField)); //NOI18N
-
-               // Valid field?
-               if (!isValidField) {
-                       // Invalid field
-                       facesMessage = new FacesMessage(MessageFormat.format(errKey, clientId));
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
-
-               // Is it not null?
-               if (null != facesMessage) {
-                       throw new ValidatorException(facesMessage);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/validator/bool/BaseBooleanValidator.java b/src/org/mxchange/jcoreejb/validator/bool/BaseBooleanValidator.java
deleted file mode 100644 (file)
index 12ba522..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.validator.bool;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.ValueHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import org.mxchange.jcoreejb.validator.BaseObjectValidator;
-
-/**
- * A general boolean value validator.
- *
- * @author BalusC
- * @author Roland Haeder
- */
-public abstract class BaseBooleanValidator extends BaseObjectValidator implements Validator {
-
-       @Override
-       public void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},requiredFields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
-
-               // Pre-validate
-               super.preValidate(context, component, value, requiredFields);
-
-               // Get client id and init message + key
-               String clientId = component.getClientId();
-               FacesMessage facesMessage = null;
-
-               // So far all fine, no check if the field is fine
-               for (final String field : requiredFields) {
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
-
-                       // Is it the same?
-                       if (clientId.endsWith(field)) {
-                               // Compare value's type
-                               if (!(value instanceof Boolean)) {
-                                       // Value is not right type
-                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(String.format("error.%s.is_not_boolean", field))); //NOI18N
-                                       break;
-                               }
-
-                               // Cast to string
-                               Boolean bool = (Boolean) value;
-
-                               // Is it false?
-                               if (bool.equals(Boolean.FALSE)) {
-                                       // Default message
-                                       String requiredMessage = ((UIInput) component).getRequiredMessage();
-
-                                       if (null == requiredMessage) {
-                                               Object label = component.getAttributes().get("label"); //NOI18N
-
-                                               // Check if label is null, or zero length
-                                               if ((null == label) || (label instanceof CharSequence && ((CharSequence) label).length() == 0)) {
-                                                       label = component.getValueExpression("label"); //NOI18N
-                                               }
-
-                                               // Label is still null?
-                                               if (null == label) {
-                                                       label = component.getClientId(context);
-                                               }
-
-                                               // Set message
-                                               requiredMessage = MessageFormat.format(UIInput.REQUIRED_MESSAGE_ID, label);
-
-                                               // Set value to false in UI component
-                                               ((ValueHolder) component).setValue(Boolean.FALSE);
-                                       }
-
-                                       // Abort processing here
-                                       facesMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR, requiredMessage, requiredMessage);
-                                       break;
-                               }
-                       }
-               }
-
-               // Is facesMessage set?
-               if (facesMessage != null) {
-                       // Abort here
-                       throw new ValidatorException(facesMessage);
-               }
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java b/src/org/mxchange/jcoreejb/validator/bool/privacy_terms/PrivacyTermsCheckboxValidator.java
deleted file mode 100644 (file)
index 7e55306..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.validator.bool.privacy_terms;
-
-import java.text.MessageFormat;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import org.mxchange.jcoreejb.validator.bool.BaseBooleanValidator;
-
-/**
- * A validator for privacy and terms checkboxes
- *
- * @author Roland Haeder
- */
-public class PrivacyTermsCheckboxValidator extends BaseBooleanValidator implements Validator {
-
-       @Override
-       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
-               // All accepted, required fields
-               String[] requiredFileds = {"privacy", "terms"}; //NOI18N
-
-               // Pre-validation (e.g. not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFileds);
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/validator/string/BaseStringValidator.java b/src/org/mxchange/jcoreejb/validator/string/BaseStringValidator.java
deleted file mode 100644 (file)
index 4f96521..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.validator.string;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-import org.mxchange.jcoreejb.validator.BaseObjectValidator;
-
-/**
- * A general string validation class. You normally want to inherit from this
- * class for many form fields, e.g. surname, street name, city name and such.
- *
- * @author Roland Haeder
- */
-public abstract class BaseStringValidator extends BaseObjectValidator {
-
-       @Override
-       protected void preValidate (final FacesContext context, final UIComponent component, final Object value, final String[] requiredFields) throws ValidatorException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2},fields={3} - CALLED!", context, component, value, Arrays.toString(requiredFields))); //NOI18N
-
-               // Pre-validate (e.g. on null)
-               super.preValidate(context, component, value, requiredFields);
-
-               // Get client id and init message + key
-               String clientId = component.getClientId();
-               FacesMessage facesMessage = null;
-               String errKey;
-
-               // So far all fine, no check if the field is fine
-               for (final String field : requiredFields) {
-                       // Debug message
-                       this.getLogger().debug(MessageFormat.format("field={0},clientId={1}", field, clientId)); //NOI18N
-
-                       // Is it the same?
-                       if (clientId.endsWith(field)) {
-                               // Compare value's type
-                               if (!(value instanceof String)) {
-                                       // Value is empty
-                                       errKey = String.format("error.%s.is_not_string", field); //NOI18N
-
-                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
-                               }
-
-                               // Cast to string
-                               String str = (String) value;
-
-                               // Is it empty?
-                               if (str.isEmpty()) {
-                                       // Value is empty
-                                       errKey = String.format("error.%s.is_empty", field); //NOI18N
-
-                                       facesMessage = new FacesMessage(this.getMessageStringFromKey(errKey));
-                               }
-                       }
-               }
-
-               // Debug message
-               this.getLogger().debug(MessageFormat.format("facesMessage={0}", facesMessage)); //NOI18N
-
-               // Is it not null?
-               if (null != facesMessage) {
-                       throw new ValidatorException(facesMessage);
-               }
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}
diff --git a/src/org/mxchange/jcoreejb/validator/string/names/NameValidator.java b/src/org/mxchange/jcoreejb/validator/string/names/NameValidator.java
deleted file mode 100644 (file)
index 7ef0c65..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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.jcoreejb.validator.string.names;
-
-import java.text.MessageFormat;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import org.mxchange.jcoreejb.validator.string.BaseStringValidator;
-
-/**
- * A validation class for names, such as first name or family name.
- *
- * @author Roland Haeder
- */
-public class NameValidator extends BaseStringValidator implements Validator {
-       @Override
-       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
-               // All accepted, required fields
-               String[] requiredFileds = {"firstName", "familyName", "city", "street"}; //NOI18N
-
-               // Pre-validation (e.g. not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFileds);
-
-               // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
-       }
-}