Package org.teiid.query.mapping.xml

Examples of org.teiid.query.mapping.xml.MappingDocument


        }

        // lookup mapping node for the user command
        GroupSymbol group = xmlQuery.getFrom().getGroups().iterator().next();

        MappingDocument doc = (MappingDocument)metadata.getMappingNode(group.getMetadataID());
        doc = (MappingDocument)doc.clone();
       
        // make a copy of the document
        planEnv.mappingDoc = doc;
    planEnv.documentGroup = group;
        planEnv.xmlCommand = (Query) command;
View Full Code Here


        visitNode(element);
    }
   
    void visitNode(MappingElement element) {
        if (element.isNillable()) {
            MappingDocument doc = element.getDocument();

            // get the first visual node on the document.
            MappingElement rootElement = doc.getTagRootElement();
           
            Properties namespaces = rootElement.getNamespacesAsProperties();
            if (namespaces == null || !namespaces.containsKey(MappingNodeConstants.INSTANCES_NAMESPACE_PREFIX)) {
                rootElement.addNamespace(new Namespace(MappingNodeConstants.INSTANCES_NAMESPACE_PREFIX, MappingNodeConstants.INSTANCES_NAMESPACE));
            }
View Full Code Here

        return metadata;
    }
   
    private static MappingNode createXMLPlanNestedJoin() {
       
        MappingDocument doc = new MappingDocument(true);
       
        MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$

        root.setStagingTables(Arrays.asList(new String[] {"tempGroup.orders"})); //$NON-NLS-1$
       
        MappingElement cats = root.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
        MappingElement items = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
View Full Code Here

        FakeMetadataObject suppliers = metadata.getStore().findObject("xmltest.suppliers", FakeMetadataObject.GROUP); //$NON-NLS-1$
        QueryNode node = (QueryNode)suppliers.getProperty(FakeMetadataObject.Props.PLAN);
        node.setQuery(null);
       
        FakeMetadataObject docGroup = metadata.getStore().findObject("xmltest.doc9", FakeMetadataObject.GROUP); //$NON-NLS-1$
        MappingDocument doc = (MappingDocument)docGroup.getProperty(FakeMetadataObject.Props.PLAN);
        MappingNode suppliersNode = MappingNode.findNode(doc, "Catalogs.Catalog.Items.Item.Suppliers.Supplier".toUpperCase());
        suppliersNode.setExclude(true);
       
        String expectedDoc = TestXMLProcessor.readFile("TestXMLPlanningEnhancements-testEmptyMappingClass.xml"); //$NON-NLS-1$
       
View Full Code Here

           
    private void startFragment(Program program, MappingBaseNode element) {
        // In the case that we are returning the multiple documents; we are going to treat them as
        // fragments, so do not add the header information
        if (element.isTagRoot()) {
            MappingDocument doc = element.getDocument();
            ProcessorInstruction header = new InitializeDocumentInstruction(doc.getDocumentEncoding(), doc.isFormatted());
            program.addInstruction(header);
        }
    }
View Full Code Here

        if(tableRecord.isVirtual()) {
            // get mappin transform
            String document = tableRecord.getSelectTransformation();           
            InputStream inputStream = new ByteArrayInputStream(document.getBytes());
            MappingLoader reader = new MappingLoader();
            MappingDocument mappingDoc = null;
            try{
                mappingDoc = reader.loadDocument(inputStream);
                mappingDoc.setName(groupName);
            } catch (Exception e){
                throw new TeiidComponentException(e, QueryPlugin.Util.getString("TransformationMetadata.Error_trying_to_read_virtual_document_{0},_with_body__n{1}_1", groupName, mappingDoc)); //$NON-NLS-1$
            } finally {
              try {
          inputStream.close();
              } catch(Exception e) {}
            }
            return (MappingDocument)mappingDoc.clone();
        }

        return null;
    }
View Full Code Here

            "        <tempGroup>testTempGroup2</tempGroup>\r\n" //$NON-NLS-1$           
            "    </mappingNode>\r\n" //$NON-NLS-1$
            "</xmlMapping>\r\n\r\n"; //$NON-NLS-1$
       
        // load the original
        MappingDocument doc = loadMappingDocument(xml);

        // now extract the source nodes
        doc = SourceNodeGenaratorVisitor.extractSourceNodes(doc);
       
        // check the staging tables       
        MappingBaseNode root = doc.getRootNode();
        assertTrue(root instanceof MappingSourceNode);
        MappingSourceNode source = (MappingSourceNode)root;
        assertEquals("licenseSource", source.getResultName()); //$NON-NLS-1$
       
        List list = source.getStagingTables();
View Full Code Here

            "       </mappingNode>\r\n" //$NON-NLS-1$           
            "    </mappingNode>\r\n" //$NON-NLS-1$
            "</xmlMapping>\r\n\r\n"; //$NON-NLS-1$
       
        // load the original
        MappingDocument doc = loadMappingDocument(xml);

        // now extract the source nodes
        doc = SourceNodeGenaratorVisitor.extractSourceNodes(doc);
       
        // check source node
        MappingBaseNode node = doc.getRootNode();
        assertTrue(node instanceof MappingElement);
        MappingElement element = (MappingElement)node;

        List list = element.getStagingTables();
        assertEquals(1, list.size());
View Full Code Here

            "       </mappingNode>\r\n" //$NON-NLS-1$           
            "    </mappingNode>\r\n" //$NON-NLS-1$
            "</xmlMapping>\r\n\r\n"; //$NON-NLS-1$
       
        // load the original
        MappingDocument doc = loadMappingDocument(xml);

        // now extract the source nodes
        doc = SourceNodeGenaratorVisitor.extractSourceNodes(doc);
       
        MappingNode node = doc.getRootNode();
        assertTrue(node instanceof MappingSourceNode);
        MappingSourceNode source = (MappingSourceNode)node;
        assertEquals("parentNodeSource", source.getSource()); //$NON-NLS-1$
       
        node = (MappingNode)source.getNodeChildren().get(0);
View Full Code Here

            "       </mappingNode>"+ //$NON-NLS-1$               
            "   </mappingNode>\r\n" //$NON-NLS-1$               
            "</xmlMapping>\r\n\r\n"; //$NON-NLS-1$
        
        // load the original
        MappingDocument doc = loadMappingDocument(xml);

        // now extract the source nodes
        doc = SourceNodeGenaratorVisitor.extractSourceNodes(doc);
           
        MappingNode node = doc.getRootNode();
        assertTrue(node instanceof MappingSourceNode);
       
        // ist source
        MappingSourceNode source = (MappingSourceNode)node;
        assertEquals("parentSource", source.getSource()); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.teiid.query.mapping.xml.MappingDocument

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.