コード例 #1
0
ファイル: JDFResourceInfo.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * sets all relevant parameters of this 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>
        ///	 * <param name="rqp"> parameters </param>
        ///
        public virtual void setLink(JDFResourceLink resourceLink, JDFResourceQuParams rqp)
        {
            if (resourceLink == null)
            {
                return;
            }
            JDFAmountPool ap = resourceLink.getAmountPool();

            if (ap != null)
            {
                copyElement(ap, null);
            }
            else
            {
                if (resourceLink.hasAttribute(AttributeName.ACTUALAMOUNT))
                {
                    setActualAmount(resourceLink.getActualAmount(null));
                }
                if (resourceLink.hasAttribute(AttributeName.AMOUNT))
                {
                    setAmount(resourceLink.getAmount(null));
                }
            }
            setProcessUsage(resourceLink.getEnumProcessUsage());

            JDFResource r = resourceLink.getTarget();

            if (r == null && rqp != null)
            {
                rqp.setExact(false);
            }

            bool bExact = rqp == null ? false : rqp.getExact();

            if (!bExact || r == null) // if we do not have a resource let's limp
            // along and provide as much as we have
            {
                setResourceName(resourceLink.getLinkedResourceName());
                setAttribute(AttributeName.RESOURCEID, resourceLink.getrRef());
                EnumUsage usage = resourceLink.getUsage();
                if (usage != null)
                {
                    setAttribute(AttributeName.USAGE, usage.getName());
                }
                if (r != null && r.hasAttribute(AttributeName.PRODUCTID))
                {
                    setProductID(r.getProductID());
                }
            }
            else
            {
                // create a copy of the resource in the original jdf
                JDFResource rr = (JDFResource)r.getParentNode_KElement().copyElement(r, null);
                rr.inlineRefElements(null, null, true);
                // move resource copy from the original node into this document
                moveElement(rr, null);
            }
        }