コード例 #1
0
ファイル: JDFPipeParams.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * apply the parameters in this to all appropriate resources in parentNode or one of parentNode's children
        ///	 *  </summary>
        ///	 * <param name="parentNode"> the node to search in TODO implement resource handling </param>
        ///
        public virtual void applyPipeToNode(JDFNode parentNode)
        {
            if (parentNode == null)
            {
                return;
            }
            VElement vNodes = parentNode.getvJDFNode(null, null, false);

            int size = vNodes.Count;

            for (int i = 0; i < size; i++)
            {
                JDFNode node = (JDFNode)vNodes[i];
                if (!matchesNode(node))
                {
                    continue;
                }
                JDFElement.EnumNodeStatus status = getStatus(); // TODO: set
                // Status
                node.setStatus(status);

                // final boolean isIncremental = (getUpdateMethod () ==
                // EnumUpdateMethod.Incremental);
                double          dAmount = -1.0;
                JDFResourceLink rl      = getResourceLink();

                if (rl != null)
                {
                    JDFResourceLink rlNode = node.getLink(0, rl.Name, new JDFAttributeMap(AttributeName.RREF, rl.getrRef()), null);
                    if (rlNode == null)
                    {
                        throw new JDFException("Applying pipeparams to inconsistent node: missing resourcelink: " + rl.Name);
                    }

                    VJDFAttributeMap vMap = rl.getPartMapVector();
                    if (vMap == null)
                    {
                        vMap = new VJDFAttributeMap();
                        vMap.Add(null);
                    }
                    for (int j = 0; j < vMap.Count; j++)
                    {
                        JDFAttributeMap map = vMap[j];
                        dAmount = rl.getActualAmount(map);
                        rlNode.setActualAmount(dAmount, map);
                    }
                }
            }
        }
コード例 #2
0
        ///
        ///	 <summary> * sets all relevant parameters of <code>this</code> to the values specified in resourceLink or its linked resource
        ///	 * or JDF node
        ///	 *  </summary>
        ///	 * <param name="resourceLink"> the resourceLink to extract the information from </param>
        ///
        public virtual void setLink(JDFResourceLink resourceLink)
        {
            if (resourceLink == null)
            {
                return;
            }
            JDFResource r = resourceLink.getTarget();

            JDFNode parentJDF = resourceLink.getParentJDF();

            setJDF(parentJDF);
            setProcessUsage(resourceLink.getEnumProcessUsage());

            if (r.hasAttribute(AttributeName.PRODUCTID))
            {
                setProductID(r.getProductID());
            }
            setResourceID(r.getID());
            setResourceName(r.LocalName);
            setUsage(resourceLink.getUsage());
            setPartMapVector(resourceLink.getPartMapVector());
        }
コード例 #3
0
        public virtual void testLinkResourcePartition()
        {
            JDFDoc      d = new JDFDoc("JDF");
            JDFNode     n = d.getJDFRoot();
            JDFResource r = n.addResource("Component", null, null, null, null, null, null);

            Assert.IsTrue(r is JDFComponent);
            r = r.addPartition(EnumPartIDKey.SignatureName, "Sig1");
            r.addPartition(EnumPartIDKey.SheetName, "S1");
            Assert.IsFalse(n.hasChildElement("ResourceLinkPool", null));
            JDFResourceLinkPool rlp = n.getCreateResourceLinkPool();

            JDFResourceLink rl = rlp.linkResource(r, EnumUsage.Input, EnumProcessUsage.BookBlock);

            Assert.IsNotNull(rl);
            Assert.AreEqual(EnumProcessUsage.BookBlock, rl.getEnumProcessUsage());
            Assert.AreEqual(EnumUsage.Input, rl.getUsage());
            VJDFAttributeMap v = new VJDFAttributeMap();

            v.Add(new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"));
            Assert.AreEqual(v, rl.getPartMapVector());
        }