Package org.beangle.model.transfer.importer

Examples of org.beangle.model.transfer.importer.EntityImporter


        return null;
      }
      String fileName = get(upload + "FileName");
      InputStream is = new FileInputStream(file);
      if (fileName.endsWith(".xls")) {
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new ExcelItemReader(is, 1));
        put("importer", importer);
        return importer;
      } else {
        LineNumberReader reader = new LineNumberReader(new InputStreamReader(is));
        if (null == reader.readLine()) return null;
        reader.reset();
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new CsvItemReader(reader));
        return importer;
      }
    } catch (Exception e) {
      logger.error("error", e);
      return null;
View Full Code Here


   *
   * @return
   */
  public String importData() {
    TransferResult tr = new TransferResult();
    EntityImporter importer = buildEntityImporter();
    if (null == importer) { return forward("/components/importData/error"); }
    configImporter(importer);
    importer.transfer(tr);
    put("importResult", tr);
    if (tr.hasErrors()) {
      return forward("/components/importData/error");
    } else {
      return forward("/components/importData/result");
View Full Code Here

        return null;
      }
      String fileName = get(upload + "FileName");
      InputStream is = new FileInputStream(file);
      if (fileName.endsWith(".xls")) {
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new ExcelItemReader(is, 1));
        put("importer", importer);
        return importer;
      } else {
        LineNumberReader reader = new LineNumberReader(new InputStreamReader(is));
        if (null == reader.readLine()) return null;
        reader.reset();
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new CsvItemReader(reader));
        return importer;
      }
    } catch (Exception e) {
      logger.error("error", e);
      return null;
View Full Code Here

   * @param response
   * @return @
   */
  public String importData() {
    TransferResult tr = new TransferResult();
    EntityImporter importer = buildEntityImporter();
    if (null == importer) { return forward("/components/importData/error"); }
    configImporter(importer);
    importer.transfer(tr);
    put("importResult", tr);
    if (tr.hasErrors()) {
      return forward("/components/importData/error");
    } else {
      return forward("/components/importData/result");
View Full Code Here

        return null;
      }
      String fileName = get(upload + "FileName");
      InputStream is = new FileInputStream(file);
      if (fileName.endsWith(".xls")) {
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new ExcelItemReader(is, 1));
        put("importer", importer);
        return importer;
      } else {
        LineNumberReader reader = new LineNumberReader(new InputStreamReader(is));
        if (null == reader.readLine()) return null;
        reader.reset();
        EntityImporter importer = (clazz == null) ? new DefaultEntityImporter()
            : new DefaultEntityImporter(clazz);
        importer.setReader(new CsvItemReader(reader));
        return importer;
      }
    } catch (Exception e) {
      logger.error("error", e);
      return null;
View Full Code Here

   *
   * @return
   */
  public String importData() {
    TransferResult tr = new TransferResult();
    EntityImporter importer = buildEntityImporter();
    if (null == importer) { return forward("/components/importData/error"); }
    configImporter(importer);
    importer.transfer(tr);
    put("importResult", tr);
    if (tr.hasErrors()) {
      return forward("/components/importData/error");
    } else {
      return forward("/components/importData/result");
View Full Code Here

TOP

Related Classes of org.beangle.model.transfer.importer.EntityImporter

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.