Package org.teiid.metadata

Examples of org.teiid.metadata.Table


    assertEquals(1, names.size());
    names = tm.getGroupsForPartialName("PARTS");
    assertEquals(1, names.size());
   
    //ensure that datatypes are set
    Table t = tm.getGroupID(names.iterator().next());
    assertNotNull(t.getColumns().get(0).getDatatype());
  }
View Full Code Here


 
  @Test public void testSchemaLoad() throws Exception {
    TransformationMetadata tm = VDBMetadataFactory.getVDBMetadata(UnitTestUtil.getTestDataPath() + "/Test.vdb");
   
    //ensure that datatypes are set
    Table t = tm.getGroupID("Northwind.Northwind.dbo.Employees");
    assertFalse(t.isVirtual());
  }
View Full Code Here

        // Create models
        Schema ldapModel = RealMetadataFactory.createPhysicalModel("LdapModel", metadataStore); //$NON-NLS-1$
       
        // Create physical groups
        Table table = RealMetadataFactory.createPhysicalGroup("People", ldapModel); //$NON-NLS-1$
        table.setNameInSource("ou=people,dc=metamatrix,dc=com"); //$NON-NLS-1$
               
        // Create physical elements
        String[] elemNames = new String[] {
            "UserID", "Name"  //$NON-NLS-1$ //$NON-NLS-2$
        };
View Full Code Here

    Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
        datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
    MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
    mf.addProcedure("y"); //$NON-NLS-1$
   
    Table t = mf.addTable("foo");
    mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
   
    MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
    mf1.addProcedure("y"); //$NON-NLS-1$
   
    Table table = mf1.addTable("doc");
    table.setSchemaPaths(Arrays.asList("../../x.xsd"));
    table.setResourcePath("/a/b/doc.xmi");
   
    HashMap<String, Resource> resources = new HashMap<String, Resource>();
    resources.put("/x.xsd", new Resource(Mockito.mock(VirtualFile.class), true));
   
    CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
View Full Code Here

      }
      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

      return;
    }
    if (!(metadataId instanceof Table)) {
      return;
    }
    Table t = (Table)metadataId;
    t.setLastDataModification(ts);
    if (distributor != null) {
      distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName());
    }
  }
View Full Code Here

    String contextName;

    // TODO: Re-use the getExpressionString method if possible, rather than
    // rewriting the same code twice.
    if(fromItem instanceof NamedTable) {
      Table group = ((NamedTable)fromItem).getMetadataObject();
      nameInSource = group.getNameInSource();
      // if NameInSource is null set it to an empty
      // string instead so we can safely call split on it
      if(nameInSource == null) {
        nameInSource = ""//$NON-NLS-1$
      }
View Full Code Here

    String namedClass = null;
    if(fromItem instanceof NamedTable) {
      // Here we use slightly different logic than in
      // getContextNameFromFromItem so it is easier to get
      // the group name later if needed
      Table mdIDGroup = ((NamedTable)fromItem).getMetadataObject();
      nameInSource = mdIDGroup.getNameInSource();
      // groupName = mdIDGroup.getName();
      // if NameInSource is null set it to an empty
      // string instead so we can safely call split on it
      if(nameInSource == null) {
        nameInSource = ""//$NON-NLS-1$
      }
      // now split it on ? to find the part of it that specifies the objectClass we should restrict on
      String nameInSourceArray[] = nameInSource.split("\\?")//$NON-NLS-1$
      if(nameInSourceArray.length >= 3) {
        namedClass = nameInSourceArray[2];
      }
      // if there is no specification in the Name In Source,
      // see if the connector property is set to true.  If
      // it is, use the Name of the class for the restriction.
      if(namedClass == null || namedClass.equals("")) {  //$NON-NLS-1$
        if (!this.executionFactory.isRestrictToObjectClass()) {
          namedClass = ""//$NON-NLS-1$
        } else {
          namedClass = mdIDGroup.getName();
        }
      }
    } else {
            final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.groupCountExceededError"); //$NON-NLS-1$
      throw new TranslatorException(msg);
View Full Code Here

    String searchScopeString = ""//$NON-NLS-1$
    int searchScope = LDAPConnectorConstants.ldapDefaultSearchScope;
    // TODO: Re-use the getExpressionString method if possible, rather than
    // rewriting the same code twice.
    if(fromItem instanceof NamedTable) {
      Table group = ((NamedTable)fromItem).getMetadataObject();
      String nameInSource = group.getNameInSource();
      // if NameInSource is null set it to an empty
      // string instead so we can safely call split on it
      if(nameInSource == null) {
        nameInSource = ""//$NON-NLS-1$
      }
View Full Code Here

    public Object getElementID(final String elementName) throws TeiidComponentException, QueryMetadataException {
      int columnIndex = elementName.lastIndexOf(TransformationMetadata.DELIMITER_STRING);
    if (columnIndex == -1) {
      throw new QueryMetadataException(elementName+TransformationMetadata.NOT_EXISTS_MESSAGE);
    }
    Table table = this.store.findGroup(elementName.substring(0, columnIndex).toUpperCase());
    String shortElementName = elementName.substring(columnIndex + 1);
    for (Column column : (List<Column>)getElementIDsInGroupID(table)) {
      if (column.getName().equalsIgnoreCase(shortElementName)) {
        return column;
      }
View Full Code Here

TOP

Related Classes of org.teiid.metadata.Table

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.