/// /// <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); }
/// /// <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); }