/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFCustomerInfo initCustomerInfo() { if (theParentNode != null) { //ORIGINAL LINE: final JDFCustomerInfo customerInfo = theParentNode.getCustomerInfo(); JDFCustomerInfo customerInfo = theParentNode.getCustomerInfo(); if (customerInfo != null) { theNode.linkResource(customerInfo, EnumUsage.Input, null); return(customerInfo); } } JDFCustomerInfo ci = theNode.getCreateCustomerInfo(); ci.setResStatus(EnumResStatus.Available, false); ci.setCustomerID("customerID"); ci.setCustomerJobName("customer job name"); ci.setCustomerOrderID("customerOrder_1"); JDFContact contact = ci.appendContact(); contact.makeRootResource(null, null, true); contact.setContactTypes(new VString("Customer Administrator", " ")); JDFPerson person = contact.appendPerson(); person.setFamilyName("Töpfer"); person.setFirstName("Harald"); JDFCompany comp = contact.appendCompany(); comp.setOrganizationName("The Pits"); return(ci); }
public virtual void testgetUnlinkedResources() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); JDFResource r = n.addResource("Component", null, null, null, null, null, null); JDFResourcePool rp = n.getResourcePool(); Assert.IsTrue(r is JDFComponent); Assert.IsFalse(n.hasChildElement("ResourceLinkPool", null)); JDFResourceLinkPool rlp = n.getCreateResourceLinkPool(); Assert.AreEqual(r, rp.getUnlinkedResources()[0]); JDFResourceLink rl = rlp.linkResource(r, EnumUsage.Input, EnumProcessUsage.BookBlock); Assert.IsNotNull(rl); Assert.IsNull(rp.getUnlinkedResources()); JDFResource rx = n.addResource("ExposedMedia", null, null, null, null, null, null); Assert.AreEqual(rx, rp.getUnlinkedResources()[0]); n.setVersion(EnumVersion.Version_1_2); JDFCustomerInfo ci = n.appendCustomerInfo(); JDFContact co = ci.appendContact(); co = (JDFContact)co.makeRootResource(null, null, true); Assert.AreEqual(rx, rp.getUnlinkedResources()[0]); Assert.AreEqual(1, rp.getUnlinkedResources().Count); ci.deleteNode(); Assert.AreEqual(co, rp.getUnlinkedResources()[1]); Assert.AreEqual(2, rp.getUnlinkedResources().Count); }
/// /// protected internal virtual JDFCustomerInfo initCustomerInfo(string firstame, string lastame, string companyName, string jobName) { JDFCustomerInfo ci = theNode.getCreateCustomerInfo(); ci.setCustomerJobName(jobName); JDFContact c = ci.getContactWithContactType(EnumContactType.Customer.getName(), 0); if (c == null) { c = ci.appendContact(EnumContactType.Customer); } c.setPerson(firstame, lastame); if (companyName != null) { c.getCreateCompany().setOrganizationName(companyName); } return(ci); }
/// /// <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); } } }