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

Examples of org.apache.james.mailbox.store.user.model.Subscription


        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription == null) {
                        final Subscription newSubscription = createSubscription(session, mailbox);
                        mapper.save(newSubscription);
                    }
                }
               
            });
View Full Code Here


        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription != null) {
                        mapper.delete(subscription);
                    }
                }
View Full Code Here

    /*
     * (non-Javadoc)
     * @see org.apache.james.mailbox.store.StoreSubscriptionManager#createSubscription(org.apache.james.mailbox.MailboxSession, java.lang.String)
     */
    protected Subscription createSubscription(final MailboxSession session, final String mailbox) {
        final Subscription newSubscription = new JPASubscription(session.getUser().getUserName(), mailbox);
        return newSubscription;
    }
View Full Code Here

     * (non-Javadoc)
     * @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;
View Full Code Here

        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription == null) {
                        final Subscription newSubscription = createSubscription(session, mailbox);
                        mapper.save(newSubscription);
                    }
                }
               
            });
View Full Code Here

        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription != null) {
                        mapper.delete(subscription);
                    }
                }
View Full Code Here

        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription == null) {
                        final Subscription newSubscription = createSubscription(session, mailbox);
                        mapper.save(newSubscription);
                    }
                }
               
            });
View Full Code Here

        final SubscriptionMapper mapper = mapperFactory.getSubscriptionMapper(session);
        try {
            mapper.execute(new Mapper.VoidTransaction() {

                public void runVoid() throws MailboxException {
                    final Subscription subscription = mapper.findMailboxSubscriptionForUser(session.getUser().getUserName(), mailbox);
                    if (subscription != null) {
                        mapper.delete(subscription);
                    }
                }
View Full Code Here

    /**
     * @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;
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

TOP

Related Classes of org.apache.james.mailbox.store.user.model.Subscription

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.