当前位置: 首页>>代码示例>>Java>>正文


Java ComparisonTerm类代码示例

本文整理汇总了Java中javax.mail.search.ComparisonTerm的典型用法代码示例。如果您正苦于以下问题:Java ComparisonTerm类的具体用法?Java ComparisonTerm怎么用?Java ComparisonTerm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComparisonTerm类属于javax.mail.search包,在下文中一共展示了ComparisonTerm类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: asNum

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
int asNum() {
    switch (this) {
    case LE :
        return ComparisonTerm.LE;
    case LT :
        return ComparisonTerm.LT;
    case EQ :
        return ComparisonTerm.EQ;
    case NE :
        return ComparisonTerm.NE;
    case GT :
        return ComparisonTerm.GT;
    case GE :
        return ComparisonTerm.GE;
    default :
        throw new IllegalArgumentException("Unknown comparison " + this);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:SearchTermBuilder.java

示例2: run

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
public void run()
{
	try
	{
		Properties props = new Properties();
		//props.put("mail.debug", "true");

		Session session = Session.getInstance(props);
		int port = Integer.parseInt(worker.getParams().get("port"));
		String storeType = port == 993 ? "imaps" : "imap";
		Store store = session.getStore(storeType);
		
		logger.info("Request " + worker.getParams().get("host"));

		store.connect(worker.getParams().get("host"), port, worker.getParams().get("username"), worker.getParams().get("password"));

		Folder inbox;
		if(worker.getParams().get("folder") == null || worker.getParams().get("folder").isEmpty())
		{
			inbox = store.getFolder("Inbox");
		}
		else
		{
			inbox = store.getFolder(worker.getParams().get("folder"));
		}

		inbox.open(Folder.READ_ONLY);

		javax.mail.Message[] messages;
		if(worker.getLastRequest() != null)
		{
			messages = inbox.search(new ReceivedDateTerm(ComparisonTerm.GT, worker.getLastRequest()));
		}
		else
		{
			messages = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
		}

		for(int i = 0; i < messages.length; i++)
		{
			String mid = messages[i].getHeader("Message-ID").toString();
			if(mid == null || mid.isEmpty())
			{
				mid = "urn:" + worker.getParams().get("host") + ":" + messages[i].getMessageNumber();
			}

			Address[] addresses = messages[i].getFrom();
			StringBuilder from = new StringBuilder();
			StringBuilder producer = new StringBuilder();
			if(addresses != null && addresses.length >= 1)
			{
				from.append(addresses[0].toString());

				for(int j = 0; j < addresses.length; j++)
				{
					producer.append(addresses[j].toString());
				}
			}

			Message message = new Message();
			message.setMid(mid);
			message.setUrl("mailto://" + from.toString());
			message.setMessage(messages[i].getSubject());
			message.setDate(messages[i].getReceivedDate());
			message.setProducer(producer.toString());

			queue.push(this, message);
		}

		inbox.close(false);
		store.close();
	}
	catch (Exception e)
	{
		logger.error(e.getMessage(), e);
	}
}
 
开发者ID:k42b3,项目名称:quantum,代码行数:78,代码来源:MailImapWorker.java

示例3: setReceivedDateTermEQ

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
* Set filter on message received date.
* @param receiveddate messages will be filtered on receiveddate
* @param notTerm negate condition
*/
  public void setReceivedDateTermEQ(Date receiveddate) {
    if (this.protocol == MailConnectionMeta.PROTOCOL_POP3) {
      log.logError(BaseMessages.getString(PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported"));
    } else {
  	  addSearchTerm(new ReceivedDateTerm(ComparisonTerm.EQ, receiveddate));
    }
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:MailConnection.java

示例4: setReceivedDateTermLT

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
* Set filter on message received date.
* @param futureDate messages will be filtered on futureDate
* @param notTerm negate condition
*/
  public void setReceivedDateTermLT(Date futureDate) {
    if (this.protocol == MailConnectionMeta.PROTOCOL_POP3) {
      log.logError(BaseMessages.getString(PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported"));
    } else {
  	  addSearchTerm(new ReceivedDateTerm(ComparisonTerm.LT, futureDate));
    }
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:MailConnection.java

示例5: setReceivedDateTermGT

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
* Set filter on message received date.
* @param pastDate messages will be filtered on pastDate
* @param notTerm negate condition
*/
  public void setReceivedDateTermGT(Date pastDate) {
    if (this.protocol == MailConnectionMeta.PROTOCOL_POP3) {
      log.logError(BaseMessages.getString(PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported"));
    } else {
  	  addSearchTerm(new ReceivedDateTerm(ComparisonTerm.GT, pastDate));
    }
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:MailConnection.java

示例6: setReceivedDateTermBetween

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
public void setReceivedDateTermBetween(Date beginDate, Date endDate) {
  if (this.protocol == MailConnectionMeta.PROTOCOL_POP3) {
    log.logError(BaseMessages.getString(PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported"));
  } else {
    addSearchTerm(
			new AndTerm(new ReceivedDateTerm(ComparisonTerm.LT, endDate),
			new ReceivedDateTerm(ComparisonTerm.GT, beginDate)));
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:10,代码来源:MailConnection.java

示例7: setReceivedDateTermBetween

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
public void setReceivedDateTermBetween( Date beginDate, Date endDate ) {
  if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
    log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
  } else {
    addSearchTerm( new AndTerm( new ReceivedDateTerm( ComparisonTerm.LT, endDate ), new ReceivedDateTerm(
      ComparisonTerm.GT, beginDate ) ) );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:MailConnection.java

示例8: getCustomSearch

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
@Override
public SearchTerm getCustomSearch(Folder folder) {
  return new ReceivedDateTerm(ComparisonTerm.GE, since);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:5,代码来源:MailEntityProcessor.java

示例9: setReceivedDateTermEQ

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
 * Set filter on message received date.
 *
 * @param receiveddate
 *          messages will be filtered on receiveddate
 * @param notTerm
 *          negate condition
 */
public void setReceivedDateTermEQ( Date receiveddate ) {
  if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
    log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
  } else {
    addSearchTerm( new ReceivedDateTerm( ComparisonTerm.EQ, receiveddate ) );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:MailConnection.java

示例10: setReceivedDateTermLT

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
 * Set filter on message received date.
 *
 * @param futureDate
 *          messages will be filtered on futureDate
 * @param notTerm
 *          negate condition
 */
public void setReceivedDateTermLT( Date futureDate ) {
  if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
    log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
  } else {
    addSearchTerm( new ReceivedDateTerm( ComparisonTerm.LT, futureDate ) );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:MailConnection.java

示例11: setReceivedDateTermGT

import javax.mail.search.ComparisonTerm; //导入依赖的package包/类
/**
 * Set filter on message received date.
 *
 * @param pastDate
 *          messages will be filtered on pastDate
 * @param notTerm
 *          negate condition
 */
public void setReceivedDateTermGT( Date pastDate ) {
  if ( this.protocol == MailConnectionMeta.PROTOCOL_POP3 ) {
    log.logError( BaseMessages.getString( PKG, "MailConnection.Error.ReceivedDatePOP3Unsupported" ) );
  } else {
    addSearchTerm( new ReceivedDateTerm( ComparisonTerm.GT, pastDate ) );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:MailConnection.java


注:本文中的javax.mail.search.ComparisonTerm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。