A Subscription which is stored, along with the associated {@link User}, in a {@link UserDatabase}.
7576777879808182838485
* @param host The name of the mail server host * @return The matching Subscription or null */ private Subscription doFindSubscription(User user, String host) { Subscription subscription; try { subscription = user.findSubscription(host); } catch (NullPointerException e) {
269270271272273274275276277278279
if (user == null) { return doFindLogon(mapping); } // Retrieve the subscription, if there is one Subscription subscription; String host = doGet(form, HOST); boolean updating = (host != null); if (updating) { subscription = doFindSubscription(user, host); if (subscription == null) {
319320321322323324325326327328329
doCancel(session, method, Constants.SUBSCRIPTION_KEY); return doFindSuccess(mapping); } String action = doGet(form, TASK); Subscription subscription = doGetSubscription(request); boolean isDelete = action.equals(Constants.DELETE); if (isDelete) { return doRemoveSubscription(mapping, session, user, subscription); }
468469470471472473474475476
* but the ExceptionHandler in the xwork.xml will catch that for us.</p> * * @return The matching Subscription or null */ public Subscription findSubscription(String host) { Subscription subscription; subscription = getUser().findSubscription(host); return subscription; }
490491492493494495496497498
/** * <p>Provide a "temporary" User Subscription object that can be used to * capture input values.</p> */ public void createInputSubscription() { Subscription sub = new MemorySubscription(getUser(), null); setSubscription(sub); setHost(sub.getHost()); }
504505506507508509510511512513514
* @param host * @return New User Subscription object or null */ public Subscription createSubscription(String host) { Subscription sub; sub = findSubscription(host); if (null != sub) { // FIXME - localization - "error.host.unique")
527528529530531532533534535536537538539
* to capture input values.</p> * * @param host */ public void copySubscription(String host) { Subscription input = getSubscription(); Subscription sub = createSubscription(host); if (null != sub) { BeanUtils.copyProperties(input, sub); setSubscription(sub); setHost(sub.getHost()); } }
550551552553554555556557558559560
* <p>Provide MailServer Host for current User Subscription.</p> * * @return MailServer Host for current User Subscription */ public String getSubscriptionHost() { Subscription sub = getSubscription(); if (null == sub) { return null; } return sub.getHost(); }
5960616263646566676869
253254255256257258259260261262263