Package org.teiid.query.mapping.xml

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


*/
public class FakeXMLMetadata {
   
    public static MappingDocument docWithExcluded() {
        MappingDocument doc = new MappingDocument(true);
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$

        MappingElement n1 = root.addChildElement(new MappingElement("element1", "nis_element1")); //$NON-NLS-1$ //$NON-NLS-2$
        n1.setSource("mappingclass1"); //$NON-NLS-1$
       
        MappingElement n1r = n1.addChildElement(new MappingRecursiveElement("element1", "mappingclass1")); //$NON-NLS-1$ //$NON-NLS-2$
        n1r.setNameInSource("nis_element1"); //$NON-NLS-1$
        n1r.setExclude(true);
        MappingElement n1r2 = n1.addChildElement(new MappingRecursiveElement("element1", "mappingclass1")); //$NON-NLS-1$ //$NON-NLS-2$
        n1r2.addChildElement(new MappingElement("donotdelete", "nis_donotdelete")).setExclude(true); //$NON-NLS-1$ //$NON-NLS-2$
       
       
        MappingChoiceNode choice1 = root.addChoiceNode(new MappingChoiceNode());
        MappingCriteriaNode crit1 = choice1.addCriteriaNode(new MappingCriteriaNode("one==one", false)); //$NON-NLS-1$
        crit1.addChildElement(new MappingElement("c1_Criteria_1", "nis_c1_Criteria_1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingCriteriaNode crit2 = choice1.addCriteriaNode(new MappingCriteriaNode());
        crit2.addChildElement(new MappingElement("c1_Criteria_2", "nis_c1_Criteria_2")); //$NON-NLS-1$ //$NON-NLS-2$
        choice1.setExclude(true);

        MappingChoiceNode choice2 = root.addChoiceNode(new MappingChoiceNode());
       
        MappingCriteriaNode crit21 = choice2.addCriteriaNode(new MappingCriteriaNode("one==one", false)); //$NON-NLS-1$
        crit21.addChildElement(new MappingElement("c2_Criteria_1")); //$NON-NLS-1$

        MappingCriteriaNode crit22 = choice2.addCriteriaNode(new MappingCriteriaNode());
        crit22.addChildElement(new MappingElement("c2_Criteria_2")).setExclude(true); //$NON-NLS-1$
       
        MappingSequenceNode seq1 = root.addSequenceNode(new MappingSequenceNode());
        seq1.addChildElement(new MappingElement("seq1_element1", "nis_seq1_element1")) //$NON-NLS-1$ //$NON-NLS-2$
            .setExclude(true);
        MappingElement seq1_e2 = seq1.addChildElement(new MappingElement("seq1_element2", "nis_seq1_element2")); //$NON-NLS-1$ //$NON-NLS-2$
        seq1_e2.setNillable(true);
               
        MappingElement n2 = root.addChildElement(new MappingElement("element2")); //$NON-NLS-1$
        n2.addCommentNode(new MappingCommentNode("this is comment")); //$NON-NLS-1$
        MappingAttribute attr1 = new MappingAttribute("element2_attribute1"); //$NON-NLS-1$
        n2.addAttribute(attr1);       
        attr1.setExclude(true);
       
        MappingAttribute attr2 = new MappingAttribute("element2_attribute2", "nis_element2_attribute2"); //$NON-NLS-1$ //$NON-NLS-2$       
        n2.addAttribute(attr2);
        return doc;
    }
View Full Code Here


    private static MappingDocument doc1() {
        // DOC 1
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement node= doc.addChildElement(new MappingElement("a0")); //$NON-NLS-1$
       
        MappingElement sourceNode = node.addChildElement(new MappingElement("a1")); //$NON-NLS-1$
        sourceNode.setSource("vm1.g1"); //$NON-NLS-1$
       
        sourceNode.addStagingTable("tm1.g1"); //$NON-NLS-1$

        sourceNode.addChildElement(new MappingElement("a1", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
        sourceNode.addChildElement(new MappingElement("b1", "vm1.g1.e2")); //$NON-NLS-1$ //$NON-NLS-2$
        sourceNode.addChildElement(new MappingElement("c1", "vm1.g1.e3")); //$NON-NLS-1$ //$NON-NLS-2$
        return doc;
    }
View Full Code Here

*/
public class TestHandleNillableNode extends TestCase {
   
    public void testNillableNode() {
        MappingDocument doc = FakeXMLMetadata.docWithExcluded();
        MappingElement root = (MappingElement)doc.getRootNode();
       
        Properties names = root.getNamespacesAsProperties();
        assertFalse(names.containsKey("xsi"));//$NON-NLS-1$
       
        HandleNillableVisitor.execute(doc);
       
        names = root.getNamespacesAsProperties();
        assertTrue(names.containsKey("xsi"));//$NON-NLS-1$
    }
View Full Code Here

        return doc;
    }

    private static MappingDocument doc2() {
        MappingDocument doc = new MappingDocument(false);
        MappingElement A1 = doc.addChildElement(new MappingElement("a1", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
        A1.setSource("vm1.g1"); //$NON-NLS-1$
        return doc;
    }
View Full Code Here

    }

    private static MappingDocument docTestConvertCriteriaWithAttribute() {
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
        root.setSource("vm1.g1"); //$NON-NLS-1$

        root.addChildElement(new MappingElement("myElement", "vm1.g1.e2")); //$NON-NLS-1$ //$NON-NLS-2$
        root.addAttribute(new MappingAttribute("myAttribute", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
        return doc;
    }
View Full Code Here

    }

    private static MappingDocument docTestConvertCriteriaWithAttribute2() {
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
        root.setSource("vm1.g1"); //$NON-NLS-1$
        root.addAttribute(new MappingAttribute("myAttribute", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingSequenceNode seq = root.addSequenceNode(new MappingSequenceNode());
        seq.addChildElement(new MappingElement("myElement", "vm1.g1.e2")); //$NON-NLS-1$ //$NON-NLS-2$
        return doc;
    }   
View Full Code Here

     * group but is not in it's scope
     */
    private static MappingDocument doc3() {
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$

        MappingElement n1 = root.addChildElement(new MappingElement("n1")); //$NON-NLS-1$
        n1.setSource("vm1.g1"); //$NON-NLS-1$
       
        MappingElement m1 = n1.addChildElement(new MappingElement("m1")); //$NON-NLS-1$
       
        MappingElement n2 = m1.addChildElement(new MappingElement("n2")); //$NON-NLS-1$
        n2.setSource("vm1.g2"); //$NON-NLS-1$
        n2.addStagingTable("tm1.g1"); //$NON-NLS-1$

        n2.addChildElement(new MappingElement("leaf1", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        return doc;
    }
View Full Code Here

    private static MappingDocument doc4() {
       
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$

        MappingElement n4a = root.addChildElement(new MappingElement("n4a")); //$NON-NLS-1$
        n4a.setMaxOccurrs(-1);
        n4a.setSource("vm1.g1"); //$NON-NLS-1$
        n4a.addStagingTable("tm1.g1"); //$NON-NLS-1$
        n4a.addChildElement(new MappingElement("n4b", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingElement n4c = n4a.addChildElement(new MappingElement("n4c")); //$NON-NLS-1$
        n4c.setMaxOccurrs(-1);
        n4c.setSource("vm1.g2");         //$NON-NLS-1$

        //this node can't be used for anything but searching through mapping doc for this property
        MappingElement fake = n4a.addChildElement(new MappingElement("fake")); //$NON-NLS-1$
        fake.setSource("fakeResultSet"); //$NON-NLS-1$
       
        n4c.addChildElement(new MappingElement("n4d", "vm1.g2.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingElement n4e = n4c.addChildElement(new MappingElement("n4e")); //$NON-NLS-1$
        n4e.setSource("vm1.g3"); //$NON-NLS-1$
        n4e.setMaxOccurrs(-1);
        n4e.addChildElement(new MappingElement("n4f", "vm1.g3.e1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        return doc;
    }
View Full Code Here

    private static MappingDocument doc5() {
       
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
       
        MappingElement nodea = root.addChildElement(new MappingElement("nodea")); //$NON-NLS-1$
        nodea.setSource("vm1.g1"); //$NON-NLS-1$
        nodea.addStagingTable("tm1.g1"); //$NON-NLS-1$
        nodea.setMaxOccurrs(-1);
       
        nodea.addChildElement(new MappingElement("nodeb", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingElement nodec = nodea.addChildElement(new MappingElement("nodec")); //$NON-NLS-1$
        nodec.setMaxOccurrs(-1);
        nodec.setSource("vm1.g2"); //$NON-NLS-1$

        nodec.addChildElement(new MappingElement("noded", "vm1.g2.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingElement nodee = nodec.addChildElement(new MappingElement("nodee")); //$NON-NLS-1$
        nodee.setSource("vm1.g3"); //$NON-NLS-1$
        nodee.setMaxOccurrs(-1);

        nodee.addChildElement(new MappingElement("nodef", "vm1.g3.e1")); //$NON-NLS-1$ //$NON-NLS-2$

        MappingElement nodeg = nodee.addChildElement(new MappingElement("nodeg")); //$NON-NLS-1$
        nodeg.setSource("vm1.g4"); //$NON-NLS-1$
        nodeg.setMaxOccurrs(-1);
       
        nodeg.addChildElement(new MappingElement("nodeh", "vm1.g4.e1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        MappingElement nodeI = nodeg.addChildElement(new MappingElement("nodeI")); //$NON-NLS-1$
        nodeI.setMaxOccurrs(-1);
        nodeI.setSource("vm1.g5"); //$NON-NLS-1$
        nodeI.addChildElement(new MappingElement("nodeJ", "vm1.g5.e1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        return doc;
    }
View Full Code Here

    }

    private static MappingDocument doc6() {
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement simpleRoot = doc.addChildElement(new MappingElement("tempGroupTest")); //$NON-NLS-1$
        simpleRoot.setSource("vm1.g1"); //$NON-NLS-1$
        simpleRoot.addStagingTable("tm1.g1"); //$NON-NLS-1$
        return doc;
    }
View Full Code Here

TOP

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

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.