package org.mxchange.addressbook.beans;
import java.io.Serializable;
-import java.text.MessageFormat;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
* @param cause Causing exception
*/
protected void showFacesMessage (final String clientId, final Throwable cause) {
- // Trace message
- System.out.println(MessageFormat.format("showFacesMessage: clientId={0},cause={1} - CALLED!", clientId, cause));
-
// Get context and add message
this.showFacesMessage(clientId, cause.getMessage());
}
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.addressbook.beans.contact.AddressbookAdminContactWebRequestController;
+import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
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;
-import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
/**
* A general helper for beans
@Override
public void copyContactToController () {
- // Log message
- //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyContactToController - CALLED!"); //NOI18N
-
// Validate user instance
if (this.getContact() == null) {
// Throw NPE
// Set all fields: user
this.adminContactController.copyContactToController(this.getContact());
-
- // Log message
- //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyContactToController - EXIT!"); //NOI18N
}
@Override
public void copyUserToController () {
- // Log message
- //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
-
// Validate user instance
if (this.getUser() == null) {
// Throw NPE
// Set all fields: user
this.userController.setUserName(this.getUser().getUserName());
-
- // Log message
- //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - EXIT!"); //NOI18N
}
@Override
@Override
public void afterUserLogin (@Observes final ObservableUserLoggedInEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("LandingLocalizationSessionBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
-
// event should not be null
if (null == event) {
// Throw NPE
// Set locale here
this.setLocale(event.getLoggedInUser().getUserLocale());
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("LandingLocalizationSessionBean:afterUserLogin - EXIT!"); //NOI18N
}
@Override
public void afterUserLogout (@Observes final ObservableUserLogoutEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ReportsLocalizationSessionBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
-
// event should not be null
if (null == event) {
// Throw NPE
// Clear this bean as well
this.clear();
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("ReportsLocalizationSessionBean:afterUserLogin - EXIT!"); //NOI18N
}
@Override
public String getLanguage () {
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::getLanguage(): locale.language={0} - EXIT!", this.getLocale().getLanguage())); //NOI18N
return this.getLocale().getLanguage().toLowerCase();
}
@Override
public void setLanguage (final String language) {
- // Log trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::setLanguage: language={0} - CALLED!", language)); //NOI18N
-
// Is the language null?
if (null == language) {
// This may sometimes happen, so abort here
// Get new locale with upper-case country code
Locale loc = new Locale(splits[0], splits[1]);
- // Log debug message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::setLanguage: loc={0}", loc)); //NOI18N
// Set it here and in the JSF context
this.setLocale(loc);
FacesContext.getCurrentInstance().getViewRoot().setLocale(loc);
-
- // Log trace message
- //* NOISY-DEBUG: */ System.out.println("AddressbookLocalizationSessionBean::setLanguage: EXIT!"); //NOI18N
}
@Override
public Locale getLocale () {
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::getLocale(): locale={0} - EXIT!", this.locale)); //NOI18N
return this.locale;
}
@Override
public void setLocale (final Locale locale) {
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::setLocale(): locale={0} - CALLED!", locale)); //NOI18N
this.locale = locale;
}
*/
@PostConstruct
public void init () {
- // Log trace message
- //* NOISY-DEBUG: */ System.out.println("AddressbookLocalizationSessionBean::init: CALLED!"); //NOI18N
-
// Create locale instance from context
Locale loc = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
- // Log debug message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AddressbookLocalizationSessionBean::init: loc={0}", loc)); //NOI18N
// Set it here
this.setLocale(loc);
-
- // Log trace message
- //* NOISY-DEBUG: */ System.out.println("AddressbookLocalizationSessionBean::init: EXIT!"); //NOI18N
}
/**
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcoreee.utils.FacesUtils;
import org.mxchange.jusercore.container.login.UserLoginContainer;
+import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
+import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.UserUtils;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
/**
* A user bean (controller)
@Override
public void afterRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminUserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
-
// event should not be null
if (null == event) {
// Throw NPE
// Get user instance
User registeredUser = event.getRegisteredUser();
- // Debug message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N
+ // @TODO Nothing to do with the user here?
// Clear all data
this.clear();
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("AdminUserWebBean:afterRegistration: EXIT!"); //NOI18N
}
@Override
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// The required field
String[] requiredFields = {"emailAddress", "emailAddressRepeat", "resendEmailAddress"}; //NOI18N
// No, then abort here
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
}
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
}
}
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// All accepted, required fields
String[] requiredFields = {"firstName", "familyName", "city", "street", "addressbookName"}; //NOI18N
// Pre-validation (example: not null, not a string, empty string ...)
super.preValidate(context, component, value, requiredFields, false);
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
}
+
}
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// The required field
String[] requiredFields = {"currentPassword"}; //NOI18N
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N
}
*/
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
}
}
@Override
public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
// All accepted, required fields
String[] requiredFields = {"privacy", "terms"}; //NOI18N
// Pre-validation (example: not null, not a string, empty string ...)
super.preValidate(context, component, value, requiredFields, false);
-
- // Trace message
- //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
}
}