private MappingBaseNode getRecursiveRootNode(MappingRecursiveElement elem) { if (hasSource(elem.getMappingClass())) { return this; } MappingBaseNode parent = this.getParentNode(); if (parent != null) { return parent.getRecursiveRootNode(elem); } throw new RuntimeException(Messages.gs(Messages.TEIID.TEIID30457, elem)); }
@Override public MappingNode clone() { MappingBaseNode clone = (MappingBaseNode) super.clone(); List<String> staging = getStagingTables(); if (getStagingTables() != null && staging != MappingNodeConstants.Defaults.DEFAULT_VALUES.get( MappingNodeConstants.Properties.TEMP_GROUP_NAMES)) { clone.setStagingTables(new ArrayList<String>(staging)); } return clone; }
public void addChildElement(MappingElement elem) { if (elem.isRecursive()) { MappingRecursiveElement recursiveElement = (MappingRecursiveElement) elem; MappingBaseNode recursiveRoot = getRecursiveRootNode(recursiveElement); String mappingClass = recursiveElement.getMappingClass(); /* The upper case of the class is used in Teiid 7 mappings */ ITeiidVersion minVersion = getTeiidVersion().getMinimumVersion(); if (minVersion.isLessThan(Version.TEIID_8_0.get())) mappingClass = mappingClass.toUpperCase(); recursiveRoot.setRootRecursiveNode(true, mappingClass); addChild(elem); } else { addChild(elem); } }