當前位置: 首頁>>代碼示例>>Java>>正文


Java Flags.Flag方法代碼示例

本文整理匯總了Java中javax.mail.Flags.Flag方法的典型用法代碼示例。如果您正苦於以下問題:Java Flags.Flag方法的具體用法?Java Flags.Flag怎麽用?Java Flags.Flag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.mail.Flags的用法示例。


在下文中一共展示了Flags.Flag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: changeStatus

import javax.mail.Flags; //導入方法依賴的package包/類
public void changeStatus( String folderName, long mailIDs[], Flags.Flag newFlag, boolean value ){
  try{
  
    Folder folderToUse = mailStore.getFolder(folderName);
    folderToUse.open( Folder.READ_WRITE );
    
    Flags f = new Flags();
    f.add( newFlag );
	
	Message mlist[];
	if ( folderToUse instanceof UIDFolder )
		mlist = ((UIDFolder)folderToUse).getMessagesByUID( mailIDs );
	else
		mlist = folderToUse.getMessages( returnToInts(mailIDs) );
	
	for ( int x=0; x < mlist.length; x++ )
		mlist[x].setFlags( f, value );
    
    folderToUse.close( true );
	setData( "succeeded", 	cfBooleanData.TRUE );
  
  } catch (Exception E ){
	setData( "errortext", 	new cfStringData( E.getMessage() ) );
	setData( "succeeded", 	cfBooleanData.FALSE );
  }
}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:27,代碼來源:cfImapConnection.java

示例2: getEventType

import javax.mail.Flags; //導入方法依賴的package包/類
public static int getEventType(Flags.Flag flag, boolean flagState) {
    int eventType = FLAGS_CHANGED;

    if (flag.equals(Flags.Flag.DELETED))
        eventType |= DELETED;
    else if (flag.equals(Flags.Flag.SEEN))
        eventType |= SEEN;
    else if (flag.equals(Flags.Flag.RECENT))
        eventType |= RECENT;
    else if (flag.equals(Flags.Flag.DRAFT))
        eventType |= DRAFT;
    else if (flag.equals(Flags.Flag.ANSWERED))
        eventType |= ANSWERED;
    else if (flag.equals(Flags.Flag.FLAGGED))
        eventType |= FLAGGED;
    else if (flag.equals(Flags.Flag.USER))
        eventType |= USER;
    if (flagState)
        eventType |= ISSET;
    return eventType;
}
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:22,代碼來源:FlagChangedEvent.java

示例3: setFlags

import javax.mail.Flags; //導入方法依賴的package包/類
public void setFlags(Flags f, boolean set)
            throws MessagingException {
        final Flags.Flag[] flags = f.getSystemFlags();
        boolean changed = false;

        for (int i = 0; i < flags.length; i++)
            changed = changed | (_setFlag(flags[i], set));

        log.debug("setFlags() changed: " + changed);

        if (!changed)
            return;

//        try {
//            updateFilename();
//        } catch (MessagingException mex) {
//            log.error(mex.toString());
//        }

        ((MaildirFolder) getFolder()).localNotifyMessageChangedListeners(MessageChangedEvent.FLAGS_CHANGED, FlagChangedEvent.getEventType(f, set), this);
    }
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:22,代碼來源:MaildirMessage.java

示例4: getInfo

import javax.mail.Flags; //導入方法依賴的package包/類
public String getInfo() {
    if (modified) {
        final StringBuffer sb = new StringBuffer();
        final Flags.Flag[] flgs = flags.getSystemFlags();
        if (flgs.length > 0)
            sb.append(colon).append("2,");

        for (int i = flgs.length - 1; i >= 0; i--) {
            if (flgs[i] == Flags.Flag.SEEN)
                sb.append('S');
            else if (flgs[i] == Flags.Flag.ANSWERED)
                sb.append('R');
            else if (flgs[i] == Flags.Flag.DELETED)
                sb.append('T');
            else if (flgs[i] == Flags.Flag.DRAFT)
                sb.append('D');
            else if (flgs[i] == Flags.Flag.FLAGGED)
                sb.append('F');
        }
        info = sb.toString();
    }
    return info;
}
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:24,代碼來源:MaildirFilename.java

示例5: getFlaggedCount

import javax.mail.Flags; //導入方法依賴的package包/類
/**
 * Checks whether given flag is set or unset.
 * Example: to check for unseen messages call: getFlaggedCount(dir, Flags.Flag.SEEN, false)
 *
 * @param dir
 * @param flag
 * @param flagState
 * @return
 */
public final static int getFlaggedCount(File dir, Flags.Flag flag, boolean flagState) {
    final File[] files = dir.listFiles();
    if (files == null)
        return 0;

    int result = 0;
    for (int i = 0; i < files.length; i++) {
        //check ".nfs*" files to avoid adding deleted NFS files
        if (!files[i].isFile()
                || files[i].getName().startsWith(".nfs")) {
            continue;
        }
        //TODO: should we extend MaildirFilename from File?
        final MaildirFilename mfn = new MaildirFilename(files[i]);

        if (mfn.getFlag(flag) == flagState)
            result++;
    }

    return result;
}
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:31,代碼來源:MaildirUtils.java

示例6: setFlags

import javax.mail.Flags; //導入方法依賴的package包/類
/**
 * Set flags to the specified imapFolder.
 * 
 * @param messageInfo FileInfo of imap Folder.
 * @param flags flags to set.
 * @param value value to set.
 */
public void setFlags(FileInfo messageInfo, Flags flags, boolean value)
{
    checkForFlaggableAspect(messageInfo.getNodeRef());
    

    for (Flags.Flag flag : flags.getSystemFlags())
    {
        setFlag(messageInfo, flag, value);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ImapServiceImpl.java

示例7: isNew

import javax.mail.Flags; //導入方法依賴的package包/類
/**  
 * 【判斷此郵件是否已讀,如果未讀返回返回false,反之返回true】  
 */  
public boolean isNew() throws MessagingException {   
    boolean isnew = false;   
    Flags flags = ((Message) mimeMessage).getFlags();   
    Flags.Flag[] flag = flags.getSystemFlags();   
    logger.info("flags's length: " + flag.length);   
    for (int i = 0; i < flag.length; i++) {   
        if (flag[i] == Flags.Flag.SEEN) {   
            isnew = true;   
            logger.info("seen Message.......");   
            break;   
        }   
    }   
    return isnew;   
}
 
開發者ID:tiglabs,項目名稱:jsf-core,代碼行數:18,代碼來源:ReciveMail.java

示例8: isSet

import javax.mail.Flags; //導入方法依賴的package包/類
@Override
public boolean isSet(Flags.Flag flag) throws RuntimeMessagingException {
  try {
    return delegate.isSet(flag);
  } catch (MessagingException e) {
    throw new RuntimeMessagingException(e);
  }
}
 
開發者ID:google,項目名稱:mail-importer,代碼行數:9,代碼來源:JavaxMailMessage.java

示例9: setFlag

import javax.mail.Flags; //導入方法依賴的package包/類
@Override
public void setFlag(Flags.Flag flag, boolean set)
    throws RuntimeMessagingException {
  try {
    delegate.setFlag(flag, set);
  } catch (MessagingException e) {
    throw new RuntimeMessagingException(e);
  }
}
 
開發者ID:google,項目名稱:mail-importer,代碼行數:10,代碼來源:JavaxMailMessage.java

示例10: createFlagSearchTerm

import javax.mail.Flags; //導入方法依賴的package包/類
private static SearchTerm createFlagSearchTerm(String pFlagName, boolean pValue) {
    Flags.Flag flag = toFlag(pFlagName);
    Flags flags = new javax.mail.Flags();
    if(null==flag) { // user flags
        flags.add(pFlagName);
    }
    else {
        flags.add(flag);
    }
    return new FlagTerm(flags, pValue);
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:12,代碼來源:SearchTermBuilder.java

示例11: setFlag

import javax.mail.Flags; //導入方法依賴的package包/類
public void setFlag(Flags.Flag f, boolean set)
            throws MessagingException {

        if (!_setFlag(f, set))
            return;

//        try {
//            updateFilename();
//        } catch (MessagingException mex) {
//            log.error(mex.toString());
//        }

        log.debug("notifying MessageChangedListeners");
        ((MaildirFolder) getFolder()).localNotifyMessageChangedListeners(MessageChangedEvent.FLAGS_CHANGED, FlagChangedEvent.getEventType(f, set), this);
    }
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:16,代碼來源:MaildirMessage.java

示例12: _setFlag

import javax.mail.Flags; //導入方法依賴的package包/類
private boolean _setFlag(Flags.Flag f, boolean set) {
    boolean changed = false;

    if (set) {
        changed = (!getFlags().contains(f));
        mfn.setFlag(f);
    } else {
        changed = (getFlags().contains(f));
        mfn.removeFlag(f);
    }

    return changed;
}
 
開發者ID:rektide,項目名稱:javamaildir,代碼行數:14,代碼來源:MaildirMessage.java

示例13: createFlagSearchTerm

import javax.mail.Flags; //導入方法依賴的package包/類
private static SearchTerm createFlagSearchTerm(String pFlagName, boolean pValue) {
    Flags.Flag flag = toFlag(pFlagName);
    Flags flags = new javax.mail.Flags();
    if (null == flag) { // user flags
        flags.add(pFlagName);
    } else {
        flags.add(flag);
    }
    return new FlagTerm(flags, pValue);
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:11,代碼來源:SearchTermBuilder.java

示例14: isSet

import javax.mail.Flags; //導入方法依賴的package包/類
public boolean isSet(Flags.Flag flag) {
    try {
        return getMimeMessage().isSet(flag);
    } catch (MessagingException e) {
        throw new IllegalStateException("Can not access flag " + flag, e);
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:8,代碼來源:StoredMessage.java

示例15: setFlag

import javax.mail.Flags; //導入方法依賴的package包/類
public void setFlag(Flags.Flag flag, boolean value) {
    try {
        getMimeMessage().setFlag(flag, value);
    } catch (MessagingException e) {
        throw new IllegalStateException("Can not set flag " + flag + " to " + value, e);
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:8,代碼來源:StoredMessage.java


注:本文中的javax.mail.Flags.Flag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。