Package org.teiid.metadata

Examples of org.teiid.metadata.Column


        String[] elemTypes = new String[] { 
            DataTypeManager.DefaultDataTypes.STRING
        };
        List<Column> cols =RealMetadataFactory.createElements(table, elemNames, elemTypes);
       
        Column obj = cols.get(0);
        obj.setNativeType("uniqueidentifier"); //$NON-NLS-1$
       
        CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
        QueryMetadataInterface metadata = new TransformationMetadata(null, store, null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
       
        TranslationUtility tu = new TranslationUtility(metadata);
View Full Code Here


        // Set name in source on each column
        String[] nameInSource = new String[] {
           "uid", "cn"             //$NON-NLS-1$ //$NON-NLS-2$ 
        };
        for(int i=0; i<2; i++) {
            Column obj = cols.get(i);
            obj.setNameInSource(nameInSource[i]);
        }
       
        // Set column-specific properties
        for(int i=1; i<2; i++) {
            cols.get(i).setSearchType(SearchType.Unsearchable);
View Full Code Here

    while (symbolIter.hasNext()) {
      DerivedColumn symbol = symbolIter.next();
      // get the name in source
      Expression expression = symbol.getExpression();
      if (expression instanceof ColumnReference) {
        Column element = ((ColumnReference) expression).getMetadataObject();
        selectSymbolIndexToElement.put(index, element);
        String qualifiedName = element.getParent().getNameInSource() + ':' + element.getNameInSource();
        selectSymbolNameToIndex .put(qualifiedName, index);
        String nameInSource = element.getNameInSource();
        if (null == nameInSource || nameInSource.length() == 0) {
          exceptions.add(new TranslatorException("name in source is null or empty for column "+ symbol.toString()));
          continue;
        }
        if (nameInSource.equalsIgnoreCase("id")) {
View Full Code Here

      } else {
        firstTime = false;
      }
      Expression expression = symbol.getExpression();
      if (expression instanceof ColumnReference) {
        Column element = ((ColumnReference) expression).getMetadataObject();
        AbstractMetadataRecord parent = element.getParent();
        Table table;
        if(parent instanceof Table) {
          table = (Table)parent;
        } else {
          parent = parent.getParent();
          if(parent instanceof Table) {
            table = (Table)parent;
          } else {
            throw new TranslatorException("Could not resolve Table for column " + element.getName());
          }
        }
        result.append(table.getNameInSource());
        result.append('.');
        result.append(element.getNameInSource());
      } else if (expression instanceof AggregateFunction) {
        result.append("count()"); //$NON-NLS-1$
      }
    }
  }
View Full Code Here

  public Column getSelectSymbolMetadata(int index) {
    return selectSymbolIndexToElement.get(index);
  }
 
  public Column getSelectSymbolMetadata(String name) {
    Column result = null;
    Integer index = selectSymbolNameToIndex.get(name);
    if(null != index) { 
      result = selectSymbolIndexToElement.get(index);
    }
    return result;
View Full Code Here

        primaryKey.add((TempMetadataID) symbol.getMetadataID());
      }
      tempTable.setPrimaryKey(primaryKey);
    }
    for (int i = 0; i < create.getColumns().size(); i++) {
      Column column = create.getColumns().get(i);
      TempMetadataID tid = tempTable.getElements().get(i);
      if (column.isAutoIncremented()) {
        tid.setAutoIncrement(true);
      }
      if (column.getNullType() == NullType.No_Nulls) {
        tid.setNotNull(true);
      }
    }
  }
View Full Code Here

        if (criteria.isNegated()) {
            queryString.append("NOT "); //$NON-NLS-1$
        }
        queryString.append("IN"); //$NON-NLS-1$
        queryString.append('(');
        Column column = ((ColumnReference)criteria.getLeftExpression()).getMetadataObject();
        boolean timeColumn = isTimeColumn(column);
        boolean first = true;
        Iterator iter = criteria.getRightExpressions().iterator();
        while (iter.hasNext()) {
            if (!first) queryString.append(',');
View Full Code Here

    protected String getValue( Expression expr ) throws TranslatorException {
        String result;
        if (expr instanceof ColumnReference) {
            ColumnReference element = (ColumnReference)expr;
            Column element2 = element.getMetadataObject();
            result = element2.getNameInSource();
        } else if (expr instanceof Literal) {
            Literal literal = (Literal)expr;
            result = literal.getValue().toString();
        } else {
            throw new RuntimeException("unknown type in SalesforceQueryExecution.getValue(): " + expr.toString()); //$NON-NLS-1$
View Full Code Here

    }

    protected boolean isIdColumn( Expression expression ) throws TranslatorException {
        boolean result = false;
        if (expression instanceof ColumnReference) {
            Column element = ((ColumnReference)expression).getMetadataObject();
            String nameInSource = element.getNameInSource();
            if (nameInSource.equalsIgnoreCase("id")) { //$NON-NLS-1$
                result = true;
            }
        }
        return result;
View Full Code Here

    }

    protected boolean isMultiSelectColumn( Expression expression ) throws TranslatorException {
        boolean result = false;
        if (expression instanceof ColumnReference) {
            Column element = ((ColumnReference)expression).getMetadataObject();
            String nativeType = element.getNativeType();
            if (MULTIPICKLIST.equalsIgnoreCase(nativeType) || RESTRICTEDMULTISELECTPICKLIST.equalsIgnoreCase(nativeType)) {
                result = true;
            }
        }
        return result;
View Full Code Here

TOP

Related Classes of org.teiid.metadata.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.