private IModel<EmailAddress> emailAddressModel;
public DeleteEmailNotificationPage(PageParameters parameters) {
super(parameters);
EmailAddress emailAddress = LinkUtils.extractEmailFromHashPageParameter(emailAddressService, parameters, getApplication().getHomePage());
emailAddressModel = new GenericEntityModel<Long, EmailAddress>(emailAddress);
addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("home.pageTitle"), HomePage.linkDescriptor()));
addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("notification.email.delete.pageTitle"), getPageClass(), parameters));
add(new Label("pageTitle", new ResourceModel("notification.email.delete.pageTitle")));
add(new Link<EmailAddress>("confirmLink", emailAddressModel) {
private static final long serialVersionUID = 1L;
@Override
public void onClick() {
EmailAddress emailAddress = getModelObject();
try {
userService.doDeleteEmailAddress(emailAddress);
Session.get().success(getString("notification.email.delete.success"));
} catch (Exception e) {
LOGGER.error("Error occured while deleting email", e);