Package org.molgenis.util.tuple

Examples of org.molgenis.util.tuple.EntityTuple


      // streaming result!!!!
      List<Tuple> rsList = executeSelect(rules);

      // transform result set in writer
      E entity = create();
      if (writer != null) writer.writeColNames(new EntityTuple(entity).getColNames());
      writer.writeColNames(fieldsToExport);
      int i = 0;
      List<E> entityBatch = new ArrayList<E>();
      for (Tuple row : rsList)
      {
        entity = create();
        entity.set(row);
        entityBatch.add(entity);
        i++;

      }
      // write remaining
      // load mrefs
      logger.debug("*** mapMrefs -> LEFTOVERS"); // program does NOT crash
                            // after this
      mapMrefs(entityBatch);
      for (E e : entityBatch)
      {
        writer.write(new EntityTuple(e));
      }
      entityBatch.clear();
      writer.close();

      logger.debug("find(" + create().getClass().getSimpleName() + ", TupleWriter, " + Arrays.asList(rules)
View Full Code Here


    try
    {
      csvWriter.writeColNames(fieldsToExport);

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

    {
      if (privateTx) getDatabase().beginTx();

      List<E> entities = toList(reader, BATCH_SIZE);

      if (writer != null) writer.writeColNames(new EntityTuple(entities.get(0)).getColNames());

      while (entities.size() > 0)
      {
        // resolve foreign keys
        this.resolveForeignKeys(entities);

        // add to the database
        rowsAffected += getDatabase().add(entities);
        if (writer != null)
        {
          for (E entity : entities)
            writer.write(new EntityTuple(entity));
        }
        entities = toList(reader, BATCH_SIZE);
      }

      if (privateTx) getDatabase().commitTx();
View Full Code Here

    try
    {
      sheetWriter.writeColNames(fieldsToExport);

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

  }

  @Override
  public Tuple getValues()
  {
    return new EntityTuple(this);
  }
View Full Code Here

      List<? extends Entity> entities = q.find();

      List<Tuple> result = new ArrayList<Tuple>();
      for (Entity entity : entities)
      {
        result.add(new EntityTuple(entity));
      }
      return result;
    }
    catch (Exception e)
    {
View Full Code Here

    {
      writer.writeColNames(fieldsToExport);
      int count = 0;
      for (Entity e : find(entityClass, rules))
      {
        writer.write(new EntityTuple(e));

        count++;
      }
      if (logger.isDebugEnabled()) if (logger.isDebugEnabled()) logger.debug(String.format(
          "find(%s, writer) wrote %s lines", entityClass.getSimpleName(), count));
View Full Code Here

        }
        if (match)
        {
          try
          {
            entityInDb.set(new EntityTuple(newEntity), false);
          }
          catch (Exception ex)
          {
            throw new DatabaseException(ex);
          }
View Full Code Here

TOP

Related Classes of org.molgenis.util.tuple.EntityTuple

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.