public static BbieSpec CloneBbie(IBbie bbie) { return(new BbieSpec { Name = bbie.Name, UpperBound = bbie.UpperBound, LowerBound = bbie.LowerBound, Bdt = bbie.Bdt, BasedOn = bbie.BasedOn, BusinessTerms = new List <string>(bbie.BusinessTerms), Definition = bbie.Definition, LanguageCode = bbie.LanguageCode, SequencingKey = bbie.SequencingKey, VersionIdentifier = bbie.VersionIdentifier, UsageRules = new List <string>(bbie.UsageRules), }); }
///<summary> ///</summary> ///<param name="bbie"></param> ///<returns></returns> public static XmlSchemaAnnotation GetBBIEAnnotation(IBbie bbie) { // Contains all the documentation items such as DictionaryEntryName IList <XmlNode> documentation = new List <XmlNode>(); AddDocumentation(documentation, "UniqueID", bbie.UniqueIdentifier); AddDocumentation(documentation, "VersionID", bbie.VersionIdentifier); AddDocumentation(documentation, "Cardinality", bbie.LowerBound + ".." + bbie.UpperBound); AddDocumentation(documentation, "SequencingKey", bbie.SequencingKey); AddDocumentation(documentation, "DictionaryEntryName", bbie.DictionaryEntryName); AddDocumentation(documentation, "Definition", bbie.Definition); AddDocumentation(documentation, "BusinessTermName", bbie.BusinessTerms); AddDocumentation(documentation, "PropertyTermName", bbie.Name); AddDocumentation(documentation, "RepresentationTermName", bbie.Bdt.Name); AddDocumentation(documentation, "AcronymCode", "BBIE"); XmlSchemaAnnotation annotation = new XmlSchemaAnnotation(); annotation.Items.Add(new XmlSchemaDocumentation { Language = "en", Markup = documentation.ToArray() }); return(annotation); }
/// <summary> /// Removes a(n) BBIE from this ABIE. /// <param name="bbie">A(n) BBIE.</param> /// </summary> public void RemoveBbie(IBbie bbie) { UmlClass.RemoveAttribute(((UpccBbie)bbie).UmlAttribute); }
/// <summary> /// Updates a(n) BBIE to match the given <paramref name="specification"/>. /// <param name="bbie">A(n) BBIE.</param> /// <param name="specification">A new specification for the given BBIE.</param> /// <returns>The updated BBIE. Depending on the implementation, this might be the same updated instance or a new instance!</returns> /// </summary> public IBbie UpdateBbie(IBbie bbie, BbieSpec specification) { return(new UpccBbie(UmlClass.UpdateAttribute(((UpccBbie)bbie).UmlAttribute, BbieSpecConverter.Convert(specification, Name)), this)); }
public static string GetXsdElementNameFromBbie(IBbie bbie) { return(bbie != null && bbie.Bdt != null? GenerateBCCOrBBIEName(bbie.Name, bbie.Bdt.Name, bbie.DictionaryEntryName) : "Error_BDT_Missing"); }
static XmlSchemaElement CreateBbieSchemaElement(IBbie bbie, GeneratorContext context) { // R 89A6: for every BBIE a named element must be locally declared XmlSchemaElement elementBBIE = new XmlSchemaElement(); // R AEFE, R 96D9, R9A40, R A34A are implemented in GetXsdElementNameFromBbie(...) elementBBIE.Name = NDR.GetXsdElementNameFromBbie(bbie); // R 8B85: every BBIE type must be named the property term and qualifiers and the // representation term of the basic business information entity (BBIE) it represents // with the word 'Type' appended. if (bbie.Bdt != null && bbie.Bdt.Con != null) { if (bbie.Bdt.Con.BasicType != null && bbie.Bdt.Con.BasicType.IsEnum) { //figure out if the set of values is restricted var basicEnum = bbie.Bdt.Con.BasicType.Enum as UpccEnum; //use this method only if there are values specified in the basic enum. If not then we simply use the type if (basicEnum != null && basicEnum.CodelistEntries.Any()) { var sourceEnum = basicEnum.SourceElement as UpccEnum; if (sourceEnum != null) { var restrictedtype = new XmlSchemaComplexType(); var sympleContent = new XmlSchemaSimpleContent(); var restriction = new XmlSchemaSimpleContentRestriction(); restriction.BaseTypeName = new XmlQualifiedName(context.NamespacePrefix + ":" + NDR.GetXsdTypeNameFromBdt(bbie.Bdt)); addEnumerationValues(restriction, basicEnum); //add restriction to simplecontent sympleContent.Content = restriction; //add the restriction to the simple type restrictedtype.ContentModel = sympleContent; //set the type of the BBIE elementBBIE.SchemaType = restrictedtype; } } } if (bbie.Bdt.isDirectXSDType) { var XSDtype = bbie.Bdt.xsdType; if (!string.IsNullOrEmpty(XSDtype)) { if (bbie.Bdt.Con.AllFacets.Any()) { //add facets var restrictedtype = new XmlSchemaSimpleType(); var restriction = new XmlSchemaSimpleTypeRestriction(); restriction.BaseTypeName = new XmlQualifiedName(NSPREFIX_XSD + ":" + XSDtype); NDR.addFacets(restriction, bbie.Bdt.Con.AllFacets); //add the restriction to the simple type restrictedtype.Content = restriction; //set the type of the BBIE elementBBIE.SchemaType = restrictedtype; } else { elementBBIE.SchemaTypeName = new XmlQualifiedName(NSPREFIX_XSD + ":" + XSDtype); } } } if (bbie.Facets.Any()) { //add facets if (bbie.Bdt.Sups.Any()) { //create a complex type var complexType = new XmlSchemaComplexType(); //add the simple content extension var simpleContent = new XmlSchemaSimpleContent(); var restriction = new XmlSchemaSimpleContentRestriction(); restriction.BaseTypeName = new XmlQualifiedName(context.NamespacePrefix + ":" + NDR.GetXsdTypeNameFromBdt(bbie.Bdt)); //add the facets NDR.addFacets(restriction, bbie.Facets); //add the simple content to the complex object simpleContent.Content = restriction; complexType.ContentModel = simpleContent; //add the complex type to the element elementBBIE.SchemaType = complexType; } else { //create a simple type var restrictedtype = new XmlSchemaSimpleType(); var restriction = new XmlSchemaSimpleTypeRestriction(); restriction.BaseTypeName = new XmlQualifiedName(context.NamespacePrefix + ":" + NDR.GetXsdTypeNameFromBdt(bbie.Bdt)); NDR.addFacets(restriction, bbie.Facets); //add the restriction to the simple type restrictedtype.Content = restriction; //set the type of the BBIE elementBBIE.SchemaType = restrictedtype; } } if (elementBBIE.SchemaType == null && elementBBIE.SchemaTypeName.IsEmpty) { //use type without facets elementBBIE.SchemaTypeName = new XmlQualifiedName(context.NamespacePrefix + ":" + NDR.GetXsdTypeNameFromBdt(bbie.Bdt)); } } // R 90F9: cardinality of elements within the ABIE elementBBIE.MinOccursString = AdjustLowerBound(bbie.LowerBound); elementBBIE.MaxOccursString = AdjustUpperBound(bbie.UpperBound); return(elementBBIE); }
public static string GetXsdElementNameFromBbie(IBbie bbie) { return(GenerateBCCOrBBIEName(bbie.Name, bbie.Bdt.Name, bbie.DictionaryEntryName)); }