private static IAbie ShouldContainAbie(IBieLibrary bieLibrary, string name, string accName, BbieDescriptor[] bbieDescriptors, AsbieDescriptor[] asbieDescriptors) { IAbie abie = bieLibrary.GetAbieByName(name); Assert.IsNotNull(abie, "ABIE '" + name + "' not generated"); if (accName != null) { Assert.That(abie.BasedOn, Is.Not.Null, "BasedOn reference not specified"); Assert.AreEqual(accName, abie.BasedOn.Name, "BasedOn wrong ACC"); } else { Assert.That(abie.BasedOn, Is.Null, "Unexpected BasedOn reference to ACC '" + abie.BasedOn + "'"); } if (bbieDescriptors == null || bbieDescriptors.Length == 0) { Assert.That(BbieDescriptors(abie), Is.Empty); } else { Assert.That(BbieDescriptors(abie), Is.EquivalentTo(bbieDescriptors)); } if (asbieDescriptors == null || asbieDescriptors.Length == 0) { Assert.That(AsbieDescriptors(abie), Is.Empty); } else { Assert.That(AsbieDescriptors(abie), Is.EquivalentTo(asbieDescriptors)); } return(abie); }
private void GenerateRootABIE() { var rootElementMapping = schemaMapping.RootElementMapping; if (rootElementMapping is AsmaMapping) { AsmaMapping asmaMapping = (AsmaMapping)rootElementMapping; var ma = docLibrary.CreateMa(new MaSpec { Name = qualifier + "_" + rootElementName, }); AsmaSpec asmaSpec = new AsmaSpec { Name = asmaMapping.SourceElementName, }; if (asmaMapping.TargetMapping is ComplexTypeToAccMapping) { asmaSpec.AssociatedBieAggregator = new BieAggregator(bieLibrary.GetAbieByName(asmaMapping.TargetMapping.BIEName)); } else { asmaSpec.AssociatedBieAggregator = new BieAggregator(docLibrary.GetMaByName(asmaMapping.TargetMapping.BIEName)); } ma.CreateAsma(asmaSpec); } else if (rootElementMapping is AttributeOrSimpleElementOrComplexElementToBccMapping) { var bccMapping = (AttributeOrSimpleElementOrComplexElementToBccMapping)rootElementMapping; var abie = bieLibrary.CreateAbie(new AbieSpec { BasedOn = bccMapping.Acc, Name = qualifier + "_" + bccMapping.Acc.Name, Bbies = new List <BbieSpec>(GenerateBbieSpecs(new List <AttributeOrSimpleElementOrComplexElementToBccMapping> { bccMapping })), }); var ma = docLibrary.CreateMa(new MaSpec { Name = qualifier + "_" + rootElementName, }); ma.CreateAsma(new AsmaSpec { Name = abie.Name, AssociatedBieAggregator = new BieAggregator(abie), }); } else { throw new MappingError("Root element can only be mapped to BCC, but is mapped to something else."); } }
internal AsmaSpec GenerateSpec() { ICctsElement element; if (bieLibrary != null) { element = bieLibrary.GetAbieByName(associatedBieName); } else { element = docLibrary.GetMaByName(associatedBieName); } AsmaSpec asmaSpec = new AsmaSpec { Name = name, AssociatedBieAggregator = new BieAggregator(element), }; return(asmaSpec); }
internal AsbieSpec GenerateSpec() { return(AsbieSpec.CloneAscc(ascc, asbieName, bieLibrary.GetAbieByName(associatedAbieName))); }
///<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 }
internal AsmaSpec GenerateSpec() { AsmaSpec asmaSpec = new AsmaSpec { Name = name, AssociatedBieAggregator = new BieAggregator(bieLibrary != null ? (object)bieLibrary.GetAbieByName(associatedBieName) : docLibrary.GetMaByName(associatedBieName)), }; return(asmaSpec); }