From: Roland Häder Date: Mon, 17 Jul 2017 15:23:56 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c26888296f2a571d4c265e40816222b95e78582b;p=jfinancials-war.git Please cherry-pick: - renamed feature 'user_name_required' to 'user_login_requires_user_name' to make it more clear Signed-off-by: Roland Häder --- diff --git a/nbproject/project.properties b/nbproject/project.properties index 16d12937..46bff0be 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,154 +1,154 @@ -annotation.processing.enabled=true -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 -auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= -auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false -auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css -auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= -auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false -auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css -auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets -auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs -build.classes.dir=${build.web.dir}/WEB-INF/classes -build.classes.excludes=**/*.java,**/*.form -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -build.web.dir=${build.dir}/web -build.web.excludes=${build.classes.excludes} -client.urlPart= -compile.jsps=false -conf.dir=${source.root}/conf -debug.classpath=${build.classes.dir}:${javac.classpath} -debug.test.classpath=\ - ${run.test.classpath} -display.browser=true -# Files to be excluded from distribution war -dist.archive.excludes= -dist.dir=dist -dist.ear.war=${dist.dir}/${war.ear.name} -dist.javadoc.dir=${dist.dir}/javadoc -dist.war=${dist.dir}/${war.name} -endorsed.classpath= -excludes= -file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar -file.reference.cdi-api.jar=lib/cdi-api.jar -file.reference.gf-client.jar=lib/gf-client.jar -file.reference.jcontacts-business-lib.jar=lib/jcontacts-business-lib.jar -file.reference.jcontacts-core.jar=lib/jcontacts-core.jar -file.reference.jcontacts-lib.jar=lib/jcontacts-lib.jar -file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar -file.reference.jcoreee.jar=lib/jcoreee.jar -file.reference.jcountry-core.jar=lib/jcountry-core.jar -file.reference.jcountry-lib.jar=lib/jcountry-lib.jar -file.reference.jphone-core.jar=lib/jphone-core.jar -file.reference.jphone-lib.jar=lib/jphone-lib.jar -file.reference.jproduct-core.jar=lib/jproduct-core.jar -file.reference.juser-core.jar=lib/juser-core.jar -file.reference.juser-lib.jar=lib/juser-lib.jar -file.reference.juser-login-core.jar=lib/juser-login-core.jar -file.reference.juser-login-lib.jar=lib/juser-login-lib.jar -includes=** -j2ee.compile.on.save=true -j2ee.copy.static.files.on.save=true -j2ee.deploy.on.save=true -j2ee.platform=1.7-web -j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar -j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar -j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar -j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar -j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar -j2ee.platform.wsit.classpath= -j2ee.server.type=gfv3ee6 -jar.compress=false -javac.classpath=\ - ${file.reference.jcoreee.jar}:\ - ${file.reference.jcore-logger-lib.jar}:\ - ${file.reference.jcountry-core.jar}:\ - ${file.reference.jcountry-lib.jar}:\ - ${file.reference.jcontacts-core.jar}:\ - ${file.reference.jcontacts-business-core.jar}:\ - ${file.reference.jcontacts-business-lib.jar}:\ - ${file.reference.jproduct-core.jar}:\ - ${file.reference.jcontacts-lib.jar}:\ - ${file.reference.jphone-core.jar}:\ - ${file.reference.jphone-lib.jar}:\ - ${file.reference.juser-core.jar}:\ - ${file.reference.juser-lib.jar}:\ - ${file.reference.juser-login-core.jar}:\ - ${file.reference.juser-login-lib.jar}:\ - ${reference.jfinancials-core.jar}:\ - ${reference.jfinancials-lib.jar}:\ - ${file.reference.cdi-api.jar}:\ - ${file.reference.gf-client.jar}:\ - ${libs.Apache_POI_3.15.classpath}:\ - ${libs.primefaces.classpath} -# Space-separated list of extra javac options -javac.compilerargs=-Xlint:unchecked -Xlint:deprecation -javac.debug=true -javac.deprecation=true -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=true -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.preview=true -javadoc.private=true -javadoc.reference.cdi-api.jar=https://docs.oracle.com/javaee/7/api/ -javadoc.splitindex=true -javadoc.use=true -javadoc.version=true -javadoc.windowtitle=JFinancials Web Application -lib.dir=${web.docbase.dir}/WEB-INF/lib -persistence.xml.dir=${conf.dir} -platform.active=default_platform -project.jfinancials-core=../../NetBeansProjects/jfinancials-core -project.jfinancials-lib=../jfinancials-lib -project.license=agpl30 -reference.jfinancials-core.jar=${project.jfinancials-core}/dist/jfinancials-core.jar -reference.jfinancials-lib.jar=${project.jfinancials-lib}/dist/jfinancials-lib.jar -resource.dir=setup -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -# Space-separated list of JVM arguments used when running a class with a main method or a unit test -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): -runmain.jvmargs= -source.encoding=UTF-8 -source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ -source.reference.jcontacts-business-lib.jar=../jcontacts-business-lib/src/ -source.reference.jcontacts-core.jar=../jcontacts-core/src/ -source.reference.jcontacts-lib.jar=../jcontacts-lib/src/ -source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ -source.reference.jcoreee.jar=../jcoreee/src/ -source.reference.jcountry-core.jar=../jcountry-core/src/ -source.reference.jcountry-lib.jar=../jcountry-lib/src/ -source.reference.jphone-core.jar=../jphone-core/src/ -source.reference.jphone-lib.jar=../jphone-lib/src/ -source.reference.jproduct-core.jar=../jproduct-core/src/ -source.reference.juser-core.jar=../juser-core/src/ -source.reference.juser-lib.jar=../juser-lib/src/ -source.reference.juser-login-core.jar=../juser-login-core/src/ -source.reference.juser-login-lib.jar=../juser-login-lib/src/ -source.root=src -src.dir=${source.root}/java -test.src.dir=test -war.content.additional= -war.ear.name=${war.name} -war.name=jfinancials-war.war -web.docbase.dir=web -webinf.dir=web/WEB-INF +annotation.processing.enabled=true +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 +auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css +auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets +auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath= +excludes= +file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar +file.reference.cdi-api.jar=lib/cdi-api.jar +file.reference.gf-client.jar=lib/gf-client.jar +file.reference.jcontacts-business-lib.jar=lib/jcontacts-business-lib.jar +file.reference.jcontacts-core.jar=lib/jcontacts-core.jar +file.reference.jcontacts-lib.jar=lib/jcontacts-lib.jar +file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar +file.reference.jcoreee.jar=lib/jcoreee.jar +file.reference.jcountry-core.jar=lib/jcountry-core.jar +file.reference.jcountry-lib.jar=lib/jcountry-lib.jar +file.reference.jphone-core.jar=lib/jphone-core.jar +file.reference.jphone-lib.jar=lib/jphone-lib.jar +file.reference.jproduct-core.jar=lib/jproduct-core.jar +file.reference.juser-core.jar=lib/juser-core.jar +file.reference.juser-lib.jar=lib/juser-lib.jar +file.reference.juser-login-core.jar=lib/juser-login-core.jar +file.reference.juser-login-lib.jar=lib/juser-login-lib.jar +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7-web +j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/cdi-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv3ee6 +jar.compress=false +javac.classpath=\ + ${file.reference.jcoreee.jar}:\ + ${file.reference.jcore-logger-lib.jar}:\ + ${file.reference.jcountry-core.jar}:\ + ${file.reference.jcountry-lib.jar}:\ + ${file.reference.jcontacts-core.jar}:\ + ${file.reference.jcontacts-business-core.jar}:\ + ${file.reference.jcontacts-business-lib.jar}:\ + ${file.reference.jproduct-core.jar}:\ + ${file.reference.jcontacts-lib.jar}:\ + ${file.reference.jphone-core.jar}:\ + ${file.reference.jphone-lib.jar}:\ + ${file.reference.juser-core.jar}:\ + ${file.reference.juser-lib.jar}:\ + ${file.reference.juser-login-core.jar}:\ + ${file.reference.juser-login-lib.jar}:\ + ${reference.jfinancials-core.jar}:\ + ${reference.jfinancials-lib.jar}:\ + ${file.reference.cdi-api.jar}:\ + ${file.reference.gf-client.jar}:\ + ${libs.Apache_POI_3.15.classpath}:\ + ${libs.primefaces.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.debug=true +javac.deprecation=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=true +javadoc.reference.cdi-api.jar=https://docs.oracle.com/javaee/7/api/ +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=JFinancials Web Application +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +project.jfinancials-core=../../NetBeansProjects/jfinancials-core +project.jfinancials-lib=../jfinancials-lib +project.license=agpl30 +reference.jfinancials-core.jar=${project.jfinancials-core}/dist/jfinancials-core.jar +reference.jfinancials-lib.jar=${project.jfinancials-lib}/dist/jfinancials-lib.jar +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ +source.reference.jcontacts-business-lib.jar=../jcontacts-business-lib/src/ +source.reference.jcontacts-core.jar=../jcontacts-core/src/ +source.reference.jcontacts-lib.jar=../jcontacts-lib/src/ +source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ +source.reference.jcoreee.jar=../jcoreee/src/ +source.reference.jcountry-core.jar=../jcountry-core/src/ +source.reference.jcountry-lib.jar=../jcountry-lib/src/ +source.reference.jphone-core.jar=../jphone-core/src/ +source.reference.jphone-lib.jar=../jphone-lib/src/ +source.reference.jproduct-core.jar=../jproduct-core/src/ +source.reference.juser-core.jar=../juser-core/src/ +source.reference.juser-lib.jar=../juser-lib/src/ +source.reference.juser-login-core.jar=../juser-login-core/src/ +source.reference.juser-login-lib.jar=../juser-login-lib/src/ +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=jfinancials-war.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java index 4bdd8372..d2c47602 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java @@ -1,405 +1,405 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder GmbH - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jfinancials.beans.helper; - -import java.text.MessageFormat; -import javax.enterprise.context.RequestScoped; -import javax.inject.Inject; -import javax.inject.Named; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; -import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController; -import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jusercore.model.user.User; - -/** - * A general helper for beans - *

