<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (C) 2016 Roland Häder
+Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder GmbH
+ * Copyright (C) 2016, 2017 Roland Häder GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
/*
- * Copyright (C) 2016 Roland Häder GmbH
+ * Copyright (C) 2016, 2017 Roland Häder GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
*/
package org.mxchange.addressbook.beans.resendlink;
-import java.text.MessageFormat;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.addressbook.beans.localization.AddressbookLocalizationSessionController;
import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
import org.mxchange.jcoreee.utils.FacesUtils;
+import org.mxchange.jusercore.events.resendlink.ObservableUserResendLinkAccountEvent;
+import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
import org.mxchange.jusercore.exceptions.UserStatusLockedException;
+import org.mxchange.jusercore.model.resendlink.ResendLinkSessionBeanRemote;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
@Inject
private AddressbookUserWebSessionController userController;
+ /**
+ * Event being fired after confirmation link is being sent
+ */
+ @Inject
+ @Any
+ private Event<ObservableUserResendLinkAccountEvent> userResendLinkEvent;
+
/**
* Default constructor
*/
this.clear();
// 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
+ this.showFacesMessage("form_resend_link:", "ERROR_USER_EMAIL_ADDRESS_NOT_FOUND"); //NOI18N
+ return ""; //NOI18N
}
// Is the user account already confirmed?
this.clear();
// Then abort here
- this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusConfirmedException(user)); //NOI18N
+ this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_STATUS_ALREADY_CONFIRMED"); //NOI18N
return ""; //NOI18N
} else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
// Always clear bean
this.clear();
// User account is locked
- this.showFacesMessage("form_resend_link:resendEmailAddress", new UserStatusLockedException(user)); //NOI18N
+ this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_STATUS_LOCKED"); //NOI18N
return ""; //NOI18N
} else if (user.getUserConfirmKey() == null) {
// Status is UNCONFIRMED but confirmation key is NULL
throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
}
- // Get base URL
- String baseUrl = FacesUtils.generateBaseUrl();
+ try {
+ // Get base URL
+ String baseUrl = FacesUtils.generateBaseUrl();
+
+ // Call EJB and return redirect target
+ this.resendLinkBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+ } catch (final UserNotFoundException ex) {
+ // User not found
+ this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_NOT_FOUND"); //NOI18N
+ return ""; //NOI18N
+ } catch (final UserStatusLockedException | UserStatusConfirmedException ex) {
+ // Output message, this should not happen as the confirmation key is being removed
+ this.showFacesMessage("form_resend_link:resendEmailAddress", ex); //NOI18N
+ return ""; //NOI18N
+ }
- // Call EJB and return redirect target
- this.resendLinkBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl);
+ // Fire event
+ this.userResendLinkEvent.fire(new UserResendLinkAccountEvent(user));
// Clear this bean
this.clear();
// Return redirect target
- return "resend_done"; //NOI18N
+ return "user_resend_done"; //NOI18N
}
@Override
Context context = new InitialContext();
// Try to lookup
- this.resendLinkBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.addressbook.beans.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
+ this.resendLinkBean = (ResendLinkSessionBeanRemote) context.lookup("java:global/addressbook-ejb/resendLink!org.mxchange.jusercore.model.resendlink.ResendLinkSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* 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
-# Copyright (C) 2016 Roland H\u00e4der
+# Copyright (C) 2016, 2017 Roland H\u00e4der
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
-# Copyright (C) 2016 Roland H\u00e4der
+# Copyright (C) 2016, 2017 Roland H\u00e4der
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
</li>
</ui:fragment>
- <li class="footer_copyright">Copyright (c) 2017 Roland Häder</li>
+ <li class="footer_copyright">Copyright (c) 2016, 2017 Roland Häder</li>
</ul>
</footer>