public Boolean isDuplicated(String mailAddress) throws Throwable { Boolean isDuplicated = true; try { Subscriber duplicated = this.getNewsletterManager().loadSubscriber(mailAddress); if (duplicated == null || !duplicated.isActive()) { isDuplicated = false; } } catch (Throwable t) { throw t; } return isDuplicated; }
@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; }