From: Roland Häder Date: Wed, 19 Apr 2017 19:26:55 +0000 (+0200) Subject: Continued renaming: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=49860a7fdcaf4795b9b5fb4be430237f25a327de;p=jfinancials-war.git Continued renaming: - renamed AddressbookFoo classes to FinancialsFoo - more renames from Addressbook to JFinancials Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jfinancials/converter/contact/AddressbookContactConverter.java b/src/java/org/mxchange/jfinancials/converter/contact/AddressbookContactConverter.java deleted file mode 100644 index 51c2d25d..00000000 --- a/src/java/org/mxchange/jfinancials/converter/contact/AddressbookContactConverter.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2016 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.contact; - -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.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; -import org.mxchange.jcontacts.exceptions.ContactNotFoundException; -import org.mxchange.jcoreeelogger.beans.local.logger.Log; -import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; - -/** - * Converter for contact id <-> valid contact instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "ContactConverter") -public class AddressbookContactConverter implements Converter { - - /** - * User EJB - */ - private ContactSessionBeanRemote contactBean; - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Initialization of this converter - */ - public AddressbookContactConverter () { - // 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.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //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) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", 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 - Contact contact = null; - - try { - // Try to parse the value as long - Long contactId = Long.valueOf(submittedValue); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contactId{0}", contactId)); //NOI18N - - // Try to get user instance from it - contact = this.contactBean.findContactById(contactId); - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contact={0}", contact)); //NOI18N - } catch (final NumberFormatException ex) { - // Throw again - throw new ConverterException(ex); - } catch (final ContactNotFoundException ex) { - // Debug message - this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N - } - - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: contact={0} - EXIT!", contact)); //NOI18N - - // Return it - return contact; - } - - @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 Contact)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((Contact) value).getContactId()); - } - -} diff --git a/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java b/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java new file mode 100644 index 00000000..c689881b --- /dev/null +++ b/src/java/org/mxchange/jfinancials/converter/contact/FinancialsContactConverter.java @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2016 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.contact; + +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.jcontacts.contact.Contact; +import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; +import org.mxchange.jcontacts.exceptions.ContactNotFoundException; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; +import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; + +/** + * Converter for contact id <-> valid contact instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "ContactConverter") +public class FinancialsContactConverter implements Converter { + + /** + * User EJB + */ + private ContactSessionBeanRemote contactBean; + + /** + * Logger instance + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + + /** + * Initialization of this converter + */ + public FinancialsContactConverter () { + // 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.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //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) { + // Trace message + // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", 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 + Contact contact = null; + + try { + // Try to parse the value as long + Long contactId = Long.valueOf(submittedValue); + + // Debug message + // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contactId{0}", contactId)); //NOI18N + + // Try to get user instance from it + contact = this.contactBean.findContactById(contactId); + + // Debug message + // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: contact={0}", contact)); //NOI18N + } catch (final NumberFormatException ex) { + // Throw again + throw new ConverterException(ex); + } catch (final ContactNotFoundException ex) { + // Debug message + this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N + } + + // Trace message + // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: contact={0} - EXIT!", contact)); //NOI18N + + // Return it + return contact; + } + + @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 Contact)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Contact.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((Contact) value).getContactId()); + } + +} diff --git a/src/java/org/mxchange/jfinancials/converter/country/AddressbookCountryConverter.java b/src/java/org/mxchange/jfinancials/converter/country/AddressbookCountryConverter.java deleted file mode 100644 index 2b86ba01..00000000 --- a/src/java/org/mxchange/jfinancials/converter/country/AddressbookCountryConverter.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2016 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.country; - -import java.text.MessageFormat; -import java.util.List; -import java.util.Objects; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -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.jcountry.data.Country; -import org.mxchange.jcountry.data.CountrySingletonBeanRemote; - -/** - * Converter for country instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "CountryConverter") -public class AddressbookCountryConverter implements Converter { - - /** - * Country bean - */ - private CountrySingletonBeanRemote countryBean; - - /** - * Logger instance - */ - @Log - private LoggerBeanLocal loggerBeanLocal; - - /** - * Initialization of this converter - */ - public AddressbookCountryConverter () { - // 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 country bean - this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jfinancials-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //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) { - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //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; - } - - // Get full list - List countryList = this.countryBean.allCountries(); - - // Init value - Country country = null; - - // Try this better - try { - // Convert it to long - Long countryId = Long.parseLong(submittedValue); - - // Category id should not be below 1 - assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N - - // Debug message - // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N - - // Try to find it - for (final Country cntry : countryList) { - // Is the id the same? (null-safe) - if (Objects.equals(cntry.getCountryId(), countryId)) { - // Found it - country = cntry; - break; - } - } - } catch (final NumberFormatException ex) { - // Log exception (maybe to much?) - this.loggerBeanLocal.logException(ex); - } - - // Trace message - // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N - - // Return it - return country; - } - - @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 Country)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((Country) value).getCountryId()); - } - -} diff --git a/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java new file mode 100644 index 00000000..21eb2317 --- /dev/null +++ b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2016 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.country; + +import java.text.MessageFormat; +import java.util.List; +import java.util.Objects; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +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.jcountry.data.Country; +import org.mxchange.jcountry.data.CountrySingletonBeanRemote; + +/** + * Converter for country instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "CountryConverter") +public class FinancialsCountryConverter implements Converter { + + /** + * Country bean + */ + private CountrySingletonBeanRemote countryBean; + + /** + * Logger instance + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + + /** + * Initialization of this converter + */ + public FinancialsCountryConverter () { + // 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 country bean + this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/jfinancials-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote"); //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) { + // Trace message + // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //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; + } + + // Get full list + List countryList = this.countryBean.allCountries(); + + // Init value + Country country = null; + + // Try this better + try { + // Convert it to long + Long countryId = Long.parseLong(submittedValue); + + // Category id should not be below 1 + assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N + + // Debug message + // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N + + // Try to find it + for (final Country cntry : countryList) { + // Is the id the same? (null-safe) + if (Objects.equals(cntry.getCountryId(), countryId)) { + // Found it + country = cntry; + break; + } + } + } catch (final NumberFormatException ex) { + // Log exception (maybe to much?) + this.loggerBeanLocal.logException(ex); + } + + // Trace message + // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N + + // Return it + return country; + } + + @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 Country)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((Country) value).getCountryId()); + } + +} diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index d80c76ad..02b3cebd 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -19,7 +19,7 @@ GENDER_FEMALE=Frau CHOICE_YES=Ja CHOICE_NO=Nein PAGE_TITLE_INDEX_WELCOME=Willkommen! -CONTENT_TITLE_INDEX_WELCOME=Willkommen zum Addressbook: +CONTENT_TITLE_INDEX_WELCOME=Willkommen zu JFinancials PAGE_TITLE_ADMIN_WELCOME=Willkommen zum Administrationsbereich CONTENT_TITLE_ADMIN_WELCOME=Willkommen zur Administration: PAGE_TITLE_ADMIN_LOGOUT=Ausloggen diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index d9252c2d..53386328 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -19,7 +19,7 @@ GENDER_FEMALE=Mrs. CHOICE_YES=Yes CHOICE_NO=No PAGE_TITLE_INDEX_WELCOME=Welcome! -CONTENT_TITLE_INDEX_WELCOME=Welcome to Addressbook +CONTENT_TITLE_INDEX_WELCOME=Welcome to JFinancials PAGE_TITLE_ADMIN_WELCOME=Welcome to administration area CONTENT_TITLE_ADMIN_WELCOME=Welcome to website administration: PAGE_TITLE_ADMIN_LOGOUT=Logout diff --git a/web/WEB-INF/templates/base.tpl b/web/WEB-INF/templates/base.tpl index a8c5fc47..c72326f8 100644 --- a/web/WEB-INF/templates/base.tpl +++ b/web/WEB-INF/templates/base.tpl @@ -15,14 +15,14 @@ - Addressbook - <ui:insert name="title">Default title</ui:insert> + JFinancials - <ui:insert name="title">Default title</ui:insert>

diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 536cec40..9650b076 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -1,7 +1,7 @@ - An online address book application to share private and business memebers between all members. It is also possible that the user's profile can be made visible to outside. - Addressbook Application v1.0 + An application to handle all your receipts and do some calculation with it + JFinancials Application v1.0 Whether the multi-page registration page or a single registration page is active is_feature_user_register_multiple_page_enabled