示例#1
0
        public void Initialize(UmlClassifierSpec spec)
        {
            eaElement.Stereotype = spec.Stereotype;
            eaElement.Update();

            if (spec.TaggedValues != null)
            {
                foreach (UmlTaggedValueSpec taggedValueSpec in spec.TaggedValues)
                {
                    CreateTaggedValue(taggedValueSpec);
                }
                eaElement.TaggedValues.Refresh();
            }

            if (spec.Attributes != null)
            {
                foreach (UmlAttributeSpec attributeSpec in spec.Attributes)
                {
                    CreateAttribute(attributeSpec);
                }
            }
            if (spec is UmlEnumerationSpec)
            {
                var enumSpec = (UmlEnumerationSpec)spec;
                if (enumSpec.EnumerationLiterals != null)
                {
                    foreach (UmlEnumerationLiteralSpec enumerationLiteralSpec in enumSpec.EnumerationLiterals)
                    {
                        CreateEnumerationLiteral(enumerationLiteralSpec);
                    }
                }
            }
            eaElement.Attributes.Refresh();

            if (spec.Associations != null)
            {
                foreach (UmlAssociationSpec associationSpec in spec.Associations)
                {
                    CreateAssociation(associationSpec);
                }
            }
            if (spec.Dependencies != null)
            {
                foreach (UmlDependencySpec dependencySpec in spec.Dependencies)
                {
                    CreateDependency(dependencySpec);
                }
            }
            eaElement.Connectors.Refresh();
        }
示例#2
0
        private EaUmlClassifier CreateEaUmlClassifier(UmlClassifierSpec spec)
        {
            var eaElement = (Element)eaPackage.Elements.AddNew(spec.Name, "Class");

            eaElement.PackageID = Id;
            var eaUmlClassifier = new EaUmlClassifier(eaRepository, eaElement);

            eaUmlClassifier.Initialize(spec);
            AddToClassDiagram(eaElement);

            eaPackage.Update();
            eaPackage.Elements.Refresh();

            return(eaUmlClassifier);
        }
示例#3
0
        public void Update(UmlClassifierSpec spec)
        {
            eaElement.Name       = spec.Name;
            eaElement.Stereotype = spec.Stereotype;
            eaElement.Update();

            foreach (UmlTaggedValueSpec taggedValueSpec in spec.TaggedValues)
            {
                IUmlTaggedValue taggedValue = GetTaggedValue(taggedValueSpec.Name);
                if (taggedValue.IsDefined)
                {
                    taggedValue.Update(taggedValueSpec);
                }
                else
                {
                    CreateTaggedValue(taggedValueSpec);
                }
            }
            eaElement.TaggedValues.Refresh();

            for (var i = (short)(eaElement.Attributes.Count - 1); i >= 0; i--)
            {
                eaElement.Attributes.Delete(i);
            }
            eaElement.Attributes.Refresh();
            if (spec.Attributes != null)
            {
                foreach (UmlAttributeSpec attributeSpec in spec.Attributes)
                {
                    CreateAttribute(attributeSpec);
                }
            }
            if (spec is UmlEnumerationSpec)
            {
                var enumSpec = (UmlEnumerationSpec)spec;
                if (enumSpec.EnumerationLiterals != null)
                {
                    foreach (UmlEnumerationLiteralSpec enumerationLiteralSpec in enumSpec.EnumerationLiterals)
                    {
                        CreateEnumerationLiteral(enumerationLiteralSpec);
                    }
                }
            }
            eaElement.Attributes.Refresh();

            for (var i = (short)(eaElement.Connectors.Count - 1); i >= 0; i--)
            {
                if (DeleteConnectorOnUpdate((Connector)eaElement.Connectors.GetAt(i)))
                {
                    eaElement.Connectors.Delete(i);
                }
            }
            if (spec.Associations != null)
            {
                foreach (UmlAssociationSpec associationSpec in spec.Associations)
                {
                    CreateAssociation(associationSpec);
                }
            }
            if (spec.Dependencies != null)
            {
                foreach (UmlDependencySpec dependencySpec in spec.Dependencies)
                {
                    CreateDependency(dependencySpec);
                }
            }
            eaElement.Connectors.Refresh();
        }
示例#4
0
 private static void UpdateEaUmlClassifier(EaUmlClassifier classifier, UmlClassifierSpec spec)
 {
     classifier.Update(spec);
 }