Example #1
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);
        }
Example #2
0
        ///
        ///	 <summary> * add an audit, called internally by the specialized functions
        ///	 *  </summary>
        ///	 * <param name="typ"> audit type </param>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <returns> JDFAudit
        ///	 *
        ///	 *         default: AddAudit(typ, JDFConstants.EMPTYSTRING) </returns>
        ///
        public virtual JDFAudit addAudit(JDFAudit.EnumAuditType typ, string by)
        {
            JDFAudit l = (JDFAudit)appendElement(typ.getName(), null);

            if (by != null)
            {
                l.setAuthor(by);
            }

            JDFNode r = getJDFRoot();

            if (r.hasAttribute(AttributeName.SPAWNID))
            {
                l.setSpawnID(r.getSpawnID(false));
            }

            return(l);
        }