Package org.teiid.language

Examples of org.teiid.language.NamedTable


        buffer.append(getElementName(obj, true));
    }

  private String getElementName(ColumnReference obj, boolean qualify) {
    String groupName = null;
        NamedTable group = obj.getTable();
        if (group != null && qualify) {
            if(group.getCorrelationName() != null) {
                groupName = group.getCorrelationName();
            } else
                AbstractMetadataRecord groupID = group.getMetadataObject();
                if(groupID != null) {             
                    groupName = getName(groupID);
                } else {
                    groupName = group.getName();
                }
            }
        }
       
    String elemShortName = null;       
View Full Code Here


        Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
        helpTestMod(arg1, "EXTRACT(DAY FROM {ts '2004-01-21 17:05:00.0'})", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
    }   

    public void test11() throws Exception {
        NamedTable group = LANG_FACTORY.createNamedTable("group", null, null); //$NON-NLS-1$
        ColumnReference elem = LANG_FACTORY.createColumnReference("col", group, null, TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
        helpTestMod(elem, "EXTRACT(DAY FROM group.col)", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

        ColumnReference elem = LANG_FACTORY.createColumnReference("col", group, null, TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
        helpTestMod(elem, "EXTRACT(DAY FROM group.col)", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    public void test12() throws Exception {
        NamedTable group = LANG_FACTORY.createNamedTable("group", null, null); //$NON-NLS-1$
        ColumnReference elem = LANG_FACTORY.createColumnReference("col", group, null, TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
        helpTestMod(elem, "(EXTRACT(DOW FROM group.col) + 1)", SourceSystemFunctions.DAYOFWEEK); //$NON-NLS-1$
    }
View Full Code Here

            } else if ("\"jcr:path\"".equalsIgnoreCase(c.getNameInSource())) { //$NON-NLS-1$
              useSelector = true;
            }
          }
          if (useSelector) {
            NamedTable nt = ((ColumnReference)expr).getTable();
            if (nt.getCorrelationName() != null) {
              objs.add(nt.getCorrelationName());
            } else {
              objs.add(nt);
            }
          } else {
            objs.add(expr);
View Full Code Here

       
        assertEquals("Did not get expected objects", expectedObjects, actualObjects); //$NON-NLS-1$
    }
    public LanguageObject example1() {
        NamedTable g = new NamedTable("g1", null, null); //$NON-NLS-1$
        List symbols = new ArrayList();       
        symbols.add(new ColumnReference(g, "e1", null, String.class)); //$NON-NLS-1$
        Function function = new Function("length", Arrays.asList(new ColumnReference(g, "e2", null, String.class)), Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
        symbols.add(function);
        List groups = new ArrayList();
View Full Code Here

        assertEquals("Did not get expected elements", expectedElements, actualElements); //$NON-NLS-1$
        assertEquals("Did not get expected groups", expectedGroups, actualGroups);         //$NON-NLS-1$
    }
   
    public void test1() {
        NamedTable g1 = new NamedTable("g1", null, null); //$NON-NLS-1$
        ColumnReference e1 = new ColumnReference(g1, "e1", null, String.class); //$NON-NLS-1$
       
        helpTestElementsUsedByGroups(e1, new String[] {"g1.e1"}, new String[] {"g1"}); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

       
        helpTestElementsUsedByGroups(e1, new String[] {"g1.e1"}, new String[] {"g1"}); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    public void test2() {
        NamedTable g1 = new NamedTable("g1", null, null); //$NON-NLS-1$
        ColumnReference e1 = new ColumnReference(g1, "e1", null, String.class); //$NON-NLS-1$
        ColumnReference e2 = new ColumnReference(g1, "e2", null, String.class); //$NON-NLS-1$
        Comparison cc = new Comparison(e1, e2, Operator.EQ);
       
        helpTestElementsUsedByGroups(cc, new String[] {"g1.e1", "g1.e2"}, new String[] {"g1"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
View Full Code Here

    public void testGetRMD() throws Exception {
        TranslationUtility util = new TranslationUtility(getTestVDB());
       
        // Translate command to get some ids
        Select query = (Select) util.parseCommand("select * from partssupplier.parts"); //$NON-NLS-1$
        NamedTable group = (NamedTable) query.getFrom().get(0);
        AbstractMetadataRecord mid = group.getMetadataObject();
        assertEquals("PartsSupplier.PARTSSUPPLIER.PARTS", mid.getFullName()); //$NON-NLS-1$
       
        // Use RMD to get stuff
        assertEquals("PARTS", mid.getNameInSource()); //$NON-NLS-1$
    }
View Full Code Here

        assertEquals("e1.equals(e2) != e2.equals(e1)", actual, actual2); //$NON-NLS-1$
        assertEquals("Did not get expected equal value", equal, actual); //$NON-NLS-1$
    }
   
    public NamedTable createGroup(String context, String definition) {
        return new NamedTable(context, definition, null);
    }
View Full Code Here

    public static SetQuery example() throws Exception {
        return TstLanguageBridgeFactory.factory.translate(helpExampleSetQuery());
    }
   
    public static SetQuery example2() throws Exception {
        NamedTable group = new NamedTable("ted", null, null); //$NON-NLS-1$
        ColumnReference element = new ColumnReference(group, "nugent", null, String.class); //$NON-NLS-1$
        DerivedColumn symbol = new DerivedColumn(null,element);
        List symbols = new ArrayList();
        symbols.add(symbol);
        List items = new ArrayList();
        items.add(group);
       
        NamedTable group2 = new NamedTable("dave", null, null); //$NON-NLS-1$
        ColumnReference element2 = new ColumnReference(group2, "barry", null, String.class); //$NON-NLS-1$
        DerivedColumn symbol2 = new DerivedColumn(null, element2);
        List symbols2 = new ArrayList();
        symbols2.add(symbol2);
       
View Full Code Here

TOP

Related Classes of org.teiid.language.NamedTable

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.