Esempio n. 1
0
        ///
        ///	 * <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);
        }
Esempio n. 2
0
        ///
        ///	 <summary> * add a contact with a given contacttype
        ///	 *  </summary>
        ///	 * <param name="typ"> </param>
        ///
        public virtual JDFContact appendContact(EnumContactType typ)
        {
            JDFContact c = appendContact();

            c.setContactTypes(typ);
            return(c);
        }
Esempio n. 3
0
        private JDFCustomerInfo prepareInfo(JDFDoc doc)
        {
            JDFNode         n    = doc.getJDFRoot();
            JDFCustomerInfo info = n.appendCustomerInfo();
            VString         vct  = new VString();

            vct.Add("Customer");
            info.appendContact().setContactTypes(vct);
            vct.Add("Administrator");
            info.appendContact().setContactTypes(vct);
            JDFContact c = info.appendContact();

            vct = new VString();
            vct.Add("Delivery");
            c.setContactTypes(vct);
            c.makeRootResource(null, null, true);
            vct.Add("Customer");
            info.appendContact().setContactTypes(vct);
            return(info);
        }
Esempio n. 4
0
        public virtual void testRefElement()
        {
            JDFDoc  doc  = new JDFDoc(ElementName.JDF);
            JDFNode node = doc.getJDFRoot();

            node.setType("Product", true);
            node.setVersion(JDFElement.EnumVersion.Version_1_2);
            JDFNodeInfo ni = node.appendNodeInfo();

            ni.appendElement("foo:bar", "www.foo.com"); // want a non jdf ns element
            // to see if any class casts
            // occur
            JDFContact c       = (JDFContact)node.addResource(ElementName.CONTACT, null, null, null, null, null, null);
            VString    vCTypes = new VString();

            vCTypes.Add("Customer");
            c.setContactTypes(vCTypes);

            ni.refElement(c);
            JDFComChannel cc = (JDFComChannel)node.addResource(ElementName.COMCHANNEL, null, null, null, null, null, null);

            c.refElement(cc);

            Assert.AreEqual(c, ni.getChildWithMatchingAttribute(ElementName.CONTACT, "ContactTypes", null, "Customer", 0, true, null), "contact");
            Assert.AreEqual(c, ni.getParentJDF().getChildWithAttribute(ElementName.CONTACT, "ContactTypes", null, "Customer", 0, false), "contact");

            Assert.AreEqual(c, ni.getContact(), "contact");
            Assert.IsTrue(ni.hasChildElement(ElementName.CONTACT, null), "hasrefelement");
            JDFRefElement re = (JDFRefElement)ni.getElement("ContactRef");

            Assert.IsTrue(re.getTarget() == c, "refelementok");
            Assert.IsTrue(c.getComChannel(0) == cc, "comchannel");
            Assert.IsTrue(c.hasChildElement(ElementName.COMCHANNEL, null), "hasrefelement");
            JDFNode     n2  = node.addProduct();
            JDFNodeInfo ni2 = n2.appendNodeInfo();

            ni2.refElement(c);
            Assert.IsTrue(c.matchesPath("NodeInfo/Contact", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsFalse(c.matchesPath("NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");

            Assert.IsTrue(ni2.getContact() == c, "contact 2");
            Assert.IsTrue(ni2.hasChildElement(ElementName.CONTACT, null), "hasrefelement 2");
            re = (JDFRefElement)ni2.getElement("ContactRef");
            Assert.IsTrue(re.getTarget() == c, "refelementok 2");

            ni2.inlineRefElements(null, null, true);
            Assert.IsNull(ni2.getElement("ContactRef"), "get ref post inline");
            Assert.IsNotNull(node.getResourcePool().getElement("Contact"), "refElement has been removed");
            Assert.IsTrue(ni2.hasChildElement(ElementName.CONTACT, null), "haselement 3");
            c  = ni2.getContact();
            re = (JDFRefElement)c.getElement("ComChannelRef");
            Assert.IsTrue(re.getTarget() == cc, "refelementok 2");
            ni2.inlineRefElements(null, null, false);
            Assert.IsNull(ni2.getElement("ComChannelRef"), "get ref post inline 2");
            Assert.IsTrue(c.hasChildElement(ElementName.COMCHANNEL, null), "haselement 4");

            ni.inlineRefElements(null, null, true);
            Assert.IsNull(ni.getElement("ContactRef"), "get ref post inline");
            Assert.IsNull(node.getResourcePool().getElement("Contact"), "refElement has been removed");
            Assert.IsTrue(ni.hasChildElement(ElementName.CONTACT, null), "haselement 3");

            c = ni.getContact();
            c.makeRootResource(null, null, true);
            re = (JDFRefElement)ni.getElement("ContactRef");
            re.deleteRef(true);
            Assert.IsNull(c.getElement("ContactRef"));
        }