/// /// <summary> * Copy all data from parentNode into the ancestor elements of this /// * </summary> /// * <param name="parentNode"> the closest parent Node that contains the information to be copied </param> /// * <param name="bCopyNodeInfo"> if true, also copy the NodeInfo into the ancestor </param> /// * <param name="bCopyCustomerInfo"> if true, also copy the CustomerInfo into the ancestor </param> /// * <param name="bCopyComments"> if true, also copy the comments into the ancestor /// * @default copyNodeData(parentNode, false, false, false); </param> /// public virtual void copyNodeData(JDFNode parentNode, bool bCopyNodeInfo, bool bCopyCustomerInfo, bool bCopyComments) { VElement vAncestors = getPoolChildren(null); JDFNode node = parentNode; JDFNode thisParentNode = getParentJDF(); int i; for (i = vAncestors.Count - 1; i >= 0; i--) { JDFAncestor ancestor = (JDFAncestor)vAncestors[i]; if (!node.getID().Equals(ancestor.getNodeID())) { throw new JDFException("JDFAncestorPool::CopyNodeData: Invalid pairing"); } ancestor.setAttributes(node); ancestor.removeAttribute(AttributeName.XSITYPE); ancestor.renameAttribute(AttributeName.ID, AttributeName.NODEID, null, null); // only copy nodeinfo and customerinfo in real parent nodes, not in // this of partitioned spawns if (!thisParentNode.getID().Equals(node.getID())) { if (bCopyNodeInfo) { JDFNodeInfo nodeInfo = node.getNodeInfo(); if (nodeInfo != null) { if (nodeInfo.getParentNode_KElement() is JDFResourcePool) { // add a low level refelement, the copying takes // place inaddspawnedresources JDFRefElement re = (JDFRefElement)ancestor.appendElement(ElementName.NODEINFO + JDFConstants.REF); re.setrRef(nodeInfo.getID()); re.setPartMap(nodeInfo.getPartMap()); } else { ancestor.copyElement(nodeInfo, null); } } } if (bCopyCustomerInfo) { JDFCustomerInfo customerInfo = node.getCustomerInfo(); if (customerInfo != null) { if (customerInfo.getParentNode_KElement() is JDFResourcePool) { // add a low level refelement, the copying takes // place inaddspawnedresources JDFRefElement re = (JDFRefElement)ancestor.appendElement(ElementName.CUSTOMERINFO + JDFConstants.REF); re.setrRef(customerInfo.getID()); re.setPartMap(customerInfo.getPartMap()); } else { ancestor.copyElement(customerInfo, null); } } } if (bCopyComments) { VElement v = node.getChildElementVector(ElementName.COMMENT, null, null, true, 0, false); for (int j = 0; j < v.Count; j++) { ancestor.copyElement(v[j], null); } } } JDFNode node2 = node.getParentJDF(); // 100602 RP added i-- if (node2 == null) { i--; break; } node = node2; } // the original node was already spawned --> also copy the elements of // the original nodes Ancestorpool if (i >= 0) { VElement parentAncestors = node.getAncestorPool().getPoolChildren(null); int parentAncestorSize = parentAncestors.Count; if (parentAncestorSize < i + 1) { throw new JDFException("JDFAncestorPool.CopyNodeData: Invalid AncestorPool pairing"); } // now copy the ancestorpool elements that have not yet been added // from the original nodes for (; i >= 0; i--) { JDFAncestor ancestor = (JDFAncestor)vAncestors[i]; JDFAncestor parentAncestor = (JDFAncestor)parentAncestors[i]; ancestor.mergeElement(parentAncestor, false); } } }