Package org.apache.james.mailbox.store.user.model.impl

Examples of org.apache.james.mailbox.store.user.model.impl.SimpleSubscription


     */
    public List<Subscription> findSubscriptionsForUser(String user) throws SubscriptionException {
        Set<String> subscriptionNames = readSubscriptionsForUser(user);
        ArrayList<Subscription> subscriptions = new ArrayList<Subscription>();
        for (String subscription : subscriptionNames) {
            subscriptions.add(new SimpleSubscription(user, subscription));
        }
        return subscriptions;
    }
View Full Code Here


            subscriptionNames = readSubscriptions(userRoot);
        } catch (IOException e) {
            throw new SubscriptionException(e);
        }
        if (subscriptionNames.contains(mailbox))
            return new SimpleSubscription(user, mailbox);
        return null;
    }
View Full Code Here

     * @param session
     * @param mailbox
     * @return subscription
     */
    protected Subscription createSubscription(final MailboxSession session, final String mailbox) {
        return new SimpleSubscription(session.getUser().getUserName(), mailbox);
    }
View Full Code Here

     * @param session
     * @param mailbox
     * @return subscription
     */
    protected Subscription createSubscription(final MailboxSession session, final String mailbox) {
        return new SimpleSubscription(session.getUser().getUserName(), mailbox);
    }
View Full Code Here

    @Override
    public List<Subscription> findSubscriptionsForUser(String user) throws SubscriptionException {
        Set<String> subscriptionNames = readSubscriptionsForUser(user);
        ArrayList<Subscription> subscriptions = new ArrayList<Subscription>();
        for (String subscription : subscriptionNames) {
            subscriptions.add(new SimpleSubscription(user, subscription));
        }
        return subscriptions;
    }
View Full Code Here

            subscriptionNames = readSubscriptions(userRoot);
        } catch (IOException e) {
            throw new SubscriptionException(e);
        }
        if (subscriptionNames.contains(mailbox))
            return new SimpleSubscription(user, mailbox);
        return null;
    }
View Full Code Here

    }

    @Test
    public void testSubscriptionToPut() {
        System.out.println("subscription toPut");
        Subscription subscription = new SimpleSubscription("ieugen", "INBOX");
        Put put = toPut(subscription);
        assertArrayEquals(Bytes.toBytes(subscription.getUser()), put.getRow());
        assertTrue(put.has(SUBSCRIPTION_CF, Bytes.toBytes(subscription.getMailbox()), MARKER_PRESENT));
    }
View Full Code Here

            get.addFamily(SUBSCRIPTION_CF);
            Result result = subscriptions.get(get);

            if (!result.isEmpty()) {
                if (result.containsColumn(SUBSCRIPTION_CF, Bytes.toBytes(mailbox))) {
                    subscription = new SimpleSubscription(user, mailbox);
                    return subscription;
                }
            }
            return null;
        } catch (IOException e) {
View Full Code Here

            get.addFamily(SUBSCRIPTION_CF);
            Result result = subscriptions.get(get);
            if (!result.isEmpty()) {
                List<KeyValue> columns = result.list();
                for (KeyValue key : columns) {
                    subscriptionList.add(new SimpleSubscription(user, Bytes.toString(key.getQualifier())));
                }
            }
            return subscriptionList;
        } catch (IOException e) {
            throw new SubscriptionException(e);
View Full Code Here

        CLUSTER.clearTable(SUBSCRIPTIONS);
    }

    private static void fillSubscriptionList() throws SubscriptionException {
        LOG.info("Creating subscription list");
        SimpleSubscription subscription;
        String user, mailbox;
        subscriptionList = new HashMap<String, List<SimpleSubscription>>();
        for (int i = 0; i < USERS; i++) {
            user = "user" + i;
            final List<SimpleSubscription> mailboxes = new ArrayList<SimpleSubscription>();
            subscriptionList.put(user, mailboxes);

            for (int j = 0; j < MAILBOX_NO; j++) {
                if (j == 0) {
                    mailbox = "INBOX";
                } else {
                    mailbox = "BOX" + j;
                }
                if ((i % 2 == 0) && (j > 0)) {
                    continue;
                }
                subscription = new SimpleSubscription(user, mailbox);
                mailboxes.add(subscription);
                mapper.save(subscription);
                LOG.info("Adding subscription " + subscription);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.store.user.model.impl.SimpleSubscription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.