Пример #1
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);
                    }
                }
            }
Пример #2
0
            ///
            ///		 <summary> * sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the
            ///		 * AmountPool and/or PartAmount(s) if they are not yet there
            ///		 *  </summary>
            ///		 * <param name="attrib"> the attribute name </param>
            ///		 * <param name="value"> value to set in string form. </param>
            ///		 * <param name="nameSpaceURI"> the XML-namespace </param>
            ///		 * <param name="vPart"> defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink
            ///		 *            root attribute. </param>
            ///		 * <exception cref="JDFException"> when called directly on a PartAmount
            ///		 * @since 060630 </exception>
            ///
            public static void setAmountPoolAttribute(IAmountPoolContainer poolParent, string attrib, string @value, string nameSpaceURI, VJDFAttributeMap vPart)
            {
                // ideally the method would be hidden in PartAmount
                if ((vPart == null) || (vPart.IsEmpty()) || vPart.Count == 1 && vPart[0].Count == 0)
                {
                    poolParent.setAttribute(attrib, @value, nameSpaceURI);
                    return;
                }
                poolParent.removeAttribute(attrib, nameSpaceURI); // either in the
                // pool or the
                // link, not both
                JDFAmountPool ap  = poolParent.getCreateAmountPool();
                JDFPartAmount pa0 = ap.getCreatePartAmount(vPart);

                pa0.setAttribute(attrib, @value, nameSpaceURI);
            }
Пример #3
0
        public virtual VString copyResource(JDFResource r, JDFResource.EnumSpawnStatus copyStatus, VJDFAttributeMap vParts, string spawnID)
        {
            VString ss = getResIds();
            VString v  = new VString();

            // r is not yet here copy r
            if (!ss.Contains(r.getID()))
            {
                JDFResource rNew = null;
                // if spawning, fix stati and locks
                if (copyStatus == JDFResource.EnumSpawnStatus.SpawnedRO)
                {
                    // copy the complete resource as RO - no need to reduce
                    // partitions
                    r.appendSpawnIDs(spawnID);
                    rNew = (JDFResource)copyElement(r, null);
                    rNew.setLocked(true);
                    r.setSpawnStatus(copyStatus);
                }
                else if (copyStatus == JDFResource.EnumSpawnStatus.SpawnedRW)
                {
                    if (vParts.Count == 0)
                    { // just copy the whole thing - no parts specified
                        r.appendSpawnIDs(spawnID);
                        rNew = (JDFResource)copyElement(r, null);
                        r.setSpawnStatus(copyStatus);
                    }
                    else
                    {
                        rNew = (JDFResource)copyElement(r, null);
                        rNew.reducePartitions(vParts);
                        // reduce any unneeded leaves
                        // loop over all part maps to get best matching resource
                        for (int i = 0; i < vParts.Count; i++)
                        {
                            JDFResource pLeaf    = r.getPartition(vParts[i], null);
                            JDFResource pNewLeaf = rNew.getPartition(vParts[i], null);
                            if (pLeaf != null)
                            {
                                pLeaf.setSpawnStatus(copyStatus);
                                pLeaf.appendSpawnIDs(spawnID);
                            }
                            if (pNewLeaf != null)
                            {
                                pNewLeaf.appendSpawnIDs(spawnID);
                            }
                        }
                    }
                }

                if (rNew != null)
                {
                    v.Add(rNew.getID());
                }
            }

            VString vs = r.getHRefs(null, false, true);

            // add recursively copied resources
            for (int i = 0; i < vs.Count; i++)
            {
                string id = vs[i];
                // the referenced resource is in this pool - continue
                if (ss.Contains(id))
                {
                    continue;
                }

                // the referenced resource has already been merged in - continue
                if (v.Contains(id))
                {
                    continue;
                }

                JDFResource next = (JDFResource)getDocRoot().getTarget(id, AttributeName.ID);
                if (next == null)
                {
                    // 071101 RP added r is by definition in the original document
                    // which also contains the rrefs elements
                    next = (JDFResource)r.getDocRoot().getTarget(id, AttributeName.ID);
                    // and now all those interlinked resources
                    VString vv = copyResource(next, copyStatus, vParts, spawnID);
                    v.AddRange(vv);
                }
            }

            return(v);
        }
