Examples of MappingNode


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

            //this is a gross hack, these should not be criteria
            if (planRowLimitFunction(conjunct, criteria, planEnv)) {
                continue;
            }
           
            MappingNode context = null;
           
            Collection contextFunctions = ContextReplacerVisitor.replaceContextFunctions(conjunct);
            if (!contextFunctions.isEmpty()) {
                //ensure that every part of the conjunct is to the same context
                for (Iterator i = contextFunctions.iterator(); i.hasNext();) {
                    Function contextFunction = (Function)i.next();
                    MappingNode otherContext = getContext(planEnv, contextFunction);
                    if (context == null) {
                        context = otherContext;
                    } else if (context != otherContext){
                        throw new QueryPlannerException("ERR.015.004.0068", QueryPlugin.Util.getString("ERR.015.004.0068", criteria)); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                }
               
                //search up to find the source node
                MappingNode contextRsNode = context.getSourceNode();
                if (contextRsNode != null) {
                    context = contextRsNode;
                }
               
            } else {
View Full Code Here

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

        for (Iterator i = elements.iterator(); i.hasNext();) {
            ElementSymbol elementSymbol = (ElementSymbol)i.next();
           
            String elementFullName = elementSymbol.getCanonicalName();
           
            MappingNode node = MappingNode.findNode(mappingDoc, elementFullName);
           
            MappingNode elementRsNode = node.getSourceNode();
            if (elementRsNode == null) {
                throw new QueryPlannerException(QueryPlugin.Util.getString("CriteriaPlanner.invalid_element", elementSymbol)); //$NON-NLS-1$
            }
           
            String elementRsFullName = elementRsNode.getFullyQualifiedName().toUpperCase();
           
            //check for a match at or below the context
            if (contextFullName.equals(elementRsFullName) ||
                            elementRsFullName.startsWith(contextFullName + ElementSymbol.SEPARATOR)) {
                resultSets.add(elementRsNode);
View Full Code Here

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

        Set criteriaResultSets = new HashSet();
        // if the context node is not the root node then we need to find the root source node from list.
        for (Iterator i = resultSets.iterator(); i.hasNext();) {

            // these are actually source nodes.
            MappingNode node = (MappingNode)i.next();
  
            MappingNode root = node;
           
            while (node != null) {
                if (node instanceof MappingSourceNode) {
                    root = node;
                }
View Full Code Here

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

        }
        int rowLimit = ((Integer)rowLimitConstant.getValue()).intValue();
       
        String fullyQualifiedNodeName = planEnv.getGlobalMetadata().getFullName(((ElementSymbol)rowLimitFunction.getArg(0)).getMetadataID());
       
        MappingNode node = MappingNode.findNode(planEnv.mappingDoc, fullyQualifiedNodeName.toUpperCase());
        MappingSourceNode sourceNode = node.getSourceNode();
        if (sourceNode == null) {
            String msg = QueryPlugin.Util.getString("XMLPlanner.The_rowlimit_parameter_{0}_is_not_in_the_scope_of_any_mapping_class", fullyQualifiedNodeName); //$NON-NLS-1$
            throw new QueryPlannerException(msg);
        }
       
View Full Code Here

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

    static MappingNode getContext(XMLPlannerEnvironment planEnv, Function contextFunction)
        throws QueryPlannerException {
       
        ElementSymbol targetContext = (ElementSymbol)contextFunction.getArg(0);

        MappingNode contextNode = MappingNode.findNode(planEnv.mappingDoc, targetContext.getCanonicalName());
        if (contextNode == null){
            throw new QueryPlannerException("ERR.015.004.0037", QueryPlugin.Util.getString("ERR.015.004.0037", targetContext)); //$NON-NLS-1$ //$NON-NLS-2$
        }
        return contextNode;
    }
View Full Code Here

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

       
        try {
            String path = metadata.getFullName(element.getMetadataID()).toUpperCase();
   
        // Find mapping node for specified path
        MappingNode elementNode = MappingNode.findNode(rootNode, path);
        if(elementNode == null) {
          return null;
        }
       
        // Construct a new element node based on mapping node reference
        String symbolName = elementNode.getNameInSource();
        if (symbolName == null){
          return null;
        }
      return elementNode.getSourceNode().getMappedSymbol(new ElementSymbol(symbolName));
        } catch (TeiidComponentException err) {
            throw new TeiidRuntimeException(err);
        }
    }
View Full Code Here

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

                /*
                 * JIRA JBEDSP-531 if a node is excluded and has no transformation, then it matches the
                 * designer notion of an incomplete document.  we'll allow this by removing everything
                 * starting at this point
                 */
                MappingNode current = sourceNode;
                boolean isExcluded = false;
                while (current != null) {
                    if (current.isExcluded()) {
                        isExcluded = true;
                        break;
                    }
                    current = current.getParent();
                }
                if (!isExcluded) {
                    throw e;
                }
                //cut me and everything below me from the tree
View Full Code Here

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

                       
                        if (shouldAbort()) {
                            break;
                        }
                       
                        MappingNode node = (MappingNode)i.next();           
                        node.acceptVisitor(this);
                    }
                }
            };

            doc.acceptVisitor(walker);
View Full Code Here

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

        // make sure name matches and caridinality of root is reset; as there can be only one root
        assertEquals("parentNode", element.getName()); //$NON-NLS-1$
        assertEquals(1, element.getMinOccurence());
        assertEquals(1, element.getMaxOccurence());
       
        MappingNode node1 = (MappingNode)element.getNodeChildren().get(0);
        assertTrue(node1 instanceof MappingSourceNode);
       
        MappingSourceNode source = (MappingSourceNode)node1;       
        assertEquals("childNodeSource", source.getResultName()); //$NON-NLS-1$
View Full Code Here

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

        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
TOP
Copyright © 2018 www.massapi.com. 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.