private void CreateAbies() { var abies = new List <IAbie>(); foreach (var abieSpec in abieSpecs) { abies.Add(bieLibrary.CreateAbie(abieSpec)); } foreach (var abie in abies) { foreach (var asbieSpec in GenerateAsbieSpecsForAbie(abie)) { abie.CreateAsbie(asbieSpec); } } }
///<summary> /// The static method imports an XML schema containing Business Information /// Entities into an existing BIE library. The method has one input parameter /// of type ImporterContext specifying different settings utilized while /// importing the XML schema. ///</summary> ///<param name="context"> /// The parameter provides the necessary context information required by the /// BIE XML schema importer. An example would be the directory location where /// all XML schemas to be imported are located, and the repository which contains /// the BIE library that all ABIEs should be imported into. Fore more information /// plese refer to the documentation of the ImporterContext class. /// </param> public static void ImportXSD(ImporterContext context) { #region Import Preparation // TODO: ACC, BDT and BIE library should be configurable through the ImporterContext InitLibraries(context); // Even though the XML schema is stored in the importer context we need to re-read // the XML schema. The reason for doing so is that the impoter context pre-read the // XML schema using the XML schema reader class from the .net API. However, the XML // schema reader dropped information that is required to import the ABIE schema. // Instead we want to utilitze the CustomSchemaReader class that requires an XML // schema document as an input. Therefore we need to re-read the XML schema file based // on the file name and directory location as specified in the importer context. XmlDocument bieSchemaDocument = GetBieSchemaDocument(context); CustomSchemaReader reader = new CustomSchemaReader(bieSchemaDocument); #endregion IDictionary <string, string> allElementDefinitions = new Dictionary <string, string>(); #region Processing Step 1: Cumulate all ABIEs and create them in the BIE library foreach (object item in reader.Items) { if (item is ComplexType) { ComplexType abieComplexType = (ComplexType)item; AbieSpec singleAbieSpec = CumulateAbieSpecFromComplexType(abieComplexType); BieLibrary.CreateAbie(singleAbieSpec); } if (item is Element) { Element element = (Element)item; allElementDefinitions.Add(element.Name, element.Type.Name); } } #endregion #region Processing Step 2: Update all ABIEs with their ASBIEs foreach (object item in reader.Items) { if (item is ComplexType) { ComplexType abieComplexType = (ComplexType)item; string abieName = abieComplexType.Name.Substring(0, abieComplexType.Name.Length - 4); IAbie abieToBeUpdated = BieLibrary.GetAbieByName(abieName); AbieSpec updatedAbieSpec = AbieSpec.CloneAbie(abieToBeUpdated); updatedAbieSpec.Asbies = new List <AsbieSpec>(CumulateAbiesSpecsFromComplexType(abieComplexType, allElementDefinitions)); BieLibrary.UpdateAbie(abieToBeUpdated, updatedAbieSpec); } } #endregion }