<!-- 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"/>
<!--
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>
#!/bin/sh
-NAME="jcore-ejb"
+NAME="jcoreee"
LIST=`find ../*/lib/${NAME}.jar`
LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`"
- 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>
</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."/>
<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"/>
<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}"/>
<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}"/>
-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
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
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=
<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>
--- /dev/null
+/*
+ * 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 {
+}
--- /dev/null
+/*
+ * 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
+ }
+}
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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
+ }
+}
--- /dev/null
+/*
+ * 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
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+ }
+}
--- /dev/null
+/*
+ * 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
+ }
+}
--- /dev/null
+/*
+ * 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
+ }
+}
+++ /dev/null
-/*
- * 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 {
-}
+++ /dev/null
-/*
- * 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
- }
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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
- }
-}
+++ /dev/null
-/*
- * 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
- }
-}
+++ /dev/null
-/*
- * 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);
- }
- }
-}
+++ /dev/null
-/*
- * 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
- }
-}
+++ /dev/null
-/*
- * 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
- }
-}
+++ /dev/null
-/*
- * 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
- }
-}