Package org.xorm.datastore

Examples of org.xorm.datastore.Row


            ResultSet rs = ps.executeQuery();
            Set aliases = query.getAliases();
     
            while (rs.next()) {
                Row row;
                Set columns;
                SQLQuery.Alias alias;
                Table table;

                pos = 0;
                Iterator i = aliases.iterator();
                while (i.hasNext()) {
                    alias = (SQLQuery.Alias) i.next();
                    table = alias.getTable();
                    Set fcs = alias.getFetchColumns();
                    if (!fcs.isEmpty()) {
                        row = new Row(table);
                        Iterator fci = fcs.iterator();
                        while (fci.hasNext()) {
                            Column c = (Column) fci.next();
       
                            // TODO will this be flexible enough?
                            row.setValue(c, rs.getObject(++pos));
                        }
                        if (table.equals(query.getTargetTable())) {
                            list.add(row);
                        } else {
                            extraRows.add(row);
View Full Code Here


   */
  public Object getCacheKey(Object value) {
    if(value == null) {
      return null;
    } else {
      Row row = (Row)value;
      return makeRowPrimaryKey(row.getTable(), row);
    }
  }
View Full Code Here

        if (!txnManaged) {
            forceTransaction();
        }

        InterfaceInvocationHandler handler = InterfaceInvocationHandler.getHandler(o);
        Row row = new Row(mapping.getSource().getColumn().getTable());
        row.setValue(mapping.getSource().getColumn(), owner.getObjectId());
        row.setValue(mapping.getTarget().getColumn(), handler.getObjectId());
        getRows().add(row);
        if (!owner.isDirty()) {
            owner.makeDirty();
        }
        rowToProxy.put(row, o);
View Full Code Here

        Object targetKey = handler.getObjectId();
 
        // Find the row that matches the targetKey
        Iterator i = getRows().iterator();
        while (i.hasNext()) {
            Row row = (Row) i.next();
            if (targetKey.equals(row.getValue(mapping.getTarget().getColumn()))) {
                if (mapping.isMToN()) {
                    markAsDeleted(row);
                }
                i.remove();
                rowToProxy.remove(row);
View Full Code Here

            if (!owner.isDirty()) {
                owner.makeDirty();
            }

            while (i.hasNext()) {
                Row row = (Row) i.next();
                if (mapping.isMToN()) {
                    markAsDeleted(row);
                }
                i.remove();
            }
View Full Code Here

        // Go through Rows and look for references to oldID
        Iterator i = getRows().iterator();
        Column c1 = mapping.getTarget().getColumn();
        Column c2 = mapping.getSource().getColumn();
        while (i.hasNext()) {
            Row row = (Row) i.next();
            if (oldID.equals(row.getValue(c1))) {
                row.setValue(c1, newID);
            }
            if (oldID.equals(row.getValue(c2))) {
                row.setValue(c2, newID);
            }
        }
        // TODO do we need to tell all contained items?
    }
View Full Code Here

  if (!txnManaged) {
      forceTransaction();
  }

  InterfaceInvocationHandler handler = InterfaceInvocationHandler.getHandler(o);
  Row row;
  if (mapping.isMToN()) {
      row = new Row(mapping.getSource().getColumn().getTable());
      row.setValue(mapping.getTarget().getColumn(), handler.getObjectId());
      markAsNew(row);
  } else {
      row = handler.getRow();
  }
  row.setValue(mapping.getSource().getColumn(), owner.getObjectId());
  row.setValue(mapping.getIndexColumn(), new Integer(index));

  ((List) getRows()).add(index, row);
  rowToProxy.put(row, o);

  // TODO: alter indices of all elements > index
View Full Code Here

    }

    protected void reindex(int start, int offset) {
  ListIterator li = ((List) getRows()).listIterator(start);
  while (li.hasNext()) {
      Row row = (Row) li.next();
      int oldIndex = ((Integer) row.getValue(mapping.getIndexColumn()))
    .intValue();
      row.setValue(mapping.getIndexColumn(), new Integer(oldIndex + offset));
      // Mark the row for an update?
  }
    }
View Full Code Here

      if (!getElementType().isInstance(o)) {
    throw new IllegalArgumentException("Collection only accepts " + getElementType());
      }

      InterfaceInvocationHandler handler = InterfaceInvocationHandler.getHandler(o);
      Row row = new Row(mapping.getSource().getColumn().getTable());
      row.setValue(mapping.getSource().getColumn(), owner.getObjectId());
      row.setValue(mapping.getTarget().getColumn(), handler.getObjectId());
      // TODO: set index value to current++

      rowToProxy.put(row, o);
      if (mapping.isMToN()) {
    markAsNew(row);
View Full Code Here

  // TODO: Now update all indices of rows starting at current
  return true;
    }

    public Object get(int index) {
  Row row = (Row) ((List) getRows()).get(index);
  Object o = null;
  if (rowToProxy.containsKey(row)) {
      o = rowToProxy.get(row);
  } else {
      Object key = row.getValue(getKeyColumn());
      o = mgr.lookup(getElementType(), key);
      rowToProxy.put(row, o);
  }
  return o;
    }
View Full Code Here

TOP

Related Classes of org.xorm.datastore.Row

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.