- * @author Roland Häder - */ -@Named ("beanHelper") -@RequestScoped -public class FinancialsWebRequestHelperBean implements FinancialsWebRequestHelperController { - - /** - * Call-stack instance (5 may show BeanELResolver.getValue as caller) - */ - private static final short THREAD_STACK = 5; - - /** - * Serial number - */ - private static final long serialVersionUID = 17_258_793_567_145_701L; - - /** - * Administrative contact controller - */ - @Inject - private FinancialsAdminContactWebRequestController adminContactController; - - /** - * Administrative phone controller - */ - @Inject - private FinancialsAdminPhoneWebRequestController adminPhoneController; - - /** - * Administrative user controller - */ - @Inject - private FinancialsAdminUserWebRequestController adminUserController; - - /** - * Contact instance - */ - private Contact contact; - - /** - * Fax number - */ - private DialableFaxNumber faxNumber; - - /** - * Land-line number - */ - private DialableLandLineNumber landLineNumber; - - /** - * Mobile number - */ - private DialableMobileNumber mobileNumber; - - /** - * User instance - */ - private User user; - - /** - * Regular user controller - */ - @Inject - private FinancialsUserWebSessionController userController; - - /** - * Default constructor - */ - public FinancialsWebRequestHelperBean () { - // Call super constructor - super(); - - // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName()); - // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller)); - } - - @Override - public void copyContactToController () { - // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); - // System.out.println(MessageFormat.format("{0}.copyContactToController: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); - - // Validate contact instance - if (this.getContact() == null) { - // Throw NPE - throw new NullPointerException("this.contact is null"); //NOI18N - } else if (this.getContact().getContactId() == null) { - // Throw NPE again - throw new NullPointerException("this.contact.contactId is null"); //NOI18N - } else if (this.getContact().getContactId() < 1) { - // Not valid - throw new IllegalStateException(MessageFormat.format("this.contact.contactId={0} is not valid.", this.getContact().getContactId())); //NOI18N - } - - // Set all phone instances - this.setPhoneInstances(this.getContact()); - - // Set all fields: user - this.adminContactController.copyContactToController(this.getContact()); - } - - @Override - public void copyFaxNumberToController () { - // Validate fax instance - if (this.getFaxNumber() == null) { - // Throw NPE - throw new NullPointerException("this.faxNumber is null"); - } else if (this.getFaxNumber().getPhoneId() == null) { - // Throw again - throw new NullPointerException("this.faxNumber.phoneId is null"); - } else if (this.getFaxNumber().getPhoneId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneId={0} is not valid", this.getFaxNumber().getPhoneId())); - } else if (this.getFaxNumber().getPhoneAreaCode() == null) { - // Throw again - throw new NullPointerException("this.faxNumber.phoneAreaCode is null"); - } else if (this.getFaxNumber().getPhoneAreaCode() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode())); - } else if (this.getFaxNumber().getPhoneCountry() == null) { - // Throw NPE again - throw new NullPointerException("this.faxNumber.phoneCountry is null"); - } else if (this.getFaxNumber().getPhoneCountry().getCountryId() == null) { - // ... throw again - throw new NullPointerException("this.faxNumber.phoneCountry.countryId is null"); - } else if (this.getFaxNumber().getPhoneCountry().getCountryId() < 1) { - // Invalid id - throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneCountry.countryId={0} is invalid", this.getFaxNumber().getPhoneCountry().getCountryId())); - } else if (this.getFaxNumber().getPhoneNumber() == null) { - // Throw NPE again ... - throw new NullPointerException("this.faxNumber.phoneNumber is null"); - } else if (this.getFaxNumber().getPhoneNumber() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneNumber={0} is not valid", this.getFaxNumber().getPhoneNumber())); - } - - // Copy all (changeable) data fields to admin controller - this.adminPhoneController.setPhoneAreaCode(this.getFaxNumber().getPhoneAreaCode()); - this.adminPhoneController.setPhoneCountry(this.getFaxNumber().getPhoneCountry()); - this.adminPhoneController.setPhoneNumber(this.getFaxNumber().getPhoneNumber()); - } - - @Override - public void copyLandLineNumberToController () { - // Validate land-line instance - if (this.getLandLineNumber() == null) { - // Throw NPE - throw new NullPointerException("this.landLineNumber is null"); - } else if (this.getLandLineNumber().getPhoneId() == null) { - // Throw again - throw new NullPointerException("this.landLineNumber.phoneId is null"); - } else if (this.getLandLineNumber().getPhoneId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneId={0} is not valid", this.getLandLineNumber().getPhoneId())); - } else if (this.getLandLineNumber().getPhoneAreaCode() == null) { - // Throw again - throw new NullPointerException("this.landLineNumber.phoneAreaCode is null"); - } else if (this.getLandLineNumber().getPhoneAreaCode() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode())); - } else if (this.getLandLineNumber().getPhoneCountry() == null) { - // Throw NPE again - throw new NullPointerException("this.landLineNumber.phoneCountry is null"); - } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() == null) { - // ... throw again - throw new NullPointerException("this.landLineNumber.phoneCountry.countryId is null"); - } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() < 1) { - // Invalid id - throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneCountry.countryId={0} is invalid", this.getLandLineNumber().getPhoneCountry().getCountryId())); - } else if (this.getLandLineNumber().getPhoneNumber() == null) { - // Throw NPE again ... - throw new NullPointerException("this.landLineNumber.phoneNumber is null"); - } else if (this.getLandLineNumber().getPhoneNumber() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneNumber={0} is not valid", this.getLandLineNumber().getPhoneNumber())); - } - - // Copy all (changeable) data fields to admin controller - this.adminPhoneController.setPhoneAreaCode(this.getLandLineNumber().getPhoneAreaCode()); - this.adminPhoneController.setPhoneCountry(this.getLandLineNumber().getPhoneCountry()); - this.adminPhoneController.setPhoneNumber(this.getLandLineNumber().getPhoneNumber()); - } - - @Override - public void copyMobileNumberToController () { - // Validate mobile instance - if (this.getMobileNumber() == null) { - // Throw NPE - throw new NullPointerException("this.mobileNumber is null"); - } else if (this.getMobileNumber().getPhoneId() == null) { - // Throw again - throw new NullPointerException("this.mobileNumber.phoneId is null"); - } else if (this.getMobileNumber().getPhoneId() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneId={0} is not valid", this.getMobileNumber().getPhoneId())); - } else if (this.getMobileNumber().getMobileProvider() == null) { - // Throw NPE again - throw new NullPointerException("this.mobileNumber.mobileProvider is null"); - } else if (this.getMobileNumber().getMobileProvider().getProviderId() == null) { - // ... throw again - throw new NullPointerException("this.mobileNumber.mobileProvider.providerId is null"); - } else if (this.getMobileNumber().getMobileProvider().getProviderId() < 1) { - // Invalid id - throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileProvider.providerId={0} is invalid", this.getMobileNumber().getMobileProvider().getProviderId())); - } else if (this.getMobileNumber().getPhoneNumber() == null) { - // Throw NPE again ... - throw new NullPointerException("this.mobileNumber.phoneNumber is null"); - } else if (this.getMobileNumber().getPhoneNumber() < 1) { - // Invalid id number - throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneNumber={0} is not valid", this.getMobileNumber().getPhoneNumber())); - } - - // Copy all (changeable) data fields to admin controller - this.adminPhoneController.setMobileProvider(this.getMobileNumber().getMobileProvider()); - this.adminPhoneController.setPhoneNumber(this.getMobileNumber().getPhoneNumber()); - } - - @Override - public void copyUserToController () { - // Log message - //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N - - // Validate user instance - if (this.getUser() == null) { - // Throw NPE - throw new NullPointerException("this.user is null"); //NOI18N - } else if (this.getUser().getUserId() == null) { - // Throw NPE again - throw new NullPointerException("this.user.userId is null"); //NOI18N - } else if (this.getUser().getUserId() < 1) { - // Not valid - throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId())); //NOI18N - } - - // Get contact - Contact userContact = this.getUser().getUserContact(); - - // Set contact here, too. This avoids parameters that cannot auto-complete in IDEs. - this.setContact(userContact); - - // Set all phone instances - this.setPhoneInstances(userContact); - - // Set all fields: user - this.userController.setUserName(this.getUser().getUserName()); - this.adminUserController.setUserName(this.getUser().getUserName()); - } - - @Override - public Contact getContact () { - // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); - // System.out.println(MessageFormat.format("{0}: Returning this.contact={1}, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); - return this.contact; - } - - @Override - public void setContact (final Contact contact) { - // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); - // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller)); - this.contact = contact; - } - - @Override - public String getContactUsageMessageKey (final Contact contact) { - // The contact must be valid - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Throw again ... - throw new NullPointerException("contact.contactId is null"); //NOI18N - } else if (contact.getContactId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N - } - - // Default key is "unused" - String messageKey = "CONTACT_IS_UNUSED"; //NOI18N - - // Check user contact - boolean isUserContact = this.userController.isContactFound(contact); - - // Check user first - if (isUserContact) { - // Only user - messageKey = "CONTACT_IS_USER"; //NOI18N - } - - // Return message key - return messageKey; - } - - @Override - public DialableFaxNumber getFaxNumber () { - return this.faxNumber; - } - - @Override - public void setFaxNumber (final DialableFaxNumber faxNumber) { - this.faxNumber = faxNumber; - } - - @Override - public DialableLandLineNumber getLandLineNumber () { - return this.landLineNumber; - } - - @Override - public void setLandLineNumber (final DialableLandLineNumber landLineNumber) { - this.landLineNumber = landLineNumber; - } - - @Override - public DialableMobileNumber getMobileNumber () { - return this.mobileNumber; - } - - @Override - public void setMobileNumber (final DialableMobileNumber mobileNumber) { - this.mobileNumber = mobileNumber; - } - - @Override - public User getUser () { - return this.user; - } - - @Override - public void setUser (final User user) { - this.user = user; - } - - /** - * Set's all given contact's phone instances: land-line, mobile and - * faxNumber - *

- * @param contact Contact to set phone instances for - */ - private void setPhoneInstances (final Contact contact) { - // The contact must be valid - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Throw again ... - throw new NullPointerException("contact.contactId is null"); //NOI18N - } else if (contact.getContactId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N - } - - // Is mobile set? - if (contact.getContactMobileNumber() instanceof DialableMobileNumber) { - // Yes, then set it in admin controller - this.setMobileNumber(contact.getContactMobileNumber()); - } - - // Is land-line set? - if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) { - // Yes, then set it in admin controller - this.setLandLineNumber(contact.getContactLandLineNumber()); - } - - // Is faxNumber set? - if (contact.getContactFaxNumber() instanceof DialableFaxNumber) { - // Yes, then set it in admin controller - this.setFaxNumber(contact.getContactFaxNumber()); - } - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.beans.helper; + +import java.text.MessageFormat; +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; +import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController; +import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jusercore.model.user.User; + +/** + * A general helper for beans + *

+ * @author Roland Häder + */ +@Named ("beanHelper") +@RequestScoped +public class FinancialsWebRequestHelperBean implements FinancialsWebRequestHelperController { + + /** + * Call-stack instance (5 may show BeanELResolver.getValue as caller) + */ + private static final short THREAD_STACK = 5; + + /** + * Serial number + */ + private static final long serialVersionUID = 17_258_793_567_145_701L; + + /** + * Administrative contact controller + */ + @Inject + private FinancialsAdminContactWebRequestController adminContactController; + + /** + * Administrative phone controller + */ + @Inject + private FinancialsAdminPhoneWebRequestController adminPhoneController; + + /** + * Administrative user controller + */ + @Inject + private FinancialsAdminUserWebRequestController adminUserController; + + /** + * Contact instance + */ + private Contact contact; + + /** + * Fax number + */ + private DialableFaxNumber faxNumber; + + /** + * Land-line number + */ + private DialableLandLineNumber landLineNumber; + + /** + * Mobile number + */ + private DialableMobileNumber mobileNumber; + + /** + * User instance + */ + private User user; + + /** + * Regular user controller + */ + @Inject + private FinancialsUserWebSessionController userController; + + /** + * Default constructor + */ + public FinancialsWebRequestHelperBean () { + // Call super constructor + super(); + + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName()); + // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller)); + } + + @Override + public void copyContactToController () { + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); + // System.out.println(MessageFormat.format("{0}.copyContactToController: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); + + // Validate contact instance + if (this.getContact() == null) { + // Throw NPE + throw new NullPointerException("this.contact is null"); //NOI18N + } else if (this.getContact().getContactId() == null) { + // Throw NPE again + throw new NullPointerException("this.contact.contactId is null"); //NOI18N + } else if (this.getContact().getContactId() < 1) { + // Not valid + throw new IllegalStateException(MessageFormat.format("this.contact.contactId={0} is not valid.", this.getContact().getContactId())); //NOI18N + } + + // Set all phone instances + this.setPhoneInstances(this.getContact()); + + // Set all fields: user + this.adminContactController.copyContactToController(this.getContact()); + } + + @Override + public void copyFaxNumberToController () { + // Validate fax instance + if (this.getFaxNumber() == null) { + // Throw NPE + throw new NullPointerException("this.faxNumber is null"); + } else if (this.getFaxNumber().getPhoneId() == null) { + // Throw again + throw new NullPointerException("this.faxNumber.phoneId is null"); + } else if (this.getFaxNumber().getPhoneId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneId={0} is not valid", this.getFaxNumber().getPhoneId())); + } else if (this.getFaxNumber().getPhoneAreaCode() == null) { + // Throw again + throw new NullPointerException("this.faxNumber.phoneAreaCode is null"); + } else if (this.getFaxNumber().getPhoneAreaCode() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode())); + } else if (this.getFaxNumber().getPhoneCountry() == null) { + // Throw NPE again + throw new NullPointerException("this.faxNumber.phoneCountry is null"); + } else if (this.getFaxNumber().getPhoneCountry().getCountryId() == null) { + // ... throw again + throw new NullPointerException("this.faxNumber.phoneCountry.countryId is null"); + } else if (this.getFaxNumber().getPhoneCountry().getCountryId() < 1) { + // Invalid id + throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneCountry.countryId={0} is invalid", this.getFaxNumber().getPhoneCountry().getCountryId())); + } else if (this.getFaxNumber().getPhoneNumber() == null) { + // Throw NPE again ... + throw new NullPointerException("this.faxNumber.phoneNumber is null"); + } else if (this.getFaxNumber().getPhoneNumber() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneNumber={0} is not valid", this.getFaxNumber().getPhoneNumber())); + } + + // Copy all (changeable) data fields to admin controller + this.adminPhoneController.setPhoneAreaCode(this.getFaxNumber().getPhoneAreaCode()); + this.adminPhoneController.setPhoneCountry(this.getFaxNumber().getPhoneCountry()); + this.adminPhoneController.setPhoneNumber(this.getFaxNumber().getPhoneNumber()); + } + + @Override + public void copyLandLineNumberToController () { + // Validate land-line instance + if (this.getLandLineNumber() == null) { + // Throw NPE + throw new NullPointerException("this.landLineNumber is null"); + } else if (this.getLandLineNumber().getPhoneId() == null) { + // Throw again + throw new NullPointerException("this.landLineNumber.phoneId is null"); + } else if (this.getLandLineNumber().getPhoneId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneId={0} is not valid", this.getLandLineNumber().getPhoneId())); + } else if (this.getLandLineNumber().getPhoneAreaCode() == null) { + // Throw again + throw new NullPointerException("this.landLineNumber.phoneAreaCode is null"); + } else if (this.getLandLineNumber().getPhoneAreaCode() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode())); + } else if (this.getLandLineNumber().getPhoneCountry() == null) { + // Throw NPE again + throw new NullPointerException("this.landLineNumber.phoneCountry is null"); + } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() == null) { + // ... throw again + throw new NullPointerException("this.landLineNumber.phoneCountry.countryId is null"); + } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() < 1) { + // Invalid id + throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneCountry.countryId={0} is invalid", this.getLandLineNumber().getPhoneCountry().getCountryId())); + } else if (this.getLandLineNumber().getPhoneNumber() == null) { + // Throw NPE again ... + throw new NullPointerException("this.landLineNumber.phoneNumber is null"); + } else if (this.getLandLineNumber().getPhoneNumber() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneNumber={0} is not valid", this.getLandLineNumber().getPhoneNumber())); + } + + // Copy all (changeable) data fields to admin controller + this.adminPhoneController.setPhoneAreaCode(this.getLandLineNumber().getPhoneAreaCode()); + this.adminPhoneController.setPhoneCountry(this.getLandLineNumber().getPhoneCountry()); + this.adminPhoneController.setPhoneNumber(this.getLandLineNumber().getPhoneNumber()); + } + + @Override + public void copyMobileNumberToController () { + // Validate mobile instance + if (this.getMobileNumber() == null) { + // Throw NPE + throw new NullPointerException("this.mobileNumber is null"); + } else if (this.getMobileNumber().getPhoneId() == null) { + // Throw again + throw new NullPointerException("this.mobileNumber.phoneId is null"); + } else if (this.getMobileNumber().getPhoneId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneId={0} is not valid", this.getMobileNumber().getPhoneId())); + } else if (this.getMobileNumber().getMobileProvider() == null) { + // Throw NPE again + throw new NullPointerException("this.mobileNumber.mobileProvider is null"); + } else if (this.getMobileNumber().getMobileProvider().getProviderId() == null) { + // ... throw again + throw new NullPointerException("this.mobileNumber.mobileProvider.providerId is null"); + } else if (this.getMobileNumber().getMobileProvider().getProviderId() < 1) { + // Invalid id + throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileProvider.providerId={0} is invalid", this.getMobileNumber().getMobileProvider().getProviderId())); + } else if (this.getMobileNumber().getPhoneNumber() == null) { + // Throw NPE again ... + throw new NullPointerException("this.mobileNumber.phoneNumber is null"); + } else if (this.getMobileNumber().getPhoneNumber() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneNumber={0} is not valid", this.getMobileNumber().getPhoneNumber())); + } + + // Copy all (changeable) data fields to admin controller + this.adminPhoneController.setMobileProvider(this.getMobileNumber().getMobileProvider()); + this.adminPhoneController.setPhoneNumber(this.getMobileNumber().getPhoneNumber()); + } + + @Override + public void copyUserToController () { + // Log message + //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N + + // Validate user instance + if (this.getUser() == null) { + // Throw NPE + throw new NullPointerException("this.user is null"); //NOI18N + } else if (this.getUser().getUserId() == null) { + // Throw NPE again + throw new NullPointerException("this.user.userId is null"); //NOI18N + } else if (this.getUser().getUserId() < 1) { + // Not valid + throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId())); //NOI18N + } + + // Get contact + Contact userContact = this.getUser().getUserContact(); + + // Set contact here, too. This avoids parameters that cannot auto-complete in IDEs. + this.setContact(userContact); + + // Set all phone instances + this.setPhoneInstances(userContact); + + // Set all fields: user + this.userController.setUserName(this.getUser().getUserName()); + this.adminUserController.setUserName(this.getUser().getUserName()); + } + + @Override + public Contact getContact () { + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); + // System.out.println(MessageFormat.format("{0}: Returning this.contact={1}, caller: {2}", this.getClass().getSimpleName(), this.contact, caller)); + return this.contact; + } + + @Override + public void setContact (final Contact contact) { + // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName()); + // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller)); + this.contact = contact; + } + + @Override + public String getContactUsageMessageKey (final Contact contact) { + // The contact must be valid + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() == null) { + // Throw again ... + throw new NullPointerException("contact.contactId is null"); //NOI18N + } else if (contact.getContactId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N + } + + // Default key is "unused" + String messageKey = "CONTACT_IS_UNUSED"; //NOI18N + + // Check user contact + boolean isUserContact = this.userController.isContactFound(contact); + + // Check user first + if (isUserContact) { + // Only user + messageKey = "CONTACT_IS_USER"; //NOI18N + } + + // Return message key + return messageKey; + } + + @Override + public DialableFaxNumber getFaxNumber () { + return this.faxNumber; + } + + @Override + public void setFaxNumber (final DialableFaxNumber faxNumber) { + this.faxNumber = faxNumber; + } + + @Override + public DialableLandLineNumber getLandLineNumber () { + return this.landLineNumber; + } + + @Override + public void setLandLineNumber (final DialableLandLineNumber landLineNumber) { + this.landLineNumber = landLineNumber; + } + + @Override + public DialableMobileNumber getMobileNumber () { + return this.mobileNumber; + } + + @Override + public void setMobileNumber (final DialableMobileNumber mobileNumber) { + this.mobileNumber = mobileNumber; + } + + @Override + public User getUser () { + return this.user; + } + + @Override + public void setUser (final User user) { + this.user = user; + } + + /** + * Set's all given contact's phone instances: land-line, mobile and + * faxNumber + *

+ * @param contact Contact to set phone instances for + */ + private void setPhoneInstances (final Contact contact) { + // The contact must be valid + if (null == contact) { + // Throw NPE + throw new NullPointerException("contact is null"); //NOI18N + } else if (contact.getContactId() == null) { + // Throw again ... + throw new NullPointerException("contact.contactId is null"); //NOI18N + } else if (contact.getContactId() < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N + } + + // Is mobile set? + if (contact.getContactMobileNumber() instanceof DialableMobileNumber) { + // Yes, then set it in admin controller + this.setMobileNumber(contact.getContactMobileNumber()); + } + + // Is land-line set? + if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) { + // Yes, then set it in admin controller + this.setLandLineNumber(contact.getContactLandLineNumber()); + } + + // Is faxNumber set? + if (contact.getContactFaxNumber() instanceof DialableFaxNumber) { + // Yes, then set it in admin controller + this.setFaxNumber(contact.getContactFaxNumber()); + } + } + +} diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java index 9b46b8c3..6929311d 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java @@ -804,7 +804,7 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple @Override public boolean isUserNameRequired () { // Get context parameter - String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_name_required"); //NOI18N + String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_login_require_user_name"); //NOI18N // Is it set? boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java index 802b66a0..f334381c 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java @@ -124,7 +124,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll } else if (!this.userController.isRequiredPersonalDataSet()) { // Not all required fields are set throw new FaceletException("Not all required fields are set."); //NOI18N - } else if ((this.featureController.isFeatureEnabled("user_name_required")) && (this.userController.isUserNameRegistered(user))) { //NOI18N + } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(user))) { //NOI18N // Is multi-page enabled? if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N // User name is already used, should not happen here @@ -231,7 +231,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll if (null == user) { // user must be set throw new NullPointerException("user is null after createUserInstance() was called"); //NOI18N - } else if ((this.featureController.isFeatureEnabled("user_name_required")) && (this.userController.isUserNameRegistered(user))) { //NOI18N + } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(user))) { //NOI18N // User name is already used, so clear it this.userController.setUserName(null); this.showFacesMessage("form_register_page1:userName", "ERROR_USER_NAME_ALREADY_USED"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java index cf7f56f6..fca11c6c 100644 --- a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java @@ -1,130 +1,130 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jfinancials.converter.fax; - -import java.text.MessageFormat; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; -import javax.faces.convert.FacesConverter; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; -import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; - -/** - * Converter for fax id <-> valid fax number instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "FaxNumberConverter") -public class FinancialsFaxNumberConverter implements Converter { - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Phone EJB - */ - private PhoneSessionBeanRemote phoneBean; - - /** - * Initialization of this converter - */ - public FinancialsFaxNumberConverter () { - // 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 - - // ... and user controller - this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Log message - this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: context={1},component={2},submittedValue={3} - CALLED!", this.getClass().getSimpleName(), context, component, submittedValue)); //NOI18N - - // Is the value null or empty? - if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { - // Warning message - this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N - - // Return null - return null; - } - - // Init instance - DialableFaxNumber faxNumber = null; - - try { - // Try to parse the value as long - Long faxNumberId = Long.valueOf(submittedValue); - - // Log message - this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N - - // Try to get mobile instance from it - faxNumber = this.phoneBean.findFaxNumberById(faxNumberId); - } catch (final NumberFormatException ex) { - // Throw again - throw new ConverterException(ex); - } catch (final PhoneEntityNotFoundException ex) { - // Debug message - this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N - } - - // Log message - this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: faxNumber={1} - EXIT!", this.getClass().getSimpleName(), faxNumber)); //NOI18N - - // Return it - return faxNumber; - } - - @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { - // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { - // Is null - return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((DialableNumber) value).getPhoneId()); - } - -} +/* + * Copyright (C) 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.converter.fax; + +import java.text.MessageFormat; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.faces.convert.FacesConverter; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; +import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; +import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; +import org.mxchange.jphone.phonenumbers.DialableNumber; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; + +/** + * Converter for fax id <-> valid fax number instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "FaxNumberConverter") +public class FinancialsFaxNumberConverter implements Converter { + + /** + * Logger instance + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + + /** + * Phone EJB + */ + private PhoneSessionBeanRemote phoneBean; + + /** + * Initialization of this converter + */ + public FinancialsFaxNumberConverter () { + // 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 + + // ... and user controller + this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + + @Override + public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + // Log message + this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: context={1},component={2},submittedValue={3} - CALLED!", this.getClass().getSimpleName(), context, component, submittedValue)); //NOI18N + + // Is the value null or empty? + if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { + // Warning message + this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N + + // Return null + return null; + } + + // Init instance + DialableFaxNumber faxNumber = null; + + try { + // Try to parse the value as long + Long faxNumberId = Long.valueOf(submittedValue); + + // Log message + this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N + + // Try to get mobile instance from it + faxNumber = this.phoneBean.findFaxNumberById(faxNumberId); + } catch (final NumberFormatException ex) { + // Throw again + throw new ConverterException(ex); + } catch (final PhoneEntityNotFoundException ex) { + // Debug message + this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N + } + + // Log message + this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: faxNumber={1} - EXIT!", this.getClass().getSimpleName(), faxNumber)); //NOI18N + + // Return it + return faxNumber; + } + + @Override + public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + // Is the object null? + if ((null == value) || ((String.valueOf(value)).isEmpty())) { + // Is null + return ""; //NOI18N + } else if (!(value instanceof DialableNumber)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((DialableNumber) value).getPhoneId()); + } + +} diff --git a/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java index 8f8f9f65..c81c4fb8 100644 --- a/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java @@ -1,121 +1,121 @@ -/* - * Copyright (C) 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jfinancials.converter.landline; - -import java.text.MessageFormat; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; -import javax.faces.convert.FacesConverter; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; -import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; - -/** - * Converter for land-line id <-> valid land-line number instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "LandLineNumberConverter") -public class FinancialsLandLineNumberConverter implements Converter { - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Phone EJB - */ - private PhoneSessionBeanRemote phoneBean; - - /** - * Initialization of this converter - */ - public FinancialsLandLineNumberConverter () { - // 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 - - // ... and user controller - this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the value null or empty? - if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { - // Warning message - this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N - - // Return null - return null; - } - - // Init instance - DialableLandLineNumber landLineNumber = null; - - try { - // Try to parse the value as long - Long landLineNumberId = Long.valueOf(submittedValue); - - // Try to get mobile instance from it - landLineNumber = this.phoneBean.findLandLineNumberById(landLineNumberId); - } catch (final NumberFormatException ex) { - // Throw again - throw new ConverterException(ex); - } catch (final PhoneEntityNotFoundException ex) { - // Debug message - this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N - } - - // Return it - return landLineNumber; - } - - @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { - // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { - // Is null - return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((DialableNumber) value).getPhoneId()); - } - -} +/* + * Copyright (C) 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.converter.landline; + +import java.text.MessageFormat; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.faces.convert.FacesConverter; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; +import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; +import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; +import org.mxchange.jphone.phonenumbers.DialableNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; + +/** + * Converter for land-line id <-> valid land-line number instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "LandLineNumberConverter") +public class FinancialsLandLineNumberConverter implements Converter { + + /** + * Logger instance + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + + /** + * Phone EJB + */ + private PhoneSessionBeanRemote phoneBean; + + /** + * Initialization of this converter + */ + public FinancialsLandLineNumberConverter () { + // 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 + + // ... and user controller + this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + + @Override + public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + // Is the value null or empty? + if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { + // Warning message + this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N + + // Return null + return null; + } + + // Init instance + DialableLandLineNumber landLineNumber = null; + + try { + // Try to parse the value as long + Long landLineNumberId = Long.valueOf(submittedValue); + + // Try to get mobile instance from it + landLineNumber = this.phoneBean.findLandLineNumberById(landLineNumberId); + } catch (final NumberFormatException ex) { + // Throw again + throw new ConverterException(ex); + } catch (final PhoneEntityNotFoundException ex) { + // Debug message + this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N + } + + // Return it + return landLineNumber; + } + + @Override + public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + // Is the object null? + if ((null == value) || ((String.valueOf(value)).isEmpty())) { + // Is null + return ""; //NOI18N + } else if (!(value instanceof DialableNumber)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((DialableNumber) value).getPhoneId()); + } + +} diff --git a/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java index f908ca92..c2fd838b 100644 --- a/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java @@ -1,116 +1,116 @@ -/* - * Copyright (C) 2016, 2017 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.jfinancials.converter.mobile; - -import java.text.MessageFormat; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; -import javax.faces.convert.FacesConverter; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; - -/** - * Converter for mobile id <-> valid mobile instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "MobileNumberConverter") -public class FinancialsMobileNumberConverter implements Converter { - - /** - * Phone EJB - */ - private PhoneSessionBeanRemote phoneBean; - - /** - * Initialization of this converter - */ - public FinancialsMobileNumberConverter () { - } - - @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the value null or empty? - if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { - // Warning message - // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N - - // Return null - return null; - } - - synchronized (this) { - // Is the EJB instanciated? - if (null == this.phoneBean) { - // Try to get it - try { - // Get initial context - Context initialContext = new InitialContext(); - - // ... and user controller - this.phoneBean = (PhoneSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - } - - // Init instance - DialableMobileNumber mobile = null; - - try { - // Try to parse the value as long - Long mobileId = Long.valueOf(submittedValue); - - // Try to get mobile instance from it - mobile = this.phoneBean.findMobileNumberById(mobileId); - } catch (final NumberFormatException ex) { - // Throw again - throw new ConverterException(ex); - } catch (final PhoneEntityNotFoundException ex) { - // Debug message - // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N - } - - // Return it - return mobile; - } - - @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { - // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { - // Is null - return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((DialableNumber) value).getPhoneId()); - } - -} +/* + * Copyright (C) 2016, 2017 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.converter.mobile; + +import java.text.MessageFormat; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.faces.convert.FacesConverter; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; +import org.mxchange.jphone.phonenumbers.DialableNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; + +/** + * Converter for mobile id <-> valid mobile instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "MobileNumberConverter") +public class FinancialsMobileNumberConverter implements Converter { + + /** + * Phone EJB + */ + private PhoneSessionBeanRemote phoneBean; + + /** + * Initialization of this converter + */ + public FinancialsMobileNumberConverter () { + } + + @Override + public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + // Is the value null or empty? + if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { + // Warning message + // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N + + // Return null + return null; + } + + synchronized (this) { + // Is the EJB instanciated? + if (null == this.phoneBean) { + // Try to get it + try { + // Get initial context + Context initialContext = new InitialContext(); + + // ... and user controller + this.phoneBean = (PhoneSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + } + + // Init instance + DialableMobileNumber mobile = null; + + try { + // Try to parse the value as long + Long mobileId = Long.valueOf(submittedValue); + + // Try to get mobile instance from it + mobile = this.phoneBean.findMobileNumberById(mobileId); + } catch (final NumberFormatException ex) { + // Throw again + throw new ConverterException(ex); + } catch (final PhoneEntityNotFoundException ex) { + // Debug message + // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N + } + + // Return it + return mobile; + } + + @Override + public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + // Is the object null? + if ((null == value) || ((String.valueOf(value)).isEmpty())) { + // Is null + return ""; //NOI18N + } else if (!(value instanceof DialableNumber)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((DialableNumber) value).getPhoneId()); + } + +} diff --git a/web/WEB-INF/templates/admin/user/admin_show_user_data.tpl b/web/WEB-INF/templates/admin/user/admin_show_user_data.tpl index 52f1cc58..53c83f28 100644 --- a/web/WEB-INF/templates/admin/user/admin_show_user_data.tpl +++ b/web/WEB-INF/templates/admin/user/admin_show_user_data.tpl @@ -19,7 +19,7 @@ - + diff --git a/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl b/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl index 42e57557..c3a137cd 100644 --- a/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl +++ b/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl @@ -23,7 +23,7 @@ - + diff --git a/web/WEB-INF/templates/guest/guest_menu.tpl b/web/WEB-INF/templates/guest/guest_menu.tpl index 1bc058f8..778b4946 100644 --- a/web/WEB-INF/templates/guest/guest_menu.tpl +++ b/web/WEB-INF/templates/guest/guest_menu.tpl @@ -22,7 +22,7 @@

    - +
  • @@ -34,7 +34,7 @@
    - +
  • diff --git a/web/WEB-INF/templates/guest/user/guest_login_form.tpl b/web/WEB-INF/templates/guest/user/guest_login_form.tpl index cc8edcf3..74f86eeb 100644 --- a/web/WEB-INF/templates/guest/user/guest_login_form.tpl +++ b/web/WEB-INF/templates/guest/user/guest_login_form.tpl @@ -5,7 +5,7 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    - +
    @@ -56,7 +56,7 @@ - +
    diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl index 97af2dba..e7f92540 100644 --- a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl +++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl @@ -17,7 +17,7 @@ - +
    @@ -37,7 +37,7 @@ - +
    diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl index 7fb7d9c8..98f822df 100644 --- a/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl +++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl @@ -19,7 +19,7 @@ - +
    @@ -39,7 +39,7 @@ - +
    diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 54da423a..1d420288 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -19,7 +19,7 @@ Whether a user name is required for this application. - is_feature_user_name_required_enabled + is_feature_user_login_require_user_name_enabled true @@ -113,13 +113,13 @@ false - Whether the public user profile is enabled. If this option is enabled, the setting "is_user_name_required" must also be enabled as it is mandadory. + Whether the public user profile is enabled. If this option is enabled, the setting "is_user_login_require_user_name" must also be enabled as it is mandadory. is_public_profile_enabled true Whether user names are required for completing registration. - is_user_name_required + is_user_login_require_user_name true diff --git a/web/admin/user/admin_user_activity_log.xhtml b/web/admin/user/admin_user_activity_log.xhtml index 9e714dc0..9d7ca70d 100644 --- a/web/admin/user/admin_user_activity_log.xhtml +++ b/web/admin/user/admin_user_activity_log.xhtml @@ -42,7 +42,7 @@ - + diff --git a/web/admin/user/admin_user_export.xhtml b/web/admin/user/admin_user_export.xhtml index 407caada..b44a9eee 100644 --- a/web/admin/user/admin_user_export.xhtml +++ b/web/admin/user/admin_user_export.xhtml @@ -36,7 +36,7 @@ - + diff --git a/web/admin/user/admin_user_list.xhtml b/web/admin/user/admin_user_list.xhtml index 546c8828..23890a9a 100644 --- a/web/admin/user/admin_user_list.xhtml +++ b/web/admin/user/admin_user_list.xhtml @@ -36,7 +36,7 @@ - + diff --git a/web/guest/user/user_login.xhtml b/web/guest/user/user_login.xhtml index 94ea425c..8cae955a 100644 --- a/web/guest/user/user_login.xhtml +++ b/web/guest/user/user_login.xhtml @@ -17,7 +17,7 @@ - + @@ -30,12 +30,12 @@
    - +
    - + diff --git a/web/guest/user/user_lost_password.xhtml b/web/guest/user/user_lost_password.xhtml index fd429a45..b4a54a36 100644 --- a/web/guest/user/user_lost_password.xhtml +++ b/web/guest/user/user_lost_password.xhtml @@ -18,7 +18,7 @@ - +
    @@ -70,7 +70,7 @@
    - + diff --git a/web/guest/user/user_register.xhtml b/web/guest/user/user_register.xhtml index 7d238fb5..8bed557c 100644 --- a/web/guest/user/user_register.xhtml +++ b/web/guest/user/user_register.xhtml @@ -19,7 +19,7 @@ - + diff --git a/web/guest/user/user_register_page2.xhtml b/web/guest/user/user_register_page2.xhtml index fe89f876..7e180037 100644 --- a/web/guest/user/user_register_page2.xhtml +++ b/web/guest/user/user_register_page2.xhtml @@ -19,7 +19,7 @@ - +