/// <summary> /// Write the given IItemMutableObject type object to the given element. /// </summary> /// <param name="element"> /// The xml element /// </param> /// <param name="item"> /// The IItemMutableObject type object to write /// </param> protected void WriteItem(ElementNameTable element, IItemMutableObject item) { // ReSharper restore SuggestBaseTypeForParameter this.WriteStartElement(this.DefaultPrefix, element); this.WriteIdentifiableArtefactAttributes(item); //// TODO NOTE not supported by common api ////TryWriteAttribute(AttributeNameTable.version, item.Version); ////TryWriteAttribute(AttributeNameTable.validFrom, item.ValidFrom); ////TryWriteAttribute(AttributeNameTable.validTo, item.ValidTo); this.WriteIdentifiableArtefactContent(item); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE BEAN ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// public ItemCore(IItemMutableObject bean, IIdentifiableObject parent) : base(bean, parent) { }
/// <summary> /// Write the Category element from the given ICategoryMutableObject and call <see cref="WriteDataflowRef"/> to write the /// dataflowRef. /// </summary> /// <param name="item"> /// The ICategoryMutableObject object to write /// </param> /// <param name="categorisationMap"> /// The categorisation map /// </param> private void WriteCategory( IItemMutableObject item, IDictionary<string, IList<ICategorisationMutableObject>> categorisationMap) { // handle categories without name if (item.Names.Count == 0) { item.Names.Add(new TextTypeWrapperMutableCore { Value = item.Id, Locale = "en" }); } this.WriteItem(ElementNameTable.Category, item); IList<ICategorisationMutableObject> dataflowList; if (categorisationMap.TryGetValue(item.Id, out dataflowList)) { foreach (ICategorisationMutableObject dataflow in dataflowList) { this.WriteDataflowRef(dataflow.StructureReference); } } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ItemCore"/> class. /// </summary> /// <param name="itemMutableObject"> /// The itemMutableObject. /// </param> /// <param name="parent"> /// The parent. /// </param> public ItemCore(IItemMutableObject itemMutableObject, IIdentifiableObject parent) : base(itemMutableObject, parent) { }