I had imported an xsd that contained an enumeration with lots of values 4000.
The name of the value was a numeric code, and the description of that code was imported into the notes.
I wanted to put the descrption into the alias so I could see the meaning of the values on a diagram by showing the alias, so I wrote a little script to do so (see below)
I ran this script on a few other imported XSD's and it was finished whithin a minute or so, but when it came to the xsd with the enumeration mentioned, it took ages.
I let it run, and it finally finished after 13 hours!
That is an average of over 11 seconds for each attribute. This is not workable anymore. Something should be done to improve the performance of the API in these circumstances.
const outputName = "CopyNotesToAlias"
sub main
'create output tab
Repository.CreateOutputTab outPutName
Repository.ClearOutput outPutName
Repository.EnsureOutputVisible outPutName
'get selected package
dim package as EA.Package
set package = Repository.GetTreeSelectedPackage
'inform user
Repository.WriteOutput outPutName, now() & " Starting CopyNotesToAlias for package '" & package.Name & "'", 0
'do the actual work
copyNotesToAlias package
'inform user
Repository.WriteOutput outPutName, now() & " Finished CopyNotesToAlias for package '" & package.Name & "'", 0
end sub
function copyNotesToAlias(parent)
dim element as EA.Element
for each element in parent.Elements
'inform user
Repository.WriteOutput outPutName, now() & " Processing element '" & element.Name & "'", 0
'move notes to alias
if len(element.Notes) > 0 then
element.Alias = Repository.GetFormatFromField("TXT", element.Notes)
element.Update
end if
'process attributes
dim attribute as EA.Attribute
for each attribute in element.Attributes
'move notes to alias
if len(attribute.Notes) > 0 then
attribute.Alias = Repository.GetFormatFromField("TXT", attribute.Notes)
attribute.Update
end if
next
'process subElements
copyNotesToAlias element
next
end function
main
Reported
Geert