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


Java ReceivedDateTerm类代码示例

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


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

示例1: run

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例2: setReceivedDateTermEQ

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例3: setReceivedDateTermLT

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例4: setReceivedDateTermGT

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例5: setReceivedDateTermBetween

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例6: setReceivedDateTermBetween

import javax.mail.search.ReceivedDateTerm; //导入依赖的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

示例7: received

import javax.mail.search.ReceivedDateTerm; //导入依赖的package包/类
public SearchTermBuilder received(Op op, Comparison comparison, Date date) {
    ReceivedDateTerm st = new ReceivedDateTerm(comparison.asNum(), date);
    addTerm(op, st);
    return this;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:6,代码来源:SearchTermBuilder.java

示例8: getCustomSearch

import javax.mail.search.ReceivedDateTerm; //导入依赖的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.ReceivedDateTerm; //导入依赖的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.ReceivedDateTerm; //导入依赖的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.ReceivedDateTerm; //导入依赖的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.ReceivedDateTerm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。