From: Roland Haeder Date: Wed, 25 May 2016 17:24:50 +0000 (+0200) Subject: added from lib project as these validators don't belong there (remote interfaces... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5d8277554baba6b6ee5f97d9d04e8e454a06fda3;p=jjobs-war.git added from lib project as these validators don't belong there (remote interfaces) but better here (WAR/JSF project). Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java index 1e967993..52a48605 100644 --- a/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java @@ -94,7 +94,7 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple Context context = new InitialContext(); // Try to lookup - this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jlandingpage-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N + this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N } catch (final NamingException e) { // Throw again throw new FaceletException(e); diff --git a/src/java/org/mxchange/jjobs/validator/birthday/JobsBirthdayValidator.java b/src/java/org/mxchange/jjobs/validator/birthday/JobsBirthdayValidator.java new file mode 100644 index 00000000..ab0c9989 --- /dev/null +++ b/src/java/org/mxchange/jjobs/validator/birthday/JobsBirthdayValidator.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2016 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 . + */ +package org.mxchange.jjobs.validator.birthday; + +import java.text.MessageFormat; +import java.util.Date; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcoreee.validator.date.BaseDateValidator; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; +import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; + +/** + * A birthday validator + *

+ * @author Roland Haeder + */ +@FacesValidator("BirthdayValidator") +public class JobsBirthdayValidator extends BaseDateValidator implements Validator { + + /** + * Serial number + */ + private static final long serialVersionUID = 28_735_756_819_460L; + + /** + * Logger bean + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + + /** + * Default constructor + */ + public JobsBirthdayValidator () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + + @Override + public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { + // Trace message + this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N + + // All accepted, required fields + String[] requiredFields = {"birthday", "contactBirthday"}; //NOI18N + + // Pre-validation (example: not null, not a string, empty string ...) + super.preValidate(context, component, value, requiredFields, false); + + // Cast value + Date birthday = (Date) value; + + // @TODO Finish this, e.g. load maximum,minimum birthday from properties file + + // Trace message + this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N + } + +} diff --git a/src/java/org/mxchange/jjobs/validator/birthday/PizzaBirthdayValidator.java b/src/java/org/mxchange/jjobs/validator/birthday/PizzaBirthdayValidator.java deleted file mode 100644 index 159c904a..00000000 --- a/src/java/org/mxchange/jjobs/validator/birthday/PizzaBirthdayValidator.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2016 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 . - */ -package org.mxchange.jjobs.validator.birthday; - -import java.text.MessageFormat; -import java.util.Date; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jcoreee.validator.date.BaseDateValidator; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; - -/** - * A birthday validator - *

- * @author Roland Haeder - */ -@FacesValidator("BirthdayValidator") -public class PizzaBirthdayValidator extends BaseDateValidator implements Validator { - - /** - * Serial number - */ - private static final long serialVersionUID = 28_735_756_819_460L; - - /** - * Logger bean - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Default constructor - */ - public PizzaBirthdayValidator () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - @Override - public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { - // Trace message - this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N - - // All accepted, required fields - String[] requiredFields = {"birthday", "contactBirthday"}; //NOI18N - - // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); - - // Cast value - Date birthday = (Date) value; - - // @TODO Finish this, e.g. load maximum,minimum birthday from properties file - - // Trace message - this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N - } - -}