From: Roland Haeder Date: Fri, 9 Oct 2015 18:59:20 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=29afecb48f6525e42d03946e321501519ce86a3e;p=addressbook-lib.git Continued: - added jcoree.jar (for ...) - added validator for validating address book names - added dist.sh as this lib needs to be copied to the domain's lib folder --- diff --git a/dist.sh b/dist.sh new file mode 100755 index 0000000..f48251e --- /dev/null +++ b/dist.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +NAME="${PWD##*/}" +DIST="dist/${NAME}.jar" +LIST=`find ../*/lib/${NAME}.jar` +LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`" +LIST="${LIST} ${HOME}/gf_domains/domain1/lib/" + +for target in ${LIST}; +do + if [ ! -f "${DIST}" ] + then + echo "$0: '${DIST}' not found." + elif [ -d "${target}" ] + then + cp -v "${DIST}" "${target}" + elif [ -f "${target}" ] + then + cp -v "${DIST}" "${target}" + else + echo "$0: Target '${target}' not found." + fi +done diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar new file mode 100644 index 0000000..e680266 Binary files /dev/null and b/lib/jcoreee.jar differ diff --git a/nbproject/project.properties b/nbproject/project.properties index 1d739ec..82646a8 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -35,6 +35,7 @@ file.reference.jcontacts-core.jar=lib/jcontacts-core.jar file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar file.reference.jcore-swing.jar=lib/jcore-swing.jar file.reference.jcore.jar=lib/jcore.jar +file.reference.jcoreee.jar=lib/jcoreee.jar file.reference.juser-core.jar=lib\\juser-core.jar includes=** jar.archive.disabled=${jnlp.enabled} @@ -42,6 +43,7 @@ jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ ${file.reference.jcore.jar}:\ + ${file.reference.jcoreee.jar}:\ ${file.reference.jcore-swing.jar}:\ ${file.reference.jcore-logger-lib.jar}:\ ${file.reference.jcontacts-core.jar}:\ @@ -102,6 +104,7 @@ source.reference.jcontacts-core.jar=../jcontacts-core/src/ source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ source.reference.jcore-swing.jar=../jcore-swing/src source.reference.jcore.jar=../jcore/src +source.reference.jcoreee.jar=../jcoreee/src/ source.reference.juser-core.jar=../juser-core/src/ src.dir=src test.src.dir=test diff --git a/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java b/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java new file mode 100644 index 0000000..15ef2bc --- /dev/null +++ b/src/org/mxchange/addressbook/validator/names/AddressbookNameValidator.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.validator.names; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; +import org.mxchange.jcoreee.validator.string.BaseStringValidator; + +/** + * A validation class for addressbook names, such as first name or family name. + *

+ * @author Roland Haeder + */ +public class AddressbookNameValidator extends BaseStringValidator implements Validator { + + /** + * Serial number + */ + private static final long serialVersionUID = 27_587_896_710_689_451L; + + @Override + public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { + // Trace message + //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N + + // All accepted, required fields + String[] requiredFileds = {"addressbookName"}; //NOI18N + + // Pre-validation (e.g. not null, not a string, empty string ...) + super.preValidate(context, component, value, requiredFileds); + + // Trace message + //this.getLogger().logTrace("validate: EXIT!"); //NOI18N + } +}