Example #1
0
        private XmlSchemaAttribute FindSUPAttribute(BdtSupSpec supSpec)
        {
            string attributeName = GetXsdAttributeNameFromSUPSpec(supSpec);

            foreach (XmlSchemaAttribute attribute in xsdAttributes)
            {
                if (attribute.Name == attributeName)
                {
                    return(attribute);
                }
            }
            return(null);
        }
Example #2
0
        protected override IEnumerable <BdtSupSpec> SpecifySUPs()
        {
            string baseTypeName  = Restriction.BaseTypeName.Name;
            var    supAttributes = new SUPXsdAttributes(Restriction.Attributes);
            IBdt   parentBDT     = GetBDTByXsdTypeName(baseTypeName);

            foreach (IBdtSup parentSUP in parentBDT.Sups)
            {
                var supSpec = BdtSupSpec.CloneBdtSup(parentSUP);
                if (!supAttributes.IsProhibited(supSpec))
                {
                    supAttributes.ApplyRestrictions(supSpec);
                    yield return(supSpec);
                }
            }
        }
        private void GenerateBdtSpecsFromComplexTypeMapping(ComplexTypeMapping complexTypeMapping)
        {
            if (complexTypeMapping is ComplexTypeToCdtMapping)
            {
                ComplexTypeToCdtMapping cdtMapping = (ComplexTypeToCdtMapping)complexTypeMapping;

                List <BdtSupSpec> supSpecs = new List <BdtSupSpec>();

                foreach (AttributeOrSimpleElementToSupMapping supMapping in cdtMapping.GetSupMappings())
                {
                    BdtSupSpec bdtSupSpec = BdtSpec.CloneCdtSup(supMapping.Sup);
                    bdtSupSpec.Name = supMapping.BIEName;
                    supSpecs.Add(bdtSupSpec);
                }

                BdtSpec bdtSpec = BdtSpec.CloneCdt(complexTypeMapping.TargetCdt, complexTypeMapping.BIEName);

                bdtSpec.Sups = supSpecs;

                bdtSpecs.Add(bdtSpec);
            }
        }
 private static string GenerateDictionaryEntryNameDefaultValue(BdtSupSpec bdtSupSpec, string className)
 {
     return(className + ". " + bdtSupSpec.Name + ". " + bdtSupSpec.BasicType.Name);
 }
 private static string GenerateUniqueIdentifierDefaultValue(BdtSupSpec bdtSupSpec, string className)
 {
     return(Guid.NewGuid().ToString());
 }
 /// <summary>
 /// Updates a(n) SUP to match the given <paramref name="specification"/>.
 /// <param name="bdtSup">A(n) SUP.</param>
 /// <param name="specification">A new specification for the given SUP.</param>
 /// <returns>The updated SUP. Depending on the implementation, this might be the same updated instance or a new instance!</returns>
 /// </summary>
 public IBdtSup UpdateBdtSup(IBdtSup bdtSup, BdtSupSpec specification)
 {
     return(new UpccBdtSup(UmlClass.UpdateAttribute(((UpccBdtSup)bdtSup).UmlAttribute, BdtSupSpecConverter.Convert(specification, Name)), this));
 }
 /// <summary>
 /// Creates a(n) SUP based on the given <paramref name="specification"/>.
 /// <param name="specification">A specification for a(n) SUP.</param>
 /// <returns>The newly created SUP.</returns>
 /// </summary>
 public IBdtSup CreateBdtSup(BdtSupSpec specification)
 {
     return(new UpccBdtSup(UmlClass.CreateAttribute(BdtSupSpecConverter.Convert(specification, Name)), this));
 }
Example #8
0
 public void ApplyRestrictions(BdtSupSpec supSpec)
 {
 }
Example #9
0
        public bool IsProhibited(BdtSupSpec supSpec)
        {
            XmlSchemaAttribute supAttribute = FindSUPAttribute(supSpec);

            return(supAttribute != null && supAttribute.Use == XmlSchemaUse.Prohibited);
        }
Example #10
0
 private static string GetXsdAttributeNameFromSUPSpec(BdtSupSpec supSpec)
 {
     return(supSpec.Name + supSpec.BasicType.Name);
 }
        internal static UmlAttributeSpec Convert(BdtSupSpec bdtSupSpec, string className)
        {
            IUmlClassifier type;
            var            multiType = bdtSupSpec.BasicType;

            if (multiType.IsPrim)
            {
                type = ((UpccPrim)multiType.Prim).UmlDataType;
            }
            else
            if (multiType.IsIdScheme)
            {
                type = ((UpccIdScheme)multiType.IdScheme).UmlDataType;
            }
            else
            if (multiType.IsEnum)
            {
                type = ((UpccEnum)multiType.Enum).UmlEnumeration;
            }
            else
            {
                type = null;
            }
            var umlAttributeSpec = new UmlAttributeSpec
            {
                Stereotype   = "SUP",
                Name         = bdtSupSpec.Name,
                Type         = type,
                UpperBound   = bdtSupSpec.UpperBound,
                LowerBound   = bdtSupSpec.LowerBound,
                TaggedValues = new[]
                {
                    new UmlTaggedValueSpec("businessTerm", bdtSupSpec.BusinessTerms),
                    new UmlTaggedValueSpec("definition", bdtSupSpec.Definition),
                    new UmlTaggedValueSpec("dictionaryEntryName", bdtSupSpec.DictionaryEntryName)
                    {
                        DefaultValue = GenerateDictionaryEntryNameDefaultValue(bdtSupSpec, className)
                    },
                    new UmlTaggedValueSpec("enumeration", bdtSupSpec.Enumeration),
                    new UmlTaggedValueSpec("fractionDigits", bdtSupSpec.FractionDigits),
                    new UmlTaggedValueSpec("languageCode", bdtSupSpec.LanguageCode),
                    new UmlTaggedValueSpec("maximumExclusive", bdtSupSpec.MaximumExclusive),
                    new UmlTaggedValueSpec("maximumInclusive", bdtSupSpec.MaximumInclusive),
                    new UmlTaggedValueSpec("maximumLength", bdtSupSpec.MaximumLength),
                    new UmlTaggedValueSpec("minimumExclusive", bdtSupSpec.MinimumExclusive),
                    new UmlTaggedValueSpec("minimumInclusive", bdtSupSpec.MinimumInclusive),
                    new UmlTaggedValueSpec("minimumLength", bdtSupSpec.MinimumLength),
                    new UmlTaggedValueSpec("modificationAllowedIndicator", bdtSupSpec.ModificationAllowedIndicator),
                    new UmlTaggedValueSpec("pattern", bdtSupSpec.Pattern),
                    new UmlTaggedValueSpec("totalDigits", bdtSupSpec.TotalDigits),
                    new UmlTaggedValueSpec("uniqueIdentifier", bdtSupSpec.UniqueIdentifier)
                    {
                        DefaultValue = GenerateUniqueIdentifierDefaultValue(bdtSupSpec, className)
                    },
                    new UmlTaggedValueSpec("usageRule", bdtSupSpec.UsageRules),
                    new UmlTaggedValueSpec("versionIdentifier", bdtSupSpec.VersionIdentifier),
                },
            };

            return(umlAttributeSpec);
        }