示例#1
0
            ///
            ///		 <summary> * sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the
            ///		 * AmountPool and/or PartAmount if it is 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="mPart"> 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 071103 </exception>
            ///
            public static void setAmountPoolAttribute(IAmountPoolContainer poolParent, string attrib, string @value, string nameSpaceURI, JDFAttributeMap mPart)
            {
                // ideally the method would be hidden in PartAmount
                if ((mPart == null) || (mPart.IsEmpty()))
                {
                    poolParent.setAttribute(attrib, @value, nameSpaceURI);
                    return;
                }
                if (poolParent is JDFPartAmount)
                {
                    throw new JDFException("JDFResourceLink.setAmountPoolAttribute: calling method on PartAmount object");
                }
                VJDFAttributeMap v = new VJDFAttributeMap();

                v.Add(mPart);
                setAmountPoolAttribute(poolParent, attrib, @value, nameSpaceURI, v);
            }
示例#2
0
 ///
 ///	 <summary> * Set the status of a part defined in StatusPool
 ///	 * <p>
 ///	 * default setStatus(mPart, s, JDFConstants.EMPTYSTRING)
 ///	 *  </summary>
 ///	 * <param name="mPart"> </param>
 ///	 * <param name="s"> </param>
 ///	 * <param name="statusDetails"> </param>
 ///
 public virtual void setStatus(JDFAttributeMap mPart, JDFElement.EnumNodeStatus s, string statusDetails)
 {
     if ((mPart != null) && !mPart.IsEmpty())
     {
         JDFPartStatus ps = getCreatePartStatus(mPart);
         ps.setStatus(s);
         if (statusDetails != null && !statusDetails.Equals(JDFConstants.EMPTYSTRING))
         {
             ps.setStatusDetails(statusDetails);
         }
     }
     else
     {
         setStatus(s);
         if (statusDetails != null && !statusDetails.Equals(JDFConstants.EMPTYSTRING))
         {
             setStatusDetails(statusDetails);
         }
     }
 }
示例#3
0
        ///
        ///	 <summary> * Returns a map of attributes with defaults for the specified JDF version.
        ///	 *  </summary>
        ///	 * <returns> JDFAttributeMap: map of strings containing the names and defaults of the matching attributes, null if no
        ///	 *         defaults exist </returns>
        ///
        public virtual JDFAttributeMap getDefaultAttributeMap()
        {
            JDFAttributeMap matchingAttribs = new JDFAttributeMap();

            IEnumerator iter = attribInfoTable.Keys.GetEnumerator();

            while (iter.MoveNext())
            {
                string  theKey = (string)iter.Current;
                AtrInfo ai     = (AtrInfo)attribInfoTable[theKey];
                long    l2     = JDFVersions.getTheMask(version);
                long    v2     = JDFVersions.getTheOffset(version);
                EnumAttributeValidity versionVal = EnumAttributeValidity.getEnum((int)((ai.getAtrValidityStatus() & l2) >> (int)v2));
                if (versionVal.Equals(EnumAttributeValidity.Optional) || versionVal.Equals(EnumAttributeValidity.Required))
                {
                    string def = ai.getAtrDefault();
                    if (def != null)
                    {
                        matchingAttribs.put(theKey, def);
                    }
                }
            }
            return(matchingAttribs.IsEmpty() ? null : matchingAttribs);
        }