Package org.eobjects.metamodel

Examples of org.eobjects.metamodel.UpdateableDataContext


  public static OutputWriter getWriter(String filename, final String[] headers, char separatorChar, char quoteChar,
      final InputColumn<?>... columns) {
    CsvOutputWriter outputWriter;
    synchronized (dataContexts) {
      UpdateableDataContext dataContext = dataContexts.get(filename);
      if (dataContext == null) {

        File file = new File(filename);
        File parentFile = file.getParentFile();
        if (parentFile != null && !parentFile.exists()) {
          parentFile.mkdirs();
        }
        dataContext = new CsvDataContext(file, getConfiguration(separatorChar, quoteChar));

        final Schema schema = dataContext.getDefaultSchema();
        dataContext.executeUpdate(new UpdateScript() {
          @Override
          public void run(UpdateCallback callback) {
            TableCreationBuilder tableBuilder = callback.createTable(schema, "table");
            for (String header : headers) {
              tableBuilder.withColumn(header);
            }
            tableBuilder.execute();
          }
        });

        Table table = dataContext.getDefaultSchema().getTables()[0];

        dataContexts.put(filename, dataContext);
        counters.put(filename, new AtomicInteger(1));
        outputWriter = new CsvOutputWriter(dataContext, filename, table, columns);

        // write the headers
      } else {
        Table table = dataContext.getDefaultSchema().getTables()[0];
        outputWriter = new CsvOutputWriter(dataContext, filename, table, columns);
        counters.get(filename).incrementAndGet();
      }
    }
View Full Code Here


  private static final Map<String, UpdateableDataContext> dataContexts = new HashMap<String, UpdateableDataContext>();

  public static OutputWriter getWriter(String filename, String sheetName, final InputColumn<?>... columns) {
    ExcelOutputWriter outputWriter;
    synchronized (dataContexts) {
      UpdateableDataContext dataContext = dataContexts.get(filename);
      if (dataContext == null) {

        File file = new File(filename);
        dataContext = new ExcelDataContext(file);
View Full Code Here

TOP

Related Classes of org.eobjects.metamodel.UpdateableDataContext

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.