Package org.xorm.datastore

Examples of org.xorm.datastore.Column


  if (condition == null) {
      xmlResults = new ArrayList();
      xmlResults.add(deriveValue(document.getRootElement(), table.getName()));
  } else if (condition instanceof SimpleCondition) {
      SimpleCondition sc = (SimpleCondition) condition;
      Column column = sc.getColumn();
      Object value = sc.getValue();

      // ".." == (Element) means get all children of an element
      // with an element name matching the table name.

      if ("..".equals(column.getName()) && (value instanceof Element)) {
    Element parent = (Element) value;
    xmlResults =  parent.getChildren(table.getName());
      }
  }
View Full Code Here


    }

    private void populate(Row row, Element element) {
  Iterator j = row.getTable().getColumns().iterator();
  while (j.hasNext()) {
      Column c = (Column) j.next();
      Object value = deriveValue(element, c.getName());
      if (value instanceof String) {
    // Convert to Java Type
    Class javaType = XMLType.forName(c.getType());
    if (javaType != null) {
        value = TypeConverter.convertToType(value, javaType, c.getFormat());
    }
      }
      row.setValue(c, value);
  }
    }
View Full Code Here

    }

    // CRUD methods
    public void create(Row row)  {
        System.out.println("HeapDriver: create " + row.getTable().getName());
        Column c = row.getTable().getPrimaryKey();
        String s = c.getSequence();
        if (c.isAutoIncremented() || (s != null)) {
            row.setValue(c, nextSequenceValue(s));
        }
        factory.getCache().add(row);
    }
View Full Code Here

            if (proxy == null) continue;
            if (proxy instanceof RelationshipProxy) {
                RelationshipProxy rp = (RelationshipProxy) fieldToValue.get(field);
                rp.notifyIDChanged(oldID, newID);
            } else {
                Column column = mapping.getColumn(field);
                Object value = getRow().getValue(column);
                if (oldID.equals(value)) {
                    getRow().setValue(column, newID);
                }
            }
View Full Code Here

        // See if this has a reference that gets to other
        Iterator i = mapping.getRelationships().keySet().iterator();
        while (i.hasNext()) {
            String field = (String) i.next();
            Column column = mapping.getColumn(field);
            if (column != null) {
                Object value = getRow().getValue(column);
                if (other.primaryKey.equals(value)) {
                    return true;
                } else if (value instanceof TransientKey) {
View Full Code Here

    private void initDefaultValues() {
        Iterator i = mapping.getMappedFieldDescriptors().iterator();
        while (i.hasNext()) {
            FieldDescriptor fd =
                (FieldDescriptor) i.next();
            Column c = mapping.getColumn(fd.name);
            if (!c.isReadOnly()) {
                row.setValue(c, fd.type.isPrimitive() ?
                             defaultValue(fd.type) : null);
            }
        }
    }
View Full Code Here

            if (!rows.isEmpty()) {
                Row newFields = (Row) rows.iterator().next();
                // Determine which fields to copy
                Iterator i = dfg.getColumns().iterator();
                while (i.hasNext()) {
                    Column c = (Column) i.next();
                    row.setValue(c, newFields.getValue(c));
                }
            } else {
                throw new JDODataStoreException(I18N.msg("E_row_deleted"));
            }
View Full Code Here

  QueryOrdering[] fieldOrdering = query.getOrdering();
  if (fieldOrdering == null) return null;
  Selector.Ordering[] ordering = new Selector.Ordering [fieldOrdering.length];
  for (int i = 0; i < fieldOrdering.length; i++) {
      String field = fieldOrdering[i].getField();
            Column column = null;

            // Handle a field of a field of a field of a...
            Class currentClass = getCandidateClass();
            StringTokenizer tok = new StringTokenizer(field, ".");
View Full Code Here

  // Do we need a join?
  if (!"contains".equals(name) && !"isEmpty".equals(name)) {
      checkJoin(exp.getOwner());
  }

  Column column = lastColumn;
  // Read the value
  Object param = null;
  Expression operand = null;
  if (!"isEmpty".equals(name)) {
      operand = exp.getParameters()[0];
View Full Code Here

     * the table.  This will include a datastore identity column called
     * "xorm_pk"; other column names will be the same as the field name.
     */
    public void setTable(Table table) {
        boolean fakeTable = false;
        Column pk;
        if (table == null) {
            fakeTable = true;
            table = new Table(clazz.getName());
            pk = new Column(table, "xorm_pk");
            table.addColumn(pk);
            table.setPrimaryKey(pk);
            Iterator i = fields.iterator();
            while (i.hasNext()) {
                FieldDescriptor fd = (FieldDescriptor) i.next();
                Column c = new Column(table, fd.name);
                table.addColumn(c);
                fieldToColumn.put(fd.name, c);
            }
        } else {
            pk = table.getPrimaryKey();
View Full Code Here

TOP

Related Classes of org.xorm.datastore.Column

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.