From: Roland Häder Date: Fri, 20 May 2016 15:36:54 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8c0fd4c314fdaabe827dd1ceca4a1fe3b57bae44;p=jfinancials-war.git Continued a bit: - first @Oberserves, then final - added simple birthday input field - added i18n strings - added birthday to export as well - added observer method afterUserConfirmedAccount() to update lists for - added javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE to make sure time-zone problems are fixed - fixed some messages, wrong stuff there Signed-off-by: Roland Häder --- diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index 3407e86f..c510f7d5 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -2,70 +2,70 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java index 8e0a08bf..053fec1a 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionBean.java @@ -49,6 +49,7 @@ import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -283,10 +284,10 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController throw new NullPointerException("event is null"); //NOI18N } else if (event.getUpdatedContact() == null) { // Throw NPE again - throw new NullPointerException("event.user is null"); //NOI18N + throw new NullPointerException("event.updatedContact is null"); //NOI18N } else if (event.getUpdatedContact().getContactId() == null) { // userId is null - throw new NullPointerException("event.user.userId is null"); //NOI18N + throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N } else if (event.getUpdatedContact().getContactId() < 1) { // Not avalid id throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N @@ -329,10 +330,10 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController throw new NullPointerException("event is null"); //NOI18N } else if (event.getRegisteredUser() == null) { // Throw NPE again - throw new NullPointerException("event.user is null"); //NOI18N + throw new NullPointerException("event.registeredUser is null"); //NOI18N } else if (event.getRegisteredUser().getUserId() == null) { // userId is null - throw new NullPointerException("event.user.userId is null"); //NOI18N + throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N } else if (event.getRegisteredUser().getUserId() < 1) { // Not avalid id throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N @@ -358,7 +359,50 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController } @Override - public void afterUserLogin (final @Observes UserLoggedInEvent event) { + public void afterUserConfirmedAccount (@Observes final UserConfirmedAccountEvent event) { + // Trace message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N + + // event should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getConfirmedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.confirmedUser is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.confirmedUser.userId is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getConfirmedUser(), event.getConfirmedUser().getUserId())); //NOI18N + } + + // "Cache" contact instance + Contact contact = event.getConfirmedUser().getUserContact(); + + // Get iterator from list + Iterator iterator = this.contactList.iterator(); + + // "Walk" through all entries + while (iterator.hasNext()) { + // Get next element + Contact next = iterator.next(); + + // Is id number the same? + if (Objects.equals(contact.getContactId(), next.getContactId())) { + // Found entry, so remove it and abort + this.contactList.remove(next); + break; + } + } + + // Add contact to list + this.contactList.add(contact); + } + + @Override + public void afterUserLogin (@Observes final UserLoggedInEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N @@ -368,10 +412,10 @@ public class AddressbookContactWebSessionBean extends BaseAddressbookController throw new NullPointerException("event is null"); //NOI18N } else if (event.getLoggedInUser() == null) { // Throw NPE again - throw new NullPointerException("event.user is null"); //NOI18N + throw new NullPointerException("event.loggedInUser is null"); //NOI18N } else if (event.getLoggedInUser().getUserId() == null) { // userId is null - throw new NullPointerException("event.user.userId is null"); //NOI18N + throw new NullPointerException("event.loggedInUser.userId is null"); //NOI18N } else if (event.getLoggedInUser().getUserId() < 1) { // Not avalid id throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N diff --git a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java index a7ab2756..1573f149 100644 --- a/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/contact/AddressbookContactWebSessionController.java @@ -26,6 +26,7 @@ import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent; import org.mxchange.jcontacts.exceptions.ContactNotFoundException; import org.mxchange.jcountry.data.Country; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; +import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -63,6 +64,13 @@ public interface AddressbookContactWebSessionController extends Serializable { */ void afterAdminAddedUserEvent (final AdminAddedUserEvent event); + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ + void afterUserConfirmedAccount (final UserConfirmedAccountEvent event); + /** * Updates all data from bean in given contact instance *

diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java index c42460d1..d93dc8a6 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestBean.java @@ -262,7 +262,7 @@ public class AddressbookAdminUserWebRequestBean extends BaseAddressbookControlle } @Override - public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) { + public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminUserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java index 8fa71470..0a1a39cc 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java @@ -40,6 +40,7 @@ import org.mxchange.addressbook.beans.register.AddressbookUserRegisterWebSession import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.ContactSessionBeanRemote; import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; +import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -311,7 +312,47 @@ public class AddressbookUserWebSessionBean extends BaseAddressbookController imp } @Override - public void afterUserLogin (final @Observes UserLoggedInEvent event) { + public void afterUserConfirmedAccount (@Observes final UserConfirmedAccountEvent event) { + // Trace message + //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N + + // event should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getConfirmedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.confirmedUser is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.confirmedUser.userId is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getConfirmedUser(), event.getConfirmedUser().getUserId())); //NOI18N + } + + // Get iterator from list + Iterator iterator = this.userList.iterator(); + + // "Walk" through all entries + while (iterator.hasNext()) { + // Get next element + User next = iterator.next(); + + // Is id number the same? + if (Objects.equals(event.getConfirmedUser().getUserId(), next.getUserId())) { + // Found entry, so remove it and abort + this.userList.remove(next); + break; + } + } + + // Add contact to list + this.userList.add(event.getConfirmedUser()); + } + + @Override + public void afterUserLogin (@Observes final UserLoggedInEvent event) { // Trace message //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N diff --git a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java index 3b6e94e1..c665213f 100644 --- a/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.List; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent; +import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -64,6 +65,13 @@ public interface AddressbookUserWebSessionController extends Serializable { */ void afterAdminUpdatedUserDataEvent (final AdminUpdatedUserDataEvent event); + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ + void afterUserConfirmedAccount (final UserConfirmedAccountEvent event); + /** * Listens to fired event when user updated personal data *

diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 74ff6927..9f2f8fad 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -551,3 +551,5 @@ ADMIN_EXPORT_CONTACTS_TIMEOUT_WARNING=Bei sehr gro\u00dfen Datenmengen kann es e BUTTON_ADMIN_EXPORT_CONTACTS_CSV=Alle Daten als CSV-Datei exportieren LINK_ADMIN_EXPORT_CONTACT=Daten exportieren LINK_ADMIN_EXPORT_CONTACT_TITLE=Kontaktdaten exportieren +PERSONAL_DATA_BIRTHDAY=Geburtsdatum (dd.mm.jjjj): +BIRTHDAY_PATTERN=dd.MM.yyyy diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 56efcee8..9ab200cf 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -549,3 +549,5 @@ ADMIN_EXPORT_CONTACTS_TIMEOUT_WARNING=Big data amount may lead to timeouts. You BUTTON_ADMIN_EXPORT_CONTACTS_CSV=Export all data as CSV file LINK_ADMIN_EXPORT_CONTACT=Export data LINK_ADMIN_EXPORT_CONTACT_TITLE=Export contact data +PERSONAL_DATA_BIRTHDAY=Birthday (mm-dd-yyyy): +BIRTHDAY_PATTERN=MM-dd-yyyy diff --git a/web/WEB-INF/templates/contact/form_contact_data.tpl b/web/WEB-INF/templates/contact/form_contact_data.tpl index 55d2234c..1e826c36 100644 --- a/web/WEB-INF/templates/contact/form_contact_data.tpl +++ b/web/WEB-INF/templates/contact/form_contact_data.tpl @@ -3,7 +3,8 @@ xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + xmlns:ui="http://xmlns.jcp.org/jsf/facelets" + xmlns:p="http://primefaces.org/ui">

#{msg.PERSONAL_DATA_MINIMUM_NOTICE} @@ -111,6 +112,22 @@
+
+
+ +
+ +
+ + + +
+ +
+
+ + +
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 188d2ea2..66625f78 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -27,6 +27,10 @@ is_resend_confirm_link_enabled true + + javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE + true + Faces Servlet javax.faces.webapp.FacesServlet diff --git a/web/admin/contact/admin_contact_export.xhtml b/web/admin/contact/admin_contact_export.xhtml index 91b6c58c..af009469 100644 --- a/web/admin/contact/admin_contact_export.xhtml +++ b/web/admin/contact/admin_contact_export.xhtml @@ -109,6 +109,16 @@ + + + + + + + + + + @@ -139,7 +149,7 @@ - +