Package org.molgenis.io

Examples of org.molgenis.io.TupleWriter


    OutputStream os = mock(OutputStream.class);
    ExcelWriter excelWriter = new ExcelWriter(os);
    excelWriter.addCellProcessor(processor);
    try
    {
      TupleWriter sheetWriter = excelWriter.createTupleWriter("sheet");
      sheetWriter.writeColNames(Arrays.asList("col1", "col2"));
      sheetWriter.write(row1);
    }
    finally
    {
      excelWriter.close();
    }
View Full Code Here


    OutputStream os = mock(OutputStream.class);
    ExcelWriter excelWriter = new ExcelWriter(os);
    excelWriter.addCellProcessor(processor);
    try
    {
      TupleWriter sheetWriter = excelWriter.createTupleWriter("sheet");
      sheetWriter.writeColNames(Arrays.asList("col1", "col2"));
      sheetWriter.write(dataTuple);
    }
    finally
    {
      excelWriter.close();
    }
View Full Code Here

      tupleTable.setColOffset(0);
      tupleTable.setColLimit(0);
      tupleTable.setOffset(0);
      tupleTable.setLimit(0);

      TupleWriter tupleWriter = excelWriter.createTupleWriter("Sheet1");
      try
      {
        // write header row
        tupleWriter.writeColNames(Iterables.transform(tupleTable.getColumns(), new Function<Field, String>()
        {
          @Override
          @Nullable
          public String apply(@Nullable
          Field field)
          {
            return field != null ? field.getName() : null;
          }
        }));

        // write rows
        for (Iterator<Tuple> it = tupleTable.iterator(); it.hasNext();)
          tupleWriter.write(it.next());
      }
      finally
      {
        IOUtils.closeQuietly(tupleWriter);
View Full Code Here

            out.println(db.count(getClassForName(entityName)));
          }
        }
        else
        {
          TupleWriter csvWriter = new CsvWriter(out);
          try
          {
            if (rulesList != null) db.find(getClassForName(entityName), csvWriter,
                rulesList.toArray(new QueryRule[rulesList.size()]));
            else
            {
              db.find(getClassForName(entityName), csvWriter);
            }
          }
          finally
          {
            csvWriter.close();
          }
        }
      }
      catch (Exception e)
      {
View Full Code Here

      throws ParseException, DatabaseException, Exception
  {
    FormModel<?> view = this.getFormScreen();
    List<String> fieldsToExport = ((FormController<?>) this.getController()).getVisibleColumnNames();
    ExcelWriter excelWriter = new ExcelWriter(xlsDownload);
    TupleWriter sheetWriter = excelWriter.createTupleWriter("Entity");

    try
    {
      sheetWriter.writeColNames(fieldsToExport);

      for (Entity e : view.getRecords())
        sheetWriter.write(new EntityTuple(e));
    }
    finally
    {
      excelWriter.close();
    }
View Full Code Here

    // create query rules
    List<QueryRule> rulesList = createQueryRules(req, klazz);

    // execute query
    TupleWriter csvWriter = new CsvWriter(out);
    try
    {
      db.find(klazz, csvWriter, rulesList.toArray(new QueryRule[rulesList.size()]));
    }
    finally
    {
      csvWriter.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.molgenis.io.TupleWriter

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.