Package org.teiid.query.mapping.xml

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


                Object[] params = new Object[] {elementNode, orderBy};
                String msg = QueryPlugin.Util.getString("XMLPlanner.The_XML_document_element_{0}_is_not_mapped_to_data_and_cannot_be_used_in_the_ORDER_BY_clause__{1}_1", params); //$NON-NLS-1$
                throw new QueryPlannerException(msg);
            }
           
            MappingSourceNode sourceNode = elementNode.getSourceNode();
            ResultSetInfo rs = sourceNode.getResultSetInfo();
            OrderBy by = rs.getOrderBy();
            if (by == null) {
                by = new OrderBy();
            }
            ElementSymbol mappedSymbol = (ElementSymbol)sourceNode.getSymbolMap().get(new ElementSymbol(elementNode.getNameInSource()));
            by.addVariable((ElementSymbol)mappedSymbol.clone(), ((Boolean)types.get(i)).booleanValue());
            rs.setOrderBy(by);
    }
  }
View Full Code Here


     */
    public void visit(MappingBaseNode baseNode) {
        String source = baseNode.getSource();
        if(source != null) {
            // create the source node
            MappingSourceNode sourceNode = new MappingSourceNode(source);
            if (baseNode instanceof MappingRecursiveElement) {
                sourceNode.setAliasResultName(((MappingRecursiveElement)baseNode).getMappingClass());
            }
           
            // Get the parent of current node
            MappingBaseNode parent = baseNode.getParentNode();
           
            // remove the current node from its parent
            parent.removeChildNode(baseNode);
           
            // make source is child of current nodes parent
            parent.addSourceNode(sourceNode);
           
            // now make the current node, child of the source.
            sourceNode.addChild(baseNode);
            sourceNode.setExclude(baseNode.isExcluded());
            sourceNode.setMinOccurrs(baseNode.getMinOccurence());
            sourceNode.setMaxOccurrs(baseNode.getMaxOccurence());
            sourceNode.setStagingTables(baseNode.getStagingTables());
            baseNode.setSource(null);
            baseNode.setStagingTables(null);
        }
    }
View Full Code Here

    }
   
    private static Collection getExternalGroups(MappingSourceNode sourceNode) {
        Collection externalGroups = new HashSet();

        MappingSourceNode parentSource = sourceNode.getParentSourceNode();
        while (parentSource != null) {
            externalGroups.add(new GroupSymbol(parentSource.getActualResultSetName()));
            parentSource = parentSource.getParentSourceNode();
        }
        return externalGroups;
    }
View Full Code Here

    private static boolean getResultSets(MappingSourceNode contextNode, Set criteriaSourceNodes, LinkedHashSet allResultSets)  {
       
        boolean singleParentage = true;

        for (Iterator i = criteriaSourceNodes.iterator(); i.hasNext();) {
            MappingSourceNode node = (MappingSourceNode)i.next();

            List rsStack = getResultSetStack(contextNode, node);
           
            if (allResultSets.containsAll(rsStack)) {
                continue;
View Full Code Here

        }
       
        Query currentQuery = contextQuery;
       
        for (Iterator i = resultSets.iterator(); i.hasNext();) {
            MappingSourceNode rsNode = (MappingSourceNode)i.next();
           
            ResultSetInfo childRsInfo = rsNode.getResultSetInfo();
           
            QueryNode planNode = QueryUtil.getQueryNode(childRsInfo.getResultSetName(), planEnv.getGlobalMetadata());   
            Command command = QueryUtil.getQuery(childRsInfo.getResultSetName(), planNode, planEnv);
           
            String inlineViewName = planEnv.getAliasName(childRsInfo.getResultSetName());
View Full Code Here

            }
           
            Set sourceNodes = collectSourceNodesInConjunct(conjunct, context, planEnv.mappingDoc);

            //TODO: this can be replaced with method on the source node?
            MappingSourceNode criteriaRs = findRootResultSetNode(context, sourceNodes, criteria);
           
            Criteria convertedCrit = XMLNodeMappingVisitor.convertCriteria(conjunct, planEnv.mappingDoc, planEnv.getGlobalMetadata());
           
            ResultSetInfo rs = criteriaRs.getResultSetInfo();
            rs.setCriteria(Criteria.combineCriteria(rs.getCriteria(), convertedCrit));
            rs.addToCriteriaResultSets(sourceNodes);
        }
    }
View Full Code Here

        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);
        }
       
        ResultSetInfo criteriaRsInfo = sourceNode.getResultSetInfo();
       
        // Check for conflicting row limits on the same mapping class
        int existingLimit = criteriaRsInfo.getUserRowLimit();
        if (existingLimit > 0 && existingLimit != rowLimit) {
            String msg = QueryPlugin.Util.getString("XMLPlanner.Criteria_{0}_contains_conflicting_row_limits", wholeCrit); //$NON-NLS-1$
View Full Code Here

   
    public void visit(MappingAttribute attribute) {
        String nameInSource = attribute.getNameInSource();
        if (nameInSource != null) {
           
            MappingSourceNode sourceNode = attribute.getSourceNode();
            ElementSymbol symbol = resolveElementSymbol(nameInSource, sourceNode);           
           
            attribute.setElementSymbol(symbol);
        }
    }
View Full Code Here

    }
   
    public void visit(MappingElement element) {
        String nameInSource = element.getNameInSource();
        if (nameInSource != null) {
            MappingSourceNode sourceNode = element.getSourceNode();
            ElementSymbol symbol = resolveElementSymbol(nameInSource, sourceNode);
           
            element.setElementSymbol(symbol);
        }
    }
View Full Code Here

            rsInfo.setCommand(baseQuery);
           
            QueryNode modifiedNode = QueryUtil.getQueryNode(newGroup, planEnv.getGlobalMetadata());
            Command command = QueryUtil.getQuery(newGroup, modifiedNode, planEnv);
                       
            MappingSourceNode parent = sourceNode.getParentSourceNode();
            Collection<ElementSymbol> bindings = QueryUtil.getBindingElements(modifiedNode);
            // root source nodes do not have any inputset criteria on them; so there is no use in
            // going through the raising the criteria.
            // if the original query is not a select.. we are out of luck. we can expand on this later
            // versions. make ure bindings are only to parent.
View Full Code Here

TOP

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

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.