Ejemplo n.º 1
0
        private JDFResourceCmdParams createResourceParams(string strJobPartID, string strResourceID, JDFAttributeMap amParts, JDFAttributeMap amAttr)
        {
            JDFJMF jmf = JDFJMF.createJMF(EnumFamily.Command, JDFMessage.EnumType.Resource);

            JDFCommand cmd = jmf.getCommand(0);

            JDFResourceCmdParams @params = cmd.appendResourceCmdParams();

            const string strJobID      = "RefJob-1";
            const string strPartIDKeys = "SignatureName SheetName Side";

            @params.setJobID(strJobID);
            @params.setJobPartID(strJobPartID);
            @params.setResourceID(strResourceID);
            @params.setResourceName("NodeInfo");
            @params.setUpdateMethod(EnumUpdateMethod.Incremental);

            @params.setPartMap(amParts);

            JDFResource nodeInfo = @params.appendResource("NodeInfo");

            JDFResource resLeaf = nodeInfo.getCreatePartition(amParts, new VString(strPartIDKeys, null));

            resLeaf.setAttributes(amAttr);

            return(@params);
        }
Ejemplo n.º 2
0
        ///
        ///	 <summary> * inline this refElement by replacing it with a copy of its target
        ///	 *  </summary>
        ///	 * <returns> JDFElement - the newly created element </returns>
        ///
        public virtual JDFElement inlineRef()
        {
            int         i;
            JDFResource targetRes = getTarget();

            if (targetRes == null)
            {
                throw new JDFException("inlineRef: inlining null refElement rRef=" + getrRef());
            }
            JDFResource newInline = (JDFResource)appendElement(targetRes.Name, null);

            // copy elements and attributes
            newInline.setAttributes(targetRes);
            VElement v = targetRes.getChildElementVector(null, null, null, true, 0, false);

            for (i = 0; i < v.Count; i++)
            {
                newInline.copyElement(v.item(i), null);
            }

            newInline.cleanResourceAttributes();
            VString partNames = targetRes.getPartIDKeys();

            for (i = 0; i < partNames.Count; i++)
            {
                newInline.removeAttribute(partNames[i], null);
            }

            // replace this (the refElement) with newInline.
            // This effectively repositions newInline from the back to the original
            // position of this
            replaceElement(newInline);

            targetRes.deleteUnLinked();
            return(newInline);
        }
Ejemplo n.º 3
0
            ///
            ///		 <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 </param>
            ///
            internal virtual void applyResourceCommand(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;
                    }
                    JDFResource resCmd = enclosingInstance.getResource(null);
                    if (resCmd == null)
                    {
                        continue;
                    }

                    bool isIncremental = (enclosingInstance.getUpdateMethod() == EnumUpdateMethod.Incremental);

                    // commented out, statements have no effect
                    // double dAmount = -1.0;
                    // if (hasAttribute (AttributeName.PRODUCTIONAMOUNT))
                    // {
                    // dAmount = getProductionAmount (); // TODO: set ProductionAmount
                    // }
                    // final String strProcessUsage = getProcessUsage(); // TODO: use
                    // ProcessUsage
                    // final JDFElement.EnumNodeStatus status = getStatus(); // TODO:
                    // set Status

                    VJDFAttributeMap vamParts  = enclosingInstance.getPartMapVector();
                    JDFResource      resTarget = getTargetResource(node);
                    if (resTarget == null)
                    {
                        resTarget = createNewResource(node, resCmd);
                        if (resTarget == null)
                        {
                            continue;
                        }
                    }

                    // get the most granular list of partIDKeys from the cmd or resource
                    VString vsPartIDKeys    = resTarget.getPartIDKeys();
                    VString vsPartIDKeysCmd = resCmd.getPartIDKeys();
                    int     sizTarget       = vsPartIDKeys == null ? 0 : vsPartIDKeys.Count;
                    int     sizCmd          = vsPartIDKeysCmd == null ? 0 : vsPartIDKeysCmd.Count;
                    if (sizCmd > sizTarget)
                    {
                        vsPartIDKeys = vsPartIDKeysCmd;
                    }

                    int sizeParts = vamParts == null ? 1 : vamParts.Count;
                    for (int j = 0; j < sizeParts; j++)
                    {
                        JDFAttributeMap amParts       = vamParts == null ? null : vamParts[j];
                        JDFResource     resTargetPart = resTarget.getCreatePartition(amParts, vsPartIDKeys);
                        if (resTargetPart == null)
                        {
                            continue;
                        }

                        string id = resTargetPart.getID();
                        if (!isIncremental)
                        {
                            JDFAttributeMap map = resTargetPart.getPartMap();
                            resTargetPart.flush();
                            resTargetPart.setAttributes(map);
                        }

                        JDFResource     resCmdPart = resCmd.getPartition(amParts, EnumPartUsage.Implicit);
                        JDFAttributeMap map2       = resCmdPart.getAttributeMap();
                        VString         keys       = map2.getKeys();
                        if (keys != null)
                        {
                            int keySize = keys.Count;
                            for (int k = 0; k < keySize; k++)
                            {
                                string key    = keys[k];
                                string @value = map2.get(key);
                                if (@value == null || JDFConstants.EMPTYSTRING.Equals(@value))
                                {
                                    resCmdPart.removeAttribute(key);
                                    resTargetPart.removeAttribute(key);
                                }
                            }
                        }

                        resTargetPart.mergeElement(resCmdPart, false);
                        resTarget.setID(id);
                    }

                    if (sizeParts > 0 && resTarget is JDFNodeInfo)
                    {
                        fixNodeStatusFromNodeInfo(node, resTarget);
                    }
                }
            }