/** * @see * org.apache.james.mailbox.store.user.SubscriptionMapper#findMailboxSubscriptionForUser(java.lang.String, * java.lang.String) */ public Subscription findMailboxSubscriptionForUser(String user, String mailbox) { final List<Subscription> subscriptions = subscriptionsByUser.get(user); Subscription result = null; if (subscriptions != null) { for (Subscription subscription : subscriptions) { if (subscription.getMailbox().equals(mailbox)) { result = subscription; break; } } } return result; }
/** * @see * org.apache.james.mailbox.store.user.SubscriptionMapper#delete(org.apache.james.mailbox.store.user.model.Subscription) */ public synchronized void delete(Subscription subscription) { final String user = subscription.getUser(); final List<Subscription> subscriptions = subscriptionsByUser.get(user); if (subscriptions != null) { subscriptions.remove(subscription); } }
/** * @see * org.apache.james.mailbox.store.user.SubscriptionMapper#save(org.apache.james.mailbox.store.user.model.Subscription) */ public synchronized void save(Subscription subscription) { final String user = subscription.getUser(); final List<Subscription> subscriptions = subscriptionsByUser.get(user); if (subscriptions == null) { final List<Subscription> newSubscriptions = new ArrayList<Subscription>(); newSubscriptions.add(subscription); subscriptionsByUser.put(user, newSubscriptions); } else { subscriptions.add(subscription); } }