Package commonj.sdo

Examples of commonj.sdo.Property


    while ( i.hasNext()) {
      System.out.println();
      DataObject obj = (DataObject) i.next();
      Iterator props = obj.getType().getProperties().iterator();
      while ( props.hasNext()) {
        Property p = (Property) props.next();
        if ( p.isMany() ) {
          System.out.print("[ " + p.getName() + " ] ");
          Iterator children = obj.getList(p).iterator();
          while ( children.hasNext()) {
            DataObject child = (DataObject) children.next();
            System.out.print("[ " + child.get("ID") + " ]");
          }
          System.out.println();
        } else if ( !p.getType().isDataType()) {
          DataObject child = obj.getDataObject(p);
          if ( child != null )
            System.out.println("[ " + p.getName() + " ] " + "[ " + child.get("ID") + " ]");
        } else {
          System.out.println("[ " + p.getName() + " ] " + obj.get(p));
        }
      } 
    }
  }
View Full Code Here


    // care
    // of when we process relationships

    Iterator i = this.rootObject.getType().getProperties().iterator();
    while (i.hasNext()) {
      Property p = (Property) i.next();

      if (p.isContainment() && p.getType().equals(tableClass)) {
        if (p.isMany())
          rootObject.getList(p).add(obj);
        // TODO This was a performance optimization for EMF in SDO 1.1,
        // check to see if there is
        // something equivalent in SDO 2.0
        // ((InternalEList) this.dataGraph.eGet(ref)).addUnique(obj);
        else
          this.rootObject.set(p, obj);
      }

    }

    Iterator columnNames = resultMetadata.getColumnNames(
        tableData.getTableName()).iterator();
    while (columnNames.hasNext()) {
      String columnName = (String) columnNames.next();
      DataObject dataObject = (DataObject) obj;
      Property p = findProperty(dataObject.getType(), columnName);
      Object value = tableData.getColumnData(columnName);

      dataObject.set(p, value);
    }
View Full Code Here

  // temporary, ignoring case
  private Property findProperty(Type type, String columnName) {
    Iterator properties = type.getProperties().iterator();
    while (properties.hasNext()) {
      Property p = (Property) properties.next();
      if (columnName.equalsIgnoreCase(p.getName()))
        return p;
    }
    return null;
  }
View Full Code Here

  }

  private Type findTableTypeByPropertyName(String tableName) {
    Iterator i = rootObject.getType().getProperties().iterator();
    while (i.hasNext()) {
      Property p = (Property) i.next();
  //    System.out.println(p.getType().getName());
      if (tableName.equals(p.getType().getName()))
        return p.getType();
    }
   
    return null;
  }
View Full Code Here

    Iterator i = getAttributeProperties(changedObject, config).iterator();

    ArrayList attributes = new ArrayList();
    while (i.hasNext()) {
      Property attr = (Property) i.next();
      if (!table.isGeneratedColumnProperty(attr.getName())) {
        attributes.add(attr.getName());
        parameters.add(changedObject.getType().getProperty(
            attr.getName()));
      }
    }

    statement.append("(");
    Iterator attrs = attributes.iterator();
    while (attrs.hasNext()) {
      String name = (String) attrs.next();
      statement.append("");
      statement.append(name);
      if (attrs.hasNext())
        statement.append(", ");
      else
        statement.append(")");
    }

    statement.append(" values (");
    for (int idx = 1; idx <= attributes.size(); idx++) {
      statement.append('?');
      if (idx < attributes.size())
        statement.append(", ");
      else
        statement.append(")");
    }

    InsertCommandImpl cmd = new InsertCommandImpl(statement.toString());
    Iterator params = parameters.iterator();
    for (int idx = 1; params.hasNext(); idx++) {
      Property property = (Property) params.next();
      Parameter p = new ParameterImpl();
      p.setName(property.getName());
      p.setType(property.getType());
      p.setConverter(getConverter(table, property.getName()));
      p.setIndex(idx);
      cmd.addParameter(p);

    }
    DebugUtil.debugln(getClass(), debug, statement.toString());
View Full Code Here

  private List getAttributeProperties(DataObject obj, MappingWrapper config) {
    ArrayList fields = new ArrayList();
    Iterator i = obj.getType().getProperties().iterator();
    while (i.hasNext()) {
      Property p = (Property) i.next();
      if (p.getType().isDataType()) {
        if (obj.isSet(p))
          fields.add(p);
      } else {
        if ( obj.isSet(p) ) {
          Relationship relationship = config.getRelationshipByReference(p);
          if ( p.getOpposite().isMany() || (hasState(config, relationship, obj))) {             
            RelationshipWrapper r = new RelationshipWrapper(
              relationship);
            Iterator keys = r.getForeignKeys().iterator();
            while (keys.hasNext()) {
              String key = (String) keys.next();
              Property keyProp = obj.getType().getProperty(key);
              fields.add(keyProp);
            }
          }

        }
View Full Code Here

    TableWrapper wrapper = new TableWrapper(table);

    Iterator i = getAttributeProperties(changedObject, config).iterator();

    while (i.hasNext()) {
      Property attr = (Property) i.next();
      if (!wrapper.isGeneratedColumnProperty(attr.getName()))
        parameters.add(changedObject.getType().getProperty(
            attr.getName()));
    }

    return parameters;
  }
View Full Code Here

      DebugUtil.debugln(getClass(), debug, "Child table: " + childTable);

      if ((parentTable == null) || (childTable == null))
        continue;

            Property p = parentTable.getType().getProperty(r.getName());
      setOrAdd(parentTable, childTable, p);
     
    }
  }
View Full Code Here

        DataObject parentTable = findParentTable(table, r, wrapper);
       
        if (parentTable == null)
          continue;

                Property p = parentTable.getType().getProperty(r.getName());
        setOrAdd(parentTable, table, p);
      }
     
    }
  }
View Full Code Here

    Iterator keyPairs = r.getKeyPair().iterator();
    while (keyPairs.hasNext()) {
      KeyPair pair = (KeyPair) keyPairs.next();
      String childProperty = wrapper.getColumnPropertyName(r.getPrimaryKeyTable(), pair.getForeignKeyColumn());
 
            Property p = childTable.getType().getProperty(childProperty);
      fkValue.add(childTable.get(p));
    }

    DebugUtil.debugln(getClass(), debug, "Trying to find parent of " + r.getForeignKeyTable() + " with FK "
        + fkValue);
View Full Code Here

TOP

Related Classes of commonj.sdo.Property

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.