Пример #4
0
        ///
        ///	 <summary> * } getAudits - get all audits with attributes and partMap
        ///	 *  </summary>
        ///	 * <param name="typ"> type of the audit to take </param>
        ///	 * <param name="mAttributes"> attribute map to filter the audits </param>
        ///	 * <param name="vParts"> the partmap vector - note that not all audits legally have parts </param>
        ///	 * <returns> VElement - all elements, that matches the filter
        ///	 *
        ///	 *         default: getAudits(null, null, null) </returns>
        ///
        public virtual VElement getAudits(JDFAudit.EnumAuditType typ, JDFAttributeMap mAttributes, VJDFAttributeMap vParts)
        {
            VJDFAttributeMap vPartsLocal  = vParts;
            string           strAuditType = null;

            if (typ != null)
            {
                strAuditType = typ.getName();
            }

            VElement vElem = getPoolChildrenGeneric(strAuditType, mAttributes, null);

            if (vPartsLocal != null && vPartsLocal.Count == 0)
            {
                vPartsLocal = null;
            }

            for (int i = vElem.Count - 1; i >= 0; i--)
            { // remove known comments - this would be aught in the next check but
                // we avoid the exception
                if (!(vElem[i] is JDFAudit))
                {
                    vElem.RemoveAt(i);
                    continue; // look at next element
                }

                JDFAudit audit = (JDFAudit)vElem[i];
                if (vPartsLocal != null && !vPartsLocal.Equals(audit.getPartMapVector()))
                {
                    vElem.RemoveAt(i);
                    continue; // look at next element
                }
            }
            return(vElem);
        }
