Package org.beangle.model.transfer.exporter

Examples of org.beangle.model.transfer.exporter.Exporter


import com.opensymphony.xwork2.util.ClassLoaderUtil;

public class ExportHelper {

  public static Exporter buildExporter(Context context) {
    Exporter exporter;
    String template = context.get("template", String.class);
    if (StringUtils.isNotBlank(template)) {
      exporter = new TemplateExporter();
    } else {
      exporter = new SimpleEntityExporter();
    }
    exporter.setWriter(getWriter(context));
    return exporter;
  }
View Full Code Here


      context.put(Context.TITLES, get("titles"));
    }
    context.put(Context.EXTRACTOR, getPropertyExtractor());

    HttpServletResponse response = ServletActionContext.getResponse();
    Exporter exporter = buildExporter(context);
    exporter.getWriter().setOutputStream(response.getOutputStream());
    configExporter(exporter, context);
    if (format.equals(TransferFormats.XLS)) {
      response.setContentType("application/vnd.ms-excel;charset=GBK");
    } else {
      response.setContentType("application/x-msdownload");
    }
    response.setHeader(
        "Content-Disposition",
        "attachment;filename="
            + encodeAttachName(ServletActionContext.getRequest(), fileName + "." + format));
    // 进行输出
    exporter.setContext(context);
    exporter.transfer(new TransferResult());
    return null;
  }
View Full Code Here

    context.put(Context.KEYS, get("keys"));
    context.put(Context.TITLES, get("titles"));
    context.put(Context.EXTRACTOR, getPropertyExtractor());

    HttpServletResponse response = ServletActionContext.getResponse();
    Exporter exporter = buildExporter(context);
    exporter.getWriter().setOutputStream(response.getOutputStream());
    configExporter(exporter, context);
    if (format.equals(TransferFormats.XLS)) {
      response.setContentType("application/vnd.ms-excel;charset=GBK");
    } else {
      response.setContentType("application/x-msdownload");
    }
    response.setHeader(
        "Content-Disposition",
        "attachment;filename="
            + encodeAttachName(ServletActionContext.getRequest(), fileName + "."
                + format));
    // 进行输出
    exporter.setContext(context);
    exporter.transfer(new TransferResult());
    return null;
  }
View Full Code Here

      context.put(Context.TITLES, get("titles"));
    }
    context.put(Context.EXTRACTOR, getPropertyExtractor());

    HttpServletResponse response = ServletActionContext.getResponse();
    Exporter exporter = buildExporter(context);
    exporter.getWriter().setOutputStream(response.getOutputStream());
    configExporter(exporter, context);
    if (format.equals(TransferFormats.XLS)) {
      response.setContentType("application/vnd.ms-excel;charset=GBK");
    } else {
      response.setContentType("application/x-msdownload");
    }
    response.setHeader(
        "Content-Disposition",
        "attachment;filename="
            + encodeAttachName(ServletActionContext.getRequest(), fileName + "." + format));
    // 进行输出
    exporter.setContext(context);
    exporter.transfer(new TransferResult());
    return null;
  }
View Full Code Here

TOP

Related Classes of org.beangle.model.transfer.exporter.Exporter

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.