@Override public String removeFromQueue() { try { INewsletterManager newsletterManager = this.getNewsletterManager(); String contentId = this.getContentId(); if (contentId != null) { newsletterManager.removeContentFromQueue(contentId); } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "removeFromQueue"); return FAILURE; } return SUCCESS; }
@Override public String activateSubscription() { try { String token = this.getToken(); INewsletterManager newsletterManager = this.getNewsletterManager(); String mailAddress = newsletterManager.getAddressFromToken(token); if (mailAddress != null && mailAddress.equals(this.getMailAddress())) { newsletterManager.activateSubscriber(mailAddress, token); } else { return INPUT; } } catch (Throwable t) { ApsSystemUtils.logThrowable( t, this, "activateSubscription", "Errore durante l'aggiunta di una sottoscrizione"); return FAILURE; } return SUCCESS; }
@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; }