public void transfer(TransferResult tr) {
    this.transferResult = tr;
    tr.setTransfer(this);
    if (!beforeExport()) return;
    for (final TransferListener listener : listeners) {
      listener.onStart(tr);
    }
    while (hasNext()) {
      next();
      int errors = tr.errors();
      // 实体转换开始
      for (final TransferListener listener : listeners) {
        listener.onItemStart(tr);
      }
      long transferItemStart = System.currentTimeMillis();
      // 进行转换
      transferItem();
      // 如果导出过程中没有错误，将成功记录数增一
      if (tr.errors() == errors) {
        this.success++;
      } else {
        this.fail++;
      }
      logger.debug("tranfer item:{}  take time:{}", String.valueOf(getTranferIndex()),
          String.valueOf(System.currentTimeMillis() - transferItemStart));
      // 实体转换结束
      for (final TransferListener listener : listeners) {
        listener.onItemFinish(tr);
      }
    }
    for (final TransferListener listener : listeners) {
      listener.onFinish(tr);
    }
    // 告诉输出者,输出完成
    writer.flush();
  }
public void transfer ( TransferResult tr ) { this . transferResult = tr ; tr . setTransfer ( this ) ; if ( ! beforeExport ( ) ) return ; for ( final TransferListener listener : listeners ) { listener . onStart ( tr ) ; } while ( hasNext ( ) ) { next ( ) ; int errors = tr . errors ( ) ; for ( final TransferListener listener : listeners ) { listener . onItemStart ( tr ) ; } long transferItemStart = System . currentTimeMillis ( ) ; transferItem ( ) ; if ( tr . errors ( ) == errors ) { this . success ++ ; } else { this . fail ++ ; } logger . debug ( "tranfer item:{}  take time:{}" , String . valueOf ( getTranferIndex ( ) ) , String . valueOf ( System . currentTimeMillis ( ) - transferItemStart ) ) ; for ( final TransferListener listener : listeners ) { listener . onItemFinish ( tr ) ; } } for ( final TransferListener listener : listeners ) { listener . onFinish ( tr ) ; } writer . flush ( ) ; }
{@inheritDoc}