/** * Checks for a Select * clause * @return True if Select * is used */ public boolean isStar() { return (symbols.size() == 1 && symbols.get(0) instanceof MultipleElementSymbol && ((MultipleElementSymbol)symbols.get(0)).getGroup() == null); }
/** * Checks for a Select * clause * @return True if Select * is used */ public boolean isStar() { return (symbols.size() == 1 && symbols.get(0) instanceof MultipleElementSymbol && ((MultipleElementSymbol)symbols.get(0)).getGroup() == null); }
/** * Checks for a Select * clause * @return True if Select * is used */ public boolean isStar() { return (symbols.size() == 1 && symbols.get(0) instanceof MultipleElementSymbol && ((MultipleElementSymbol)symbols.get(0)).getGroup() == null); }
public void visit(MultipleElementSymbol obj) { // Determine group that this symbol is for try { List<ElementSymbol> elementSymbols = new ArrayList<ElementSymbol>(); Collection<GroupSymbol> groups = currentGroups; if (obj.getGroup() != null) { groups = Arrays.asList(resolveAllInGroup(obj, currentGroups, metadata)); } for (GroupSymbol group : groups) { elementSymbols.addAll(resolveSelectableElements(group)); } obj.setElementSymbols(elementSymbols); } catch (TeiidException err) { throw new TeiidRuntimeException(err); } }
public void visit(MultipleElementSymbol obj) { // Determine group that this symbol is for try { List<ElementSymbol> elementSymbols = new ArrayList<ElementSymbol>(); Collection<GroupSymbol> groups = currentGroups; if (obj.getGroup() != null) { groups = Arrays.asList(resolveAllInGroup(obj, currentGroups, metadata)); } for (GroupSymbol group : groups) { elementSymbols.addAll(resolveSelectableElements(group)); } obj.setElementSymbols(elementSymbols); } catch (TeiidException err) { throw new TeiidRuntimeException(err); } }
@Override public void visit( MultipleElementSymbol obj ) { if (obj.getGroup() == null) { append(Tokens.ALL_COLS); } else { if (isSinglePart(obj.getGroup())) { append(escapeSinglePart(obj.getGroup().getOutputName())); } else { visitNode(obj.getGroup()); } append(Tokens.DOT); append(Tokens.ALL_COLS); } }
/** * Swap each ElementSymbol referenced by AllInGroupSymbol * @param obj Object to remap */ public void visit(MultipleElementSymbol obj) { List<ElementSymbol> oldSymbols = obj.getElementSymbols(); if(oldSymbols != null && oldSymbols.size() > 0) { List<ElementSymbol> newSymbols = new ArrayList<ElementSymbol>(oldSymbols.size()); Iterator<ElementSymbol> iter = oldSymbols.iterator(); while(iter.hasNext()) { ElementSymbol es = iter.next(); ElementSymbol mappedSymbol = getMappedElement(es); newSymbols.add( mappedSymbol ); } obj.setElementSymbols(newSymbols); } if (obj.getGroup() == null) { return; } obj.setGroup(getMappedGroup(obj.getGroup())); }
/** * Swap each ElementSymbol referenced by AllInGroupSymbol * @param obj Object to remap */ public void visit(MultipleElementSymbol obj) { List<ElementSymbol> oldSymbols = obj.getElementSymbols(); if(oldSymbols != null && oldSymbols.size() > 0) { List<ElementSymbol> newSymbols = new ArrayList<ElementSymbol>(oldSymbols.size()); Iterator<ElementSymbol> iter = oldSymbols.iterator(); while(iter.hasNext()) { ElementSymbol es = iter.next(); ElementSymbol mappedSymbol = getMappedElement(es); newSymbols.add( mappedSymbol ); } obj.setElementSymbols(newSymbols); } if (obj.getGroup() == null) { return; } obj.setGroup(getMappedGroup(obj.getGroup())); }
public void visit(MultipleElementSymbol obj) { // Determine group that this symbol is for try { List<ElementSymbol> elementSymbols = new ArrayList<ElementSymbol>(); Collection<GroupSymbol> groups = currentGroups; if (obj.getGroup() != null) { groups = Arrays.asList(resolveAllInGroup(obj, currentGroups, metadata)); } for (GroupSymbol group : groups) { elementSymbols.addAll(resolveSelectableElements(group)); } obj.setElementSymbols(elementSymbols); } catch (TeiidException err) { throw new TeiidRuntimeException(err); } }
@Override public void visit( MultipleElementSymbol obj ) { if (obj.getGroup() == null) { append(Tokens.ALL_COLS); } else { if (isSinglePart(obj.getGroup())) { append(escapeSinglePart(obj.getGroup().getOutputName())); } else { visitNode(obj.getGroup()); } append(Tokens.DOT); append(Tokens.ALL_COLS); } }
/** * Swap each ElementSymbol referenced by AllInGroupSymbol * @param obj Object to remap */ public void visit(MultipleElementSymbol obj) { List<ElementSymbol> oldSymbols = obj.getElementSymbols(); if(oldSymbols != null && oldSymbols.size() > 0) { List<ElementSymbol> newSymbols = new ArrayList<ElementSymbol>(oldSymbols.size()); Iterator<ElementSymbol> iter = oldSymbols.iterator(); while(iter.hasNext()) { ElementSymbol es = iter.next(); ElementSymbol mappedSymbol = getMappedElement(es); newSymbols.add( mappedSymbol ); } obj.setElementSymbols(newSymbols); } if (obj.getGroup() == null) { return; } obj.setGroup(getMappedGroup(obj.getGroup())); }
private static GroupSymbol resolveAllInGroup(MultipleElementSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException { String groupAlias = allInGroupSymbol.getGroup().getName(); List<GroupSymbol> groupSymbols = ResolverUtil.findMatchingGroups(groupAlias, groups, metadata); if(groupSymbols.isEmpty() || groupSymbols.size() > 1) { String msg = QueryPlugin.Util.getString(groupSymbols.isEmpty()?"ERR.015.008.0047":"SimpleQueryResolver.ambiguous_all_in_group", allInGroupSymbol); //$NON-NLS-1$ //$NON-NLS-2$ QueryResolverException qre = new QueryResolverException(msg); qre.addUnresolvedSymbol(new UnresolvedSymbolDescription(allInGroupSymbol.toString(), msg)); throw qre; } allInGroupSymbol.setGroup(groupSymbols.get(0).clone()); return groupSymbols.get(0); }
private static GroupSymbol resolveAllInGroup(MultipleElementSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException { String groupAlias = allInGroupSymbol.getGroup().getName(); List<GroupSymbol> groupSymbols = ResolverUtil.findMatchingGroups(groupAlias, groups, metadata); if(groupSymbols.isEmpty() || groupSymbols.size() > 1) { String msg = QueryPlugin.Util.getString(groupSymbols.isEmpty()?"ERR.015.008.0047":"SimpleQueryResolver.ambiguous_all_in_group", allInGroupSymbol); //$NON-NLS-1$ //$NON-NLS-2$ QueryResolverException qre = new QueryResolverException(msg); qre.addUnresolvedSymbol(new UnresolvedSymbolDescription(allInGroupSymbol.toString(), msg)); throw qre; } allInGroupSymbol.setGroup(groupSymbols.get(0).clone()); return groupSymbols.get(0); }
private static GroupSymbol resolveAllInGroup(MultipleElementSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException { String groupAlias = allInGroupSymbol.getGroup().getName(); List<GroupSymbol> groupSymbols = ResolverUtil.findMatchingGroups(groupAlias, groups, metadata); if(groupSymbols.isEmpty() || groupSymbols.size() > 1) { String msg = QueryPlugin.Util.getString(groupSymbols.isEmpty()?"ERR.015.008.0047":"SimpleQueryResolver.ambiguous_all_in_group", allInGroupSymbol); //$NON-NLS-1$ //$NON-NLS-2$ QueryResolverException qre = new QueryResolverException(msg); qre.addUnresolvedSymbol(new UnresolvedSymbolDescription(allInGroupSymbol.toString(), msg)); throw qre; } allInGroupSymbol.setGroup(groupSymbols.get(0).clone()); return groupSymbols.get(0); }
/** * Is selection is not "select *", then mark all those un used nodes as excluded. The way * we do this mark the nodes selected and their parents as selected, then we sweep to mark * everybody who is not marked "included" as excluded. * @param xmlCommand */ static MappingDocument preMarkExcluded(Query xmlCommand, MappingDocument doc) { Select select = xmlCommand.getSelect(); Expression firstSymbol = select.getSymbol(0); // 0. mark the nodes to be excluded if(firstSymbol instanceof MultipleElementSymbol && ((MultipleElementSymbol)firstSymbol).getGroup() == null) { return doc; } // Get all the valid nodes to be marked as included. Collection<ElementSymbol> validElements = ElementCollectorVisitor.getElements(select, true); HashSet<String> elements = new HashSet<String>(validElements.size()); for (ElementSymbol element : validElements) { elements.add(element.getName()); } // keep the nodes given mark the rest of the nodes to be eliminated return MarkExcludeVisitor.markExcludedNodes(doc, elements); }