本文整理汇总了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 );
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}