@Override public String deleteSubscription() { try { INewsletterManager newsletterManager = this.getNewsletterManager(); Subscriber subscriber = newsletterManager.loadSubscriber(this.getMailAddress()); if (null != subscriber) { newsletterManager.deleteSubscriber(this.getMailAddress()); } else { String[] args = {this.getMailAddress()}; this.addActionError(this.getText("jpnewsletter.messsage.emailNotPresent", args)); return INPUT; } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "deleteSubscriber"); return FAILURE; } return SUCCESS; }
@Override public String addSubscription() { try { String mailAddress = this.getMailAddress(); INewsletterManager newsletterManager = this.getNewsletterManager(); Subscriber subscriber = newsletterManager.loadSubscriber(mailAddress); if (subscriber == null) { newsletterManager.addSubscriber(mailAddress); } else if (!subscriber.isActive()) { newsletterManager.resetSubscriber(mailAddress); } else { return INPUT; } } catch (Throwable t) { ApsSystemUtils.logThrowable( t, this, "addSubscription", "Errore durante l'aggiunta di una sottoscrizione"); return FAILURE; } return SUCCESS; }