本文整理匯總了Java中javax.mail.Flags.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Flags.add方法的具體用法?Java Flags.add怎麽用?Java Flags.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.mail.Flags
的用法示例。
在下文中一共展示了Flags.add方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createMimeMessageInFolder
import javax.mail.Flags; //導入方法依賴的package包/類
/**
* Creates the EML message in the specified folder.
*
* @param folderFileInfo The folder to create message in.
* @param message The original MimeMessage.
* @return ID of the new message created
* @throws FileNotFoundException
* @throws FileExistsException
* @throws MessagingException
* @throws IOException
*/
private long createMimeMessageInFolder(
FileInfo folderFileInfo,
MimeMessage message,
Flags flags)
throws FileExistsException, FileNotFoundException, IOException, MessagingException
{
String name = AlfrescoImapConst.MESSAGE_PREFIX + GUID.generate();
FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
FileInfo messageFile = fileFolderService.create(folderFileInfo.getNodeRef(), name, ContentModel.TYPE_CONTENT);
final long newMessageUid = (Long) messageFile.getProperties().get(ContentModel.PROP_NODE_DBID);
name = AlfrescoImapConst.MESSAGE_PREFIX + newMessageUid + AlfrescoImapConst.EML_EXTENSION;
fileFolderService.rename(messageFile.getNodeRef(), name);
Flags newFlags = new Flags(flags);
newFlags.add(Flag.RECENT);
imapService.setFlags(messageFile, newFlags, true);
if (extractAttachmentsEnabled)
{
imapService.extractAttachments(messageFile.getNodeRef(), message);
}
// Force persistence of the message to the repository
new IncomingImapMessage(messageFile, serviceRegistry, message);
return newMessageUid;
}
示例3: getFlags
import javax.mail.Flags; //導入方法依賴的package包/類
/**
* Return flags that belong to the specified imap folder.
*
* @param messageInfo imap folder info.
* @return flags.
*/
public Flags getFlags(FileInfo messageInfo)
{
Flags flags = new Flags();
Map<QName, Serializable> props = nodeService.getProperties(messageInfo.getNodeRef());
for (QName key : qNameToFlag.keySet())
{
Boolean value = (Boolean) props.get(key);
if (value != null && value)
{
flags.add(qNameToFlag.get(key));
}
}
return flags;
}
示例4: copyMessage
import javax.mail.Flags; //導入方法依賴的package包/類
public long copyMessage(long uid, MailFolder toFolder)
throws FolderException {
SimpleStoredMessage originalMessage = getMessage(uid);
MimeMessage newMime = null;
try {
newMime = new MimeMessage(originalMessage.getMimeMessage());
} catch (MessagingException e) {
// TODO chain.
throw new FolderException("Messaging exception: " + e.getMessage());
}
Flags newFlags = new Flags();
newFlags.add(originalMessage.getFlags());
Date newDate = originalMessage.getInternalDate();
return toFolder.appendMessage(newMime, newFlags, newDate);
}
示例5: setFlag
import javax.mail.Flags; //導入方法依賴的package包/類
public void setFlag(String flagString, Flags flags) throws ProtocolException {
if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED)) {
flags.add(Flags.Flag.ANSWERED);
} else if (flagString.equalsIgnoreCase(MessageFlags.DELETED)) {
flags.add(Flags.Flag.DELETED);
} else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT)) {
flags.add(Flags.Flag.DRAFT);
} else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED)) {
flags.add(Flags.Flag.FLAGGED);
} else if (flagString.equalsIgnoreCase(MessageFlags.SEEN)) {
flags.add(Flags.Flag.SEEN);
} else if (flagString.equalsIgnoreCase(MessageFlags.RECENT)) {
flags.add(Flags.Flag.RECENT);
} else {
// User flag
flags.add(flagString);
}
}
示例6: copyOrMoveNode
import javax.mail.Flags; //導入方法依賴的package包/類
/**
* Moves the node <code>sourceNodeRef</code> extracted from the message id.
* A part of a complex move operation.
*
* @param folderInfo FileInfo
* @param message MimeMessage
* @param flags Flags
* @param sourceNodeRef NodeRef
* @return UUID of the moved node
* @throws FileExistsException
* @throws FileNotFoundException
*/
@SuppressWarnings("deprecation")
private long copyOrMoveNode(FileInfo folderInfo, MimeMessage message, Flags flags, NodeRef sourceNodeRef, boolean move)
throws FileExistsException, FileNotFoundException
{
FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
FileFilterMode.setClient(FileFilterMode.Client.imap);
FileInfo messageFile = null;
if (move)
{
fileFolderService.setHidden(sourceNodeRef, false);
messageFile = fileFolderService.move(sourceNodeRef, folderInfo.getNodeRef(), null);
}
else
{
NodeRef newNodeRef = serviceRegistry.getCopyService().copyAndRename(sourceNodeRef, folderInfo.getNodeRef(), ContentModel.ASSOC_CONTAINS, null, false);
fileFolderService.setHidden(newNodeRef, false);
messageFile = fileFolderService.getFileInfo(newNodeRef);
}
final long newMessageUid = (Long) messageFile.getProperties().get(ContentModel.PROP_NODE_DBID);
imapService.persistMessageHeaders(messageFile.getNodeRef(), message);
Flags newFlags = new Flags(flags);
newFlags.add(Flag.RECENT);
imapService.setFlags(messageFile, newFlags, true);
imapService.setFlag(messageFile, Flag.DELETED, false);
return newMessageUid;
}
示例7: 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);
}
示例8: setFlag
import javax.mail.Flags; //導入方法依賴的package包/類
public void setFlag(String flagString, Flags flags) throws ProtocolException {
if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED)) {
flags.add(Flags.Flag.ANSWERED);
} else if (flagString.equalsIgnoreCase(MessageFlags.DELETED)) {
flags.add(Flags.Flag.DELETED);
} else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT)) {
flags.add(Flags.Flag.DRAFT);
} else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED)) {
flags.add(Flags.Flag.FLAGGED);
} else if (flagString.equalsIgnoreCase(MessageFlags.SEEN)) {
flags.add(Flags.Flag.SEEN);
} else {
throw new ProtocolException("Invalid flag string.");
}
}
示例9: storeFlags
import javax.mail.Flags; //導入方法依賴的package包/類
private void storeFlags(SimpleStoredMessage storedMessage, StoreDirective directive, Flags newFlags) {
Flags messageFlags = storedMessage.getFlags();
if (directive.getSign() == 0) {
messageFlags.remove(MessageFlags.ALL_FLAGS);
messageFlags.add(newFlags);
} else if (directive.getSign() < 0) {
messageFlags.remove(newFlags);
} else if (directive.getSign() > 0) {
messageFlags.add(newFlags);
}
}
示例10: execute
import javax.mail.Flags; //導入方法依賴的package包/類
public void execute(Pop3Connection conn, Pop3State state,
String cmd) {
try {
MailFolder inbox = state.getFolder();
String[] cmdLine = cmd.split(" ");
String msgNumStr = cmdLine[1];
List msgList = inbox.getMessages(new MsgRangeFilter(msgNumStr, false));
if (msgList.size() != 1) {
conn.println("-ERR no such message");
return;
}
SimpleStoredMessage msg = (SimpleStoredMessage) msgList.get(0);
Flags flags = msg.getFlags();
if (flags.contains(Flags.Flag.DELETED)) {
conn.println("-ERR message already deleted");
return;
}
flags.add(Flags.Flag.DELETED);
conn.println("+OK message scheduled for deletion");
} catch (Exception e) {
conn.println("-ERR " + e);
}
}
示例11: 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);
}