Package com.google.code.lightssh.project.mail.entity

Examples of com.google.code.lightssh.project.mail.entity.EmailContent


 
  /**
   * 邮件入队列
   */
  public void send( String addressee, String subject, String content ){
    EmailContent ec = newTransactionSave(addressee,subject,content);
    //send(ec);
    sendByThreadPool(ec);
  }
View Full Code Here


 
  /**
   * 邮件入队列
   */
  public EmailContent newTransactionSave( String addressee, String subject, String content ){
    EmailContent ec = new EmailContent();
    ec.setType(EmailContent.Type.HTML );
    ec.setStatus( Status.NEW );
    ec.setFailureCount(0);
   
    ec.setAddressee(addressee);
    ec.setSubject(subject);
    ec.setContent(content);
   
    save(ec);
   
    return ec;
    //jobQueueManager.jobInQueue(QUEUE_KEY,ec.getId() );
View Full Code Here

 
  /**
   * 更新状态
   */
  public void updateStatus(boolean success,EmailContent ec ){
    EmailContent entity = dao.read(ec);
    if( success ){
      entity.setFinishedTime(Calendar.getInstance());
      entity.setStatus( Status.SUCCESS );
    }else{
      entity.setStatus( Status.FAILURE );
      entity.incFailureCount( );
      entity.setErrMsg(ec.getErrMsg());
    }
   
    entity.setSender(ec.getSender());
   
    dao.update(entity);
  }
View Full Code Here

 
  /**
   * 重发邮件
   */
  public void resend(EmailContent t ){
    EmailContent ec = updateStatus(t,Status.RESEND);
    if( ec != null){
      sendByThreadPool( ec );
      /*
      jobQueueManager.jobInQueue(
          EmailContentManager.QUEUE_KEY,ec.getId(),2);
 
View Full Code Here

 
  /**
   * 更新状态
   */
  public EmailContent updateStatus(EmailContent t,Status status){
    EmailContent ec = get(t);
    if( ec != null){
      ec.setStatus( status );
      dao.update(ec);
    }
   
    return ec;
  }
View Full Code Here

   */
  public void updateStatus(Collection<Result> results ){
    List<EmailContent> list = new ArrayList<EmailContent>();
   
    for( Result result:results ){
      EmailContent ec = get(result.getKey());
      if( ec == null )
        continue;
     
      list.add(ec);
      if( result.isSuccess() ){
        ec.setFinishedTime(Calendar.getInstance());
        ec.setStatus( Status.SUCCESS );
      }else{
        ec.setStatus( Status.FAILURE );
        if( result.getObject() != null && result.getObject() instanceof JobQueue ){
          JobQueue jq = (JobQueue)result.getObject();
          ec.incFailureCount( jq.getFailureCount());
          ec.setErrMsg(jq.getErrMsg());
        }
      }
    }
   
    dao.update(list);
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.project.mail.entity.EmailContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.