Package javax.mail

Examples of javax.mail.Flags$Flag


        for (int j=0; j < MESSAGE_PER_MAILBOX_COUNT; j++) {
            messageManager.appendMessage(new ByteArrayInputStream(MockMail.MAIL_TEXT_PLAIN.getBytes("UTF-8")),
                    Calendar.getInstance().getTime(),
                    mailboxSession,
                    true,
                    new Flags(Flags.Flag.RECENT));
        }
        getMockMailboxManager().endProcessingRequest(mailboxSession);
    }
View Full Code Here


                }
                propertyBuilder.setTextualLineCount(lines);
            }
           
            final Flags flags;
            if (flagsToBeSet == null) {
                flags = new Flags();
            } else {
                flags = flagsToBeSet;

                // Check if we need to trim the flags
                trimFlags(flags, mailboxSession);

            }
            if (isRecent) {
                flags.add(Flags.Flag.RECENT);
            }
            if (internalDate == null) {
                internalDate = new Date();
            }
            byte[] discard = new byte[4096];
View Full Code Here

     * @see {@link Mailbox#getMetaData(boolean, MailboxSession, FetchGroup)}
     */
    public MetaData getMetaData(boolean resetRecent, MailboxSession mailboxSession,
            org.apache.james.mailbox.MessageManager.MetaData.FetchGroup fetchGroup) throws MailboxException {
        final List<Long> recent = recent(resetRecent, mailboxSession);
        final Flags permanentFlags = getPermanentFlags(mailboxSession);
        final long uidValidity = getMailboxEntity().getUidValidity();
        final long uidNext = mapperFactory.getMessageMapper(mailboxSession).getLastUid(mailbox) +1;
        final long highestModSeq =  mapperFactory.getMessageMapper(mailboxSession).getHighestModSeq(mailbox);
        final long messageCount;
        final long unseenCount;
View Full Code Here

     * @param flags
     * @param session
     */
    private void trimFlags(Flags flags, MailboxSession session) {
       
        Flags permFlags = getPermanentFlags(session);
       
        Flag[] systemFlags = flags.getSystemFlags();
        for (int i = 0; i <  systemFlags.length; i++) {
            Flag f = systemFlags[i];
           
            if (f != Flag.RECENT && permFlags.contains(f) == false) {
                flags.remove(f);
            }
        }
        // if the permFlags contains the special USER flag we can skip this as all user flags are allowed
        if (permFlags.contains(Flags.Flag.USER) == false) {
            String[] uFlags = flags.getUserFlags();
            for (int i = 0; i <uFlags.length; i++) {
                String uFlag = uFlags[i];
                if (permFlags.contains(uFlag) == false) {
                    flags.remove(uFlag);
                }
            }
        }
     
View Full Code Here

                // Conver to MessageRanges so we may be able to optimize the flag update
                List<MessageRange> ranges = MessageRange.toRanges(members);
                for (MessageRange range:ranges) {
                    if (reset) {
                        // only call save if we need to
                        messageMapper.updateFlags(getMailboxEntity(), new Flags(Flag.RECENT), false, false, range);
                    }
                }
                return members;
            }
           
View Full Code Here

    /**
     * @see org.apache.james.mailbox.store.mail.model.MailboxMembership#createFlags()
     */
    public final Flags createFlags() {
        final Flags flags = new Flags();

        if (isAnswered()) {
            flags.add(Flags.Flag.ANSWERED);
        }
        if (isDeleted()) {
            flags.add(Flags.Flag.DELETED);
        }
        if (isDraft()) {
            flags.add(Flags.Flag.DRAFT);
        }
        if (isFlagged()) {
            flags.add(Flags.Flag.FLAGGED);
        }
        if (isRecent()) {
            flags.add(Flags.Flag.RECENT);
        }
        if (isSeen()) {
            flags.add(Flags.Flag.SEEN);
        }
        String[] userFlags = createUserFlags();
        if (userFlags != null && userFlags.length > 0) {
            for (int i = 0; i < userFlags.length; i++) {
                flags.add(userFlags[i]);
            }
        }
        return flags;
    }
View Full Code Here

                    if (modSeqProvider != null) {
                        modSeq = modSeqProvider.nextModSeq(mailboxSession, mailbox);
                    }
                }
                for (final Message<Id> member : members) {
                    Flags originalFlags = member.createFlags();
                    if (replace) {
                        member.setFlags(flags);
                    } else {
                        Flags current = member.createFlags();
                        if (value) {
                            current.add(flags);
                        } else {
                            current.remove(flags);
                        }
                        member.setFlags(current);
                    }
                    Flags newFlags = member.createFlags();
                    if (UpdatedFlags.flagsChanged(originalFlags, newFlags)) {
                        // increase the mod-seq as we changed the flags
                        member.setModSeq(modSeq);
                        save(mailbox, member);
                    }
View Full Code Here

    /**
     * This implementation allow to store ANY user flag in a permanent manner
     */
    @Override
    protected Flags getPermanentFlags(MailboxSession session) {
        Flags perm =  super.getPermanentFlags(session);
        perm.add(Flags.Flag.USER);
        return perm;
    }
View Full Code Here

    /**
     * @see org.apache.james.imap.Message.mail.model.Document#createFlags()
     */
    public Flags createFlags() {
        final Flags flags = new Flags();

        if (isAnswered()) {
            flags.add(Flags.Flag.ANSWERED);
        }
        if (isDeleted()) {
            flags.add(Flags.Flag.DELETED);
        }
        if (isDraft()) {
            flags.add(Flags.Flag.DRAFT);
        }
        if (isFlagged()) {
            flags.add(Flags.Flag.FLAGGED);
        }
        if (isRecent()) {
            flags.add(Flags.Flag.RECENT);
        }
        if (isSeen()) {
            flags.add(Flags.Flag.SEEN);
        }
        return flags;
    }
View Full Code Here

    /**
     * Support user flags
     */
    @Override
    protected Flags getPermanentFlags(MailboxSession session) {
        Flags flags =  super.getPermanentFlags(session);
        flags.add(Flags.Flag.USER);
        return flags;
    }
View Full Code Here

TOP

Related Classes of javax.mail.Flags$Flag

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.