package org.mxchange.pizzaapplication.beans;
import java.io.Serializable;
+import java.text.MessageFormat;
+import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
/**
return isEnabled;
}
+ /**
+ * Shows a faces message for given causing exception. The message from the
+ * exception is being inserted into the message.
+ * <p>
+ * @param clientId Client id to send message to
+ * @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
+ FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(cause.getMessage()));
+ }
+
}
throw new FaceletException("Not all required fields are set."); //NOI18N
} else if (!this.userLoginController.ifCurrentPasswordMatches()) {
// Password not matching
- throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
+ this.showFacesMessage("login_change_personal_form:currentPassword", new UserPasswordMismatchException(this.userLoginController.getLoggedInUser())); //NOI18N
+ return ""; //NOI18N
}
// Get contact instance
throw new FaceletException("Email address 1/2 are mismatching."); //NOI18N
} else if (!this.loginController.ifCurrentPasswordMatches()) {
// Password not matching
- throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
+ this.showFacesMessage("login_change_email_address_form:currentPassword", new UserPasswordMismatchException(this.loginController.getLoggedInUser())); //NOI18N
+ return ""; //NOI18N
}
// Get user instance
// Is the provider already created?
if (this.isMobileProviderCreated(mobileProvider)) {
// Then throw exception
- throw new FaceletException(new MobileProviderAlreadyAddedException(mobileProvider));
+ this.showFacesMessage("add_mobile_provider_form:providerDialPrefix", new MobileProviderAlreadyAddedException(mobileProvider)); //NOI18N
+ return ""; //NOI18N
}
// Init variable
// Is the email address really not used?
user = this.userController.lookupUserByEmailAddress(this.getEmailAddress());
} catch (final UserEmailAddressNotFoundException ex) {
- // Not found, should not happen as the registeredvalidator should find it
+ // Not found, should not happen as the registered validator should find it
throw new FaceletException(MessageFormat.format("this.emailAddress={0} should be resolveable into User instance.", this.getEmailAddress()), ex); //NOI18N
}
// Is the user account already confirmed?
if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
// Then abort here
- throw new FaceletException(new UserStatusConfirmedException(user));
+ this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusConfirmedException(user)); //NOI18N
+ return ""; //NOI18N
} else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
// User account is locked
- throw new FaceletException(new UserStatusLockedException(user));
+ this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusLockedException(user)); //NOI18N
+ return ""; //NOI18N
} else if (user.getUserConfirmKey() == null) {
// Status is UNCONFIRMED but confirmation key is NULL
throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
<div class="clear"></div>
</div>
+ <h:message for="providerDialPrefix" errorClass="errors" fatalClass="errors" warnClass="errors" />
+
<div class="table_row">
<div class="table_left_medium">
<h:outputLabel for="providerMailPattern" value="#{msg.ADMIN_ENTER_MOBILE_PROVIDER_PATTERN}" />
</h:column>
</h:dataTable>
- <h:form id="form_add_mobile_provider">
+ <h:form id="add_mobile_provider_form">
<div class="table_medium">
<div class="table_header">
<h:outputText value="#{msg.ADMIN_ADD_MOBILE_PROVIDER_TITLE}" />
#{msg.LOGIN_CHANGE_EMAIL_ADDRESS_TITLE}
</div>
- <h:form id="login_form">
+ <h:form id="login_change_email_address_form">
<div class="para">
<fieldset id="change_email">
<legend title="#{msg.LOGIN_CHANGE_EMAIL_LEGEND_TITLE}">#{msg.LOGIN_CHANGE_EMAIL_LEGEND}</legend>