Ejemplo n.º 1
0
  private void setRoutingName(AccessNode accessNode, PlanNode node, Command command)
      throws QueryPlannerException, TeiidComponentException {

    // Look up connector binding name
    try {
      Object modelID = node.getProperty(NodeConstants.Info.MODEL_ID);
      if (modelID == null || modelID instanceof TempMetadataID) {
        if (command instanceof StoredProcedure) {
          modelID = ((StoredProcedure) command).getModelID();
        } else if (!(command instanceof Create || command instanceof Drop)) {
          Collection<GroupSymbol> groups = GroupCollectorVisitor.getGroups(command, true);
          GroupSymbol group = groups.iterator().next();

          modelID = metadata.getModelID(group.getMetadataID());
        }
      }
      String cbName = metadata.getFullName(modelID);
      accessNode.setModelName(cbName);
      accessNode.setModelId(modelID);
      accessNode.setConformedTo((Set<Object>) node.getProperty(Info.CONFORMED_SOURCES));
    } catch (QueryMetadataException e) {
      throw new QueryPlannerException(
          QueryPlugin.Event.TEIID30251, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30251));
    }
  }