예제 #1
0
        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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
0
        ///
        ///     <summary> * Get all Contact from the current element
        ///     *  </summary>
        ///     * <returns> Collection<JDFContact> </returns>
        ///
        public virtual ICollection <JDFContact> getAllContact()
        {
            List <JDFContact> v = new List <JDFContact>();

            JDFContact kElem = (JDFContact)getFirstChildElement(ElementName.CONTACT, null);

            while (kElem != null)
            {
                v.Add(kElem);

                kElem = (JDFContact)kElem.getNextSiblingElement(ElementName.CONTACT, null);
            }

            return(v);
        }
예제 #5
0
        ///
        ///	 <summary> * get a list of contacts with at least one contacttype set
        ///	 *  </summary>
        ///	 * <param name="contactType"> the contatcttype to look for </param>
        ///	 * <returns> VElement the vector of matching JDFContacts, null if none are found </returns>
        ///
        public virtual VElement getContactVectorWithContactType(string contactType)
        {
            VElement v   = getChildElementVector(ElementName.CONTACT, null, null, true, 0, true);
            VElement v2  = new VElement();
            int      siz = v.Count;

            for (int i = 0; i < siz; i++)
            {
                JDFContact contact      = (JDFContact)v[i];
                VString    contactTypes = contact.getContactTypes();
                if (contactTypes.Contains(contactType))
                {
                    v2.Add(contact);
                }
            }
            return(v2.Count > 0 ? v2 : null);
        }
예제 #6
0
        ///
        ///
        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);
        }
예제 #7
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);
        }
예제 #8
0
        public virtual void testGetContactWithContactType()
        {
            JDFDoc          doc  = new JDFDoc("JDF");
            JDFCustomerInfo info = prepareInfo(doc);

            JDFContact cc = info.getContactWithContactType("Customer", 0);

            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("Customer", 2);
            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("Customer", 1);
            Assert.IsNotNull(cc, "cc");
            JDFContact cc2 = info.getContactWithContactType("Administrator", 0);

            Assert.IsNotNull(cc2, "cc2");
            Assert.AreEqual(cc, cc2, "cc2");
            cc = info.getContactWithContactType("Delivery", 0);
            Assert.IsNotNull(cc, "cc");
            cc = info.getContactWithContactType("fnarf", 0);
            Assert.IsNull(cc, "cc");
        }
예제 #9
0
        public virtual void testMatchesPath()
        {
            JDFDoc  doc  = new JDFDoc(ElementName.JDF);
            JDFNode node = doc.getJDFRoot();

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

            ni = (JDFNodeInfo)ni.addPartition(EnumPartIDKey.Run, "R1");
            JDFContact c = (JDFContact)node.addResource(ElementName.CONTACT, null, null, null, null, null, null);

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

            c.refElement(cc);
            Assert.IsTrue(ni.getContact() == c, "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("ResourcePool/NodeInfo/Contact", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("//JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsTrue(cc.matchesPath("/JDF/*/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow * in matchespath");
            Assert.IsFalse(cc.matchesPath("JDF/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsFalse(cc.matchesPath("JDF/JDF/JDF/ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
            Assert.IsFalse(c.matchesPath("ResourcePool/NodeInfo/Contact/ComChannel", true), "follow refs in matchespath");
        }
예제 #10
0
 ///
 ///      <summary> * (31) create inter-resource link to refTarget </summary>
 ///      * <param name="refTarget"> the element that is referenced </param>
 ///
 public virtual void refContact(JDFContact refTarget)
 {
     refElement(refTarget);
 }
예제 #11
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"));
        }