コード例 #1
0
        private BdtConSpec ApplyCONRestrictions(BdtConSpec conSpec)
        {
            foreach (var facet in Restriction.Facets)
            {
                if (facet is XmlSchemaLengthFacet)
                {
                    // TODO tagged value 'length' is no longer defined as of UPCC 3.0 ODP5
//                    conSpec.Length = ((XmlSchemaFacet) facet).Value;
                }
                else if (facet is XmlSchemaMinLengthFacet)
                {
                    conSpec.MinimumLength = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaMaxLengthFacet)
                {
                    conSpec.MaximumLength = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaPatternFacet)
                {
                    conSpec.Pattern = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaMaxInclusiveFacet)
                {
                    conSpec.MaximumInclusive = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaMaxExclusiveFacet)
                {
                    conSpec.MaximumExclusive = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaMinInclusiveFacet)
                {
                    conSpec.MinimumInclusive = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaMinExclusiveFacet)
                {
                    conSpec.MinimumExclusive = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaFractionDigitsFacet)
                {
                    conSpec.FractionDigits = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaTotalDigitsFacet)
                {
                    conSpec.TotalDigits = ((XmlSchemaFacet)facet).Value;
                }
                else if (facet is XmlSchemaWhiteSpaceFacet)
                {
                    // TODO Whitespace no longer defined by UPCC:
                    //conSpec.WhiteSpace = ((XmlSchemaFacet)facet).Value;
                }
            }

            return(conSpec);
        }
コード例 #2
0
        protected override BdtConSpec SpecifyCON()
        {
            BdtConSpec conSpec;
            BDTXsdType parent = Parent;

            if (parent != null)
            {
                conSpec = BdtConSpec.CloneBdtCon(parent.BDT.Con);
            }
            else
            {
                conSpec = new BdtConSpec
                {
                    Name      = "Content",
                    BasicType = new BasicType(FindPRIM(NDR.ConvertXsdTypeNameToBasicTypeName(ContentComponentXsdTypeName)))
                };
            }
            return(ApplyCONRestrictions(conSpec));
        }
コード例 #3
0
        internal static UmlAttributeSpec Convert(BdtConSpec bdtConSpec, string className)
        {
            IUmlClassifier type;
            var            multiType = bdtConSpec.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   = "CON",
                Name         = bdtConSpec.Name,
                Type         = type,
                UpperBound   = bdtConSpec.UpperBound,
                LowerBound   = bdtConSpec.LowerBound,
                TaggedValues = new[]
                {
                    new UmlTaggedValueSpec("businessTerm", bdtConSpec.BusinessTerms),
                    new UmlTaggedValueSpec("definition", bdtConSpec.Definition),
                    new UmlTaggedValueSpec("dictionaryEntryName", bdtConSpec.DictionaryEntryName)
                    {
                        DefaultValue = GenerateDictionaryEntryNameDefaultValue(bdtConSpec, className)
                    },
                    new UmlTaggedValueSpec("enumeration", bdtConSpec.Enumeration),
                    new UmlTaggedValueSpec("fractionDigits", bdtConSpec.FractionDigits),
                    new UmlTaggedValueSpec("languageCode", bdtConSpec.LanguageCode),
                    new UmlTaggedValueSpec("maximumExclusive", bdtConSpec.MaximumExclusive),
                    new UmlTaggedValueSpec("maximumInclusive", bdtConSpec.MaximumInclusive),
                    new UmlTaggedValueSpec("maximumLength", bdtConSpec.MaximumLength),
                    new UmlTaggedValueSpec("minimumExclusive", bdtConSpec.MinimumExclusive),
                    new UmlTaggedValueSpec("minimumInclusive", bdtConSpec.MinimumInclusive),
                    new UmlTaggedValueSpec("minimumLength", bdtConSpec.MinimumLength),
                    new UmlTaggedValueSpec("modificationAllowedIndicator", bdtConSpec.ModificationAllowedIndicator),
                    new UmlTaggedValueSpec("pattern", bdtConSpec.Pattern),
                    new UmlTaggedValueSpec("totalDigits", bdtConSpec.TotalDigits),
                    new UmlTaggedValueSpec("uniqueIdentifier", bdtConSpec.UniqueIdentifier)
                    {
                        DefaultValue = GenerateUniqueIdentifierDefaultValue(bdtConSpec, className)
                    },
                    new UmlTaggedValueSpec("usageRule", bdtConSpec.UsageRules),
                    new UmlTaggedValueSpec("versionIdentifier", bdtConSpec.VersionIdentifier),
                },
            };

            return(umlAttributeSpec);
        }
 private static string GenerateDictionaryEntryNameDefaultValue(BdtConSpec bdtConSpec, string className)
 {
     return(className + ". Content");
 }
 private static string GenerateUniqueIdentifierDefaultValue(BdtConSpec bdtConSpec, string className)
 {
     return(Guid.NewGuid().ToString());
 }
コード例 #6
0
        protected override BdtConSpec SpecifyCON()
        {
            IBdt parentBDT = GetBDTByXsdTypeName(Restriction.BaseTypeName.Name);

            return(ApplyCONRestrictions(BdtConSpec.CloneBdtCon(parentBDT.Con)));
        }