Package org.apache.tuscany.das.rdb.graphbuilder.impl

Examples of org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata


    Type rootType = SDOUtil.createType(types, getURI(), "DataGraphRoot", false)

    Iterator iter = metadata.getResultMetadata().iterator();
    while (iter.hasNext()) {

      ResultMetadata resultMetadata = (ResultMetadata) iter.next();

      Iterator names = resultMetadata.getAllTablePropertyNames()
          .iterator();
      while (names.hasNext()) {
        String tableName = (String) names.next();
 
        Type tableType = SDOUtil.createType(types, getURI(), tableName, false);                   
        Property property = SDOUtil.createProperty(rootType, tableName, tableType);
        SDOUtil.setMany(property,true);   
        SDOUtil.setContainment(property, true);
      }
   
      // TODO tablePropertyMap is temporary until Tuscany-203 is fixed
      HashMap tablePropertyMap = new HashMap();
     
      for (int i = 1; i <= resultMetadata.getColumnNames().size(); i++) {

        Property ref = rootType.getProperty(resultMetadata.getTablePropertyName(i));
       
        // TODO Temporary code to check to see if a property has already been added.
        // Replace when Tuscany-203 is fixed
        ArrayList addedProperties = (ArrayList) tablePropertyMap.get(ref.getName());
        if ( addedProperties == null ) {
          addedProperties = new ArrayList();
          tablePropertyMap.put(ref.getName(), addedProperties);
        }
       
        if (ref == null)
          throw new RuntimeException("Could not find table "
              + resultMetadata.getTablePropertyName(i)
              + " in the SDO model");
     
        String columnName = resultMetadata.getColumnPropertyName(i);

        // TODO temporary check until Tuscany-203 is fixed
        if ( !addedProperties.contains(columnName)) {
          addedProperties.add(columnName);
          Type atype = (Type) resultMetadata.getDataType(i);         
 
          SDOUtil.createProperty(ref.getType(), columnName, atype);       

          DebugUtil.debugln(getClass(), debug, "Adding column "
              + columnName + " to "
              + resultMetadata.getTablePropertyName(i))
        }

      }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata

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.