Пример #5
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal virtual void initPlateXM(EnumUsage usage)
        {
            JDFResourceLink rl = null;

            if (thePreviousNode != null) // either input (for cp, or output for
            // plateset)
            {
                rl = theNode.linkResource(thePreviousNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            if (rl == null && theParentNode != null)
            {
                rl = theNode.ensureLink(theParentNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            JDFExposedMedia xm = (JDFExposedMedia)theNode.getCreateResource(ElementName.EXPOSEDMEDIA, usage, 0);

            xm.setPartUsage(EnumPartUsage.Explicit);
            rl = theNode.getLink(xm, null);

            JDFMedia m = ((JDFExposedMedia)xm.getLeaves(false)[0]).getMedia();

            if (m == null)
            {
                m = initPlateMedia();
            }
            else
            {
                m = (JDFMedia)m.getResourceRoot();
                if (theParentNode != null)
                {
                    theNode.ensureLink(theParentNode.getResource("Media", EnumUsage.Input, 0), EnumUsage.Input, null);
                }
            }
            xm.setResStatus(EnumResStatus.Unavailable, false);
            if (!bPartitionedPlateMedia && xm.getMedia() == null)
            {
                xm.refElement(m);
            }
            if (EnumUsage.Input.Equals(usage))
            {
                rl.setProcessUsage(EnumProcessUsage.Plate);
                JDFResourceLink link = theNode.getLink(m, null);
                if (link != null)
                {
                    link.deleteNode();
                }
            }

            if (vParts != null)
            {
                for (int i = 0; i < vParts.Count; i++)
                {
                    JDFAttributeMap part  = new JDFAttributeMap(vParts[i]);
                    JDFResource     xmp   = xm.getCreatePartition(part, partIDKeys);
                    int             ncols = "Front".Equals(part.get("Side")) ? nCols[0] : nCols[1];

                    for (int j = 0; j < ncols; j++)
                    {
                        part.put(EnumPartIDKey.Separation, cols.stringAt(j));
                        xmp.getCreatePartition(part, partIDKeys);
                    }
                }
                if (bPartitionedPlateMedia)
                {
                    VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null));
                    for (int i = 0; i < vSheets.Count; i++)
                    {
                        JDFAttributeMap part = new JDFAttributeMap(vSheets[i]);
                        JDFExposedMedia xmp  = (JDFExposedMedia)xm.getCreatePartition(part, partIDKeys);
                        if (xmp.getMedia() == null)
                        {
                            xmp.refMedia((JDFMedia)m.getCreatePartition(part, null));
                        }
                    }
                }
            }
        }
Пример #6
0
        ///
        ///	 <summary> * Append a Spawned audit element
        ///	 *  </summary>
        ///	 * <param name="spawned"> the spawned node </param>
        ///	 * <param name="rRefsRO"> a vector of rRefs that are spawned read-only </param>
        ///	 * <param name="rRefsRW"> a vector of rRefs that are spawned read-write </param>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <param name="vmParts">
        ///	 *  </param>
        ///	 * <returns> JDFAudit - the newly created Spawned audit
        ///	 *
        ///	 *         default: AddSpawned(spawned, new Vector(), new Vector(), JDFConstants.EMPTYSTRING, new
        ///	 *         VJDFAttributeMap()) </returns>
        ///
        public virtual JDFSpawned addSpawned(JDFNode spawned, VString rRefsRO, VString rRefsRW, string by, VJDFAttributeMap vmParts)
        {
            JDFSpawned a = (JDFSpawned)addAudit(JDFAudit.EnumAuditType.Spawned, by);

            a.setAttribute(JDFConstants.JREF, spawned.getID(), null);
            string ms = null;

            if (rRefsRO != null && !rRefsRO.IsEmpty())
            {
                ms = StringUtil.setvString(rRefsRO);
                a.setAttribute(AttributeName.RREFSROCOPIED, ms, null);
            }

            if (rRefsRW != null && !rRefsRW.IsEmpty())
            {
                ms = StringUtil.setvString(rRefsRW);
                a.setAttribute(AttributeName.RREFSRWCOPIED, ms, null);
            }

            a.setPartMapVector(vmParts);

            return(a);
        }
Пример #7
0
        ///
        ///	 <summary> * Append a Notification audit element with a Class attribute of Severity
        ///	 *  </summary>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <param name="s"> the severity
        ///	 *  </param>
        ///	 * <returns> JDFAudit - the newly created Notification audit </returns>
        ///
        public virtual JDFNotification addNotification(JDFNotification.EnumClass severity, string by, VJDFAttributeMap vmParts)
        {
            JDFNotification l = (JDFNotification)addAudit(JDFAudit.EnumAuditType.Notification, by);

            if (l != null)
            {
                if (severity != null)
                {
                    l.setClass(severity);
                }
                l.setPartMapVector(vmParts);
            }
            return(l);
        }
Пример #8
0
 ///
 ///	 <summary> * sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the
 ///	 * AmountPool and/or PartAmount(s) if they are not yet there
 ///	 *  </summary>
 ///	 * <param name="attrib"> the attribute name </param>
 ///	 * <param name="value"> value to set in string form. </param>
 ///	 * <param name="nameSpaceURI"> the XML-namespace </param>
 ///	 * <param name="vPart"> defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink root
 ///	 *            attribute. </param>
 ///	 * <exception cref="JDFException"> when called directly on a PartAmount
 ///	 * @since 060630 </exception>
 ///
 public virtual void setAmountPoolAttribute(string attrib, string @value, string nameSpaceURI, VJDFAttributeMap vPart)
 {
     AmountPoolHelper.setAmountPoolAttribute(this, attrib, @value, nameSpaceURI, vPart);
 }
Пример #9
0
 ///
 ///	 <summary> * returns the attribute occurence in PartAmount, or the default in the ResourceLink
 ///	 *  </summary>
 ///	 * <param name="attrib"> the attribute name </param>
 ///	 * <param name="nameSpaceURI"> the XML-namespace </param>
 ///	 * <param name="vPart"> defines which part of this ResourceLink the Amount belongs to. If null get the ResourceLink root
 ///	 *            attribute. </param>
 ///	 * <returns> value of attribute found, null if not available
 ///	 * @since 071103 </returns>
 ///
 public virtual string getAmountPoolAttribute(string attrib, string nameSpaceURI, VJDFAttributeMap vPart)
 {
     return(AmountPoolHelper.getAmountPoolAttribute(this, attrib, nameSpaceURI, vPart));
 }
Пример #10
0
        ///
        ///	 <summary> * check whether the Ancestor pool contains any part elements
        ///	 *  </summary>
        ///	 * <returns> true if the pool comtains part elements </returns>
        ///
        public virtual bool isPartitioned()
        {
            VJDFAttributeMap partMapVector = getPartMapVector();

            return(partMapVector != null && partMapVector.Count > 0);
        }
Пример #11
0
 ///
 ///	 <summary> * create a BaseGoldenTicket
 ///	 *  </summary>
 ///	 * <param name="_icsLevel"> the level to init to (1,2 or 3) </param>
 ///	 * <param name="jdfVersion"> the version to generate a golden ticket for </param>
 ///	 * <param name="_jmfLevel"> level of jmf ICS to support </param>
 ///	 * <param name="_misLevel"> level of MIS ICS to support </param>
 ///	 * <param name="isGrayBox"> if true, write a grayBox </param>
 ///	 * <param name="vPartMap"> the partmap vector for this node </param>
 ///
 public MISCPGoldenTicket(int _icsLevel, EnumVersion jdfVersion, int _jmfLevel, int _misLevel, bool isGrayBox, VJDFAttributeMap vPartMap)
     : base(_misLevel, jdfVersion, _jmfLevel)
 {
     icsLevel = _icsLevel;
     vParts   = vPartMap;
     grayBox  = isGrayBox;
     setup();
 }
Пример #12
0
        public virtual VString findQueueEntries(string strJobID, string strJobPartID, VJDFAttributeMap vamParts, EnumQueueEntryStatus status)
        {
            VString vsQEntryIDs = new VString();

            int entryCount = getEntryCount();

            for (int i = 0; i < entryCount; i++)
            {
                JDFQueueEntry entry = getQueueEntry(i);

                string strQEJobID     = entry.getJobID();
                string strQEJobPartID = entry.getJobPartID();

                VJDFAttributeMap vamQEParts = entry.getPartMapVector();

                EnumQueueEntryStatus statusQE = entry.getQueueEntryStatus();

                if (strJobID.Equals(strQEJobID) && strJobPartID.Equals(strQEJobPartID) && vamParts.Equals(vamQEParts))
                {
                    if ((status == null) || (status.Equals(statusQE)))
                    {
                        vsQEntryIDs.appendUnique(entry.getQueueEntryID());
                    }
                }
            }

            return(vsQEntryIDs);
        }
Пример #13
0
        public virtual void testDirtyIDs()
        {
            // -i bookintent.jdf -o spawned.jdf -p 4
            string xmlFile   = "bookintent.jdf";
            string outFile   = "spawned.jdf";
            string strPartID = "4";

            JDFParser p        = new JDFParser();
            JDFDoc    jdfDocIn = p.parseFile(sm_dirTestData + xmlFile);

            Assert.IsTrue(jdfDocIn != null);
            if (jdfDocIn == null)
            {
                return; // soothe findbugs ;)
            }

            XMLDocUserData xmlUserData = jdfDocIn.getCreateXMLDocUserData();

            xmlUserData.setDirtyPolicy(XMLDocUserData.EnumDirtyPolicy.ID);

            JDFNode rootIn = (JDFNode)jdfDocIn.getRoot();

            JDFNode nodeToSpawn;

            if (strPartID.Equals(""))
            {
                nodeToSpawn = rootIn;
            }
            else
            {
                nodeToSpawn = rootIn.getJobPart(strPartID, "");
            }

            if (nodeToSpawn == null)
            {
                Assert.Fail("No such JobPartID: " + strPartID);
            }
            else
            {
                ArrayList vRWResources = new ArrayList();
                vRWResources.Add("Component");
                vRWResources.Add("RunList");

                VJDFAttributeMap vSpawnParts = new VJDFAttributeMap();
                JDFSpawn         spawn       = new JDFSpawn(nodeToSpawn);

                JDFNode node = spawn.spawn(xmlFile, outFile, vRWResources, vSpawnParts, false, false, false, false);

                // neu gespawntes FileInfo rausschreiben
                JDFNode rootOut = node;
                XMLDoc  docOut  = rootOut.getOwnerDocument_KElement();
                docOut.write2File(sm_dirTestDataTemp + outFile, 0, true);

                // verändertes Ausgangsfile rausschreiben
                string strOutXMLFile = "_" + xmlFile;
                rootIn.eraseEmptyNodes(true);
                jdfDocIn.write2File(sm_dirTestDataTemp + strOutXMLFile, 0, true);
                Assert.IsTrue(true, "SpawnJDF ok");

                // test, if all changed nodes are in our list

                // Java to C# Conversion - Java version indicated there should be 5 Dirty IDs, but it only checks for 4.
                //                         C# version returns 4 Dirty IDs.  Set it to 4 for now.
                VString vstrDirtyIDs = jdfDocIn.getDirtyIDs();
                Assert.AreEqual(4, vstrDirtyIDs.Count);
                Assert.IsTrue(vstrDirtyIDs.Contains("n0014")); // audit pool was added
                Assert.IsTrue(vstrDirtyIDs.Contains("n0016")); // status changed:
                // waiting --> spawned
                Assert.IsTrue(vstrDirtyIDs.Contains("r0017")); //SpawnStatus="SpawnedRW"
                // added
                Assert.IsTrue(vstrDirtyIDs.Contains("r0018")); // SizeIntent added
            }
        }
Пример #14
0
 ///
 ///	 <summary> * create a BaseGoldenTicket
 ///	 *  </summary>
 ///	 * <param name="icsLevel"> the level to init to (1,2 or 3) </param>
 ///	 * <param name="jdfVersion"> the version to generate a golden ticket for </param>
 ///	 * <param name="jmfLevel"> level of jmf ICS to support </param>
 ///	 * <param name="misLevel"> level of MIS ICS to support </param>
 ///	 * <param name="isGrayBox"> if true, write a grayBox </param>
 ///
 public MISFinGoldenTicket(int _icsLevel, EnumVersion jdfVersion, int _jmfLevel, int _misLevel, bool isGrayBox, VJDFAttributeMap vPartMap)
     : base(_misLevel, jdfVersion, _jmfLevel)
 {
     catMap.Add(MISFIN_SHEETFIN, new VString("Cutting Folding", null));
     partIDKeys = new VString("SignatureName,SheetName", ",");
     vParts     = vPartMap;
     icsLevel   = _icsLevel;
 }
Пример #15
0
 ///
 ///	 <summary> * set all parts to those defined by vParts
 ///	 *  </summary>
 ///	 * <param name="vParts"> vector of attribute maps for the parts </param>
 ///
 public override void setPartMapVector(VJDFAttributeMap vParts)
 {
     base.setPartMapVector(vParts);
 }
Пример #16
0
 public virtual double getAmountPoolSumDouble(string attName, VJDFAttributeMap vPart)
 {
     return(AmountPoolHelper.getAmountPoolSumDouble(this, attName, vPart));
 }
Пример #17
0
        ///
        ///	 <summary> * Add a ProcessRun Audit
        ///	 *  </summary>
        ///	 * <param name="s"> the node status at this time </param>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <returns> the newly created ProcessRun audit
        ///	 *
        ///	 *         default: AddProcessRun(s, JDFConstants.EMPTYSTRING) </returns>
        ///
        public virtual JDFProcessRun addProcessRun(JDFElement.EnumNodeStatus s, string by, VJDFAttributeMap vmParts)
        {
            JDFProcessRun pr = (JDFProcessRun)addAudit(JDFAudit.EnumAuditType.ProcessRun, by);

            pr.setStart(null);
            pr.setEnd(null);
            pr.setEndStatus(s);
            pr.setPartMapVector(vmParts);

            return(pr);
        }
Пример #18
0
            ///
            ///		 <summary> * returns the attribute occurence in PartAmount, or the default in the ResourceLink
            ///		 *  </summary>
            ///		 * <param name="attrib"> the attribute name </param>
            ///		 * <param name="nameSpaceURI"> the XML-namespace </param>
            ///		 * <param name="vPart"> defines which part of this ResourceLink the Amount belongs to. If null get the ResourceLink root
            ///		 *            attribute. </param>
            ///		 * <returns> value of attribute found, null if not available
            ///		 * @since 071103 </returns>
            ///
            public static string getAmountPoolAttribute(IAmountPoolContainer poolParent, string attrib, string nameSpaceURI, VJDFAttributeMap vPart)
            {
                // want a map but already in a partamount - snafu
                if (poolParent is JDFPartAmount)
                {
                    if (vPart != null)
                    {
                        throw new JDFException("JDFResourceLink.getAmountPoolAttribute: calling method on PartAmount object");
                    }
                    return(poolParent.getAttribute(attrib, nameSpaceURI, null));
                }
                // default to attribute if no amountpool
                JDFAmountPool amountPool = poolParent.getAmountPool();

                if (amountPool == null || vPart == null)
                {
                    return(poolParent.getAttribute(attrib, nameSpaceURI, null));
                }
                JDFPartAmount pa = amountPool.getPartAmount(vPart);

                if (pa != null) // we have a pa; if it has the attribute return its
                // value, else get the link attribute
                {
                    string ret = pa.getAttribute(attrib, nameSpaceURI, null);
                    if (ret != null)
                    {
                        return(ret);
                    }
                }

                return(poolParent.getAttribute(attrib, nameSpaceURI, null));
            }
Пример #19
0
        ///
        ///	 <summary> * Append a Merged audit element
        ///	 *  </summary>
        ///	 * <param name="merged"> the merged node </param>
        ///	 * <param name="rRefsOverwritten"> a vector of rRefs that are overwritten </param>
        ///	 * <param name="by"> the author keyword
        ///	 *  </param>
        ///	 * <returns> JDFMerged - the newly created Merged audit
        ///	 *
        ///	 *         default: AddMerged(merged, rRefsOverwritten, JDFConstants.EMPTYSTRING, null) </returns>
        ///
        public virtual JDFMerged addMerged(JDFNode merged, VString rRefsOverwritten, string by, VJDFAttributeMap vmParts)
        {
            VString rRefsOverwrittenLocal = rRefsOverwritten;

            JDFMerged mergedAudit = (JDFMerged)addAudit(JDFAudit.EnumAuditType.Merged, by);

            mergedAudit.setjRef(merged.getID());
            if (rRefsOverwrittenLocal != null && rRefsOverwrittenLocal.IsEmpty())
            {
                rRefsOverwrittenLocal = null;
            }
            mergedAudit.setrRefsOverwritten(rRefsOverwrittenLocal);

            mergedAudit.setPartMapVector(vmParts);
            return(mergedAudit);
        }
Пример #20
0
            ///
            ///		 <summary> * get the exactly matching AmountPool/PartAmount/@AttName as a double
            ///		 *  </summary>
            ///		 * <param name="attName"> </param>
            ///		 * <param name="vPart"> </param>
            ///		 * <returns> double - </returns>
            ///		 * <exception cref="JDFException"> if the element can not be cast to double </exception>
            ///
            public static double getAmountPoolDouble(IAmountPoolContainer poolParent, string attName, VJDFAttributeMap vPart)
            {
                double d = 0;
                string w = getAmountPoolAttribute(poolParent, attName, null, vPart);

                if (w == null)
                {
                    return(-1);
                }
                d = StringUtil.parseDouble(w, -1.234567);
                if (d == -1.234567)
                {
                    throw new JDFException("JDFResourceLink.getAmountPoolDouble: Attribute " + attName + " has an invalid value");
                }
                return(d);
            }
Пример #21
0
 public virtual JDFPhaseTime getLastPhase(VJDFAttributeMap vPartMap)
 {
     return(getLastPhase(vPartMap, null));
 }
Пример #22
0
            ///

            ///
            ///		 <summary> * gets the sum of all matching tags, with the assumpzion that no condition defaults to good
            ///		 *  </summary>
            ///		 * <param name="poolParent">  </param>
            ///		 * <param name="attName">  </param>
            ///		 * <param name="vPart">  </param>
            ///		 * <returns> the sum
            ///		 *  </returns>
            ///
            public static double getAmountPoolSumDouble(IAmountPoolContainer poolParent, string attName, VJDFAttributeMap vPart)
            {
                VJDFAttributeMap vPartLocal = vPart;

                if (vPartLocal == null)
                {
                    vPartLocal = poolParent.getPartMapVector();
                }

                if (poolParent.hasAttribute(attName))
                {
                    return(poolParent.getRealAttribute(attName, null, 0));
                }

                VJDFAttributeMap vm       = vPartLocal == null ? null : new VJDFAttributeMap(vPartLocal);
                JDFResource      linkRoot = poolParent.getLinkRoot();

                if (linkRoot != null && vm != null)
                {
                    SupportClass.SetSupport <string> @set = linkRoot.getPartIDKeys().getSet();
                    @set.Add(AttributeName.CONDITION); // retain good / waste
                    vm.reduceMap(@set);
                }

                if (vm == null)
                {
                    vm = new VJDFAttributeMap();
                    vm.Add((JDFAttributeMap)null);
                }

                double        dd = 0;
                JDFAmountPool ap = poolParent.getAmountPool();

                if (ap == null)
                {
                    return(poolParent.getRealAttribute(attName, null, 0.0));
                }

                VElement vParts = ap.getChildElementVector(ElementName.PARTAMOUNT, null);

                if (vParts.IsEmpty())
                {
                    return(poolParent.getRealAttribute(attName, null, 0.0));
                }

                bool isWaste = vPartLocal != null && vPartLocal.subMap(new JDFAttributeMap(AttributeName.CONDITION, "Waste"));

                if (!isWaste && (vPartLocal == null || !vPartLocal.subMap(new JDFAttributeMap(AttributeName.CONDITION, "*"))))
                {
                    vPartLocal = new VJDFAttributeMap(vPartLocal);
                    vPartLocal.Add(new JDFAttributeMap(AttributeName.CONDITION, "Good"));
                }

                for (int j = 0; j < vParts.Count; j++)
                {
                    JDFPartAmount    pa            = (JDFPartAmount)vParts[j];
                    VJDFAttributeMap partMapVector = pa.getPartMapVector();
                    if (isWaste)
                    {
                        bool hasCondition = partMapVector.subMap(new JDFAttributeMap(AttributeName.CONDITION, "*"));
                        if (!hasCondition)
                        {
                            continue;
                        }
                    }

                    if (!partMapVector.overlapsMap(vm))
                    {
                        continue;
                    }

                    string ret = null;
                    ret = pa.getAttribute(attName, null, null);
                    if (ret == null)
                    {
                        ret = poolParent.getAttribute(attName, null, null);
                    }

                    dd += StringUtil.parseDouble(ret, 0.0);
                }

                return(dd);
            }
Пример #23
0
        ///
        ///	 <summary> * get the index'th audit of the given typ
        ///	 *  </summary>
        ///	 * <param name="index"> index of the audit negativ values are possible and will be substracted from the vector size. For
        ///	 *            example,your given Filter returns a Vector of 10 Posible Elements and your index is -7 you will get 10
        ///	 *            - 7 = Element Number 3 </param>
        ///	 * <param name="typ"> type of the audit to take </param>
        ///	 * <param name="mAttributes"> attribute map to filter the audits </param>
        ///	 * <param name="vParts"> the partmap vector - note that not all audits legally have parts </param>
        ///	 * <returns> an Audit that matches the filers
        ///	 *
        ///	 *         default: getAudit(index, typ, null) </returns>
        ///
        public virtual JDFAudit getAudit(int index, JDFAudit.EnumAuditType typ, JDFAttributeMap mAttributes, VJDFAttributeMap vParts)
        {
            int indexLocal = index;

            VElement v = getAudits(typ, mAttributes, vParts);

            if (indexLocal < 0)
            {
                indexLocal = v.Count + indexLocal;
            }
            if (indexLocal >= v.Count || indexLocal < 0)
            {
                return(null);
            }

            return((JDFAudit)v[indexLocal]);
        }
Пример #24
0
 public virtual void setActivePart(VJDFAttributeMap vp, bool bFirst)
 {
     theStatusCounter.setActiveNode(theExpandedNode, vp, getNodeLinks());
 }