Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: EA_enthusiast on January 14, 2021, 05:53:00 am
-
Hello, EA experts,
I have a PostegresSQL database schema of about 30 tables that I will import as a database model in EA (I have not done this before but I will try to figure it out). I would like to reverse engineer this to derive a UML Class Model which could then be edited and then forward-engineered back to the database.
My question is: will EA create objects/instances of the records in the tables? If that won't happen by default, how can I make EA create these objects/instsnaces?
The number of instances in each table is relatively small and can fit nicely in an object diagram.
Below is a screenshot from PgAdmin
https://ibb.co/y0pwKvs
As always, thank you very much for your valuable input!
Thank you,
Mo
-
No, there's no out of the box process to convert records into objects.
You could write something for it, but I'm not sure of the added value.
Geert
-
You could export the contents of the DB and import via CSV (if you don't like to script it).
q.
-
Thank you very much, Geert and q.
You could write something for it, but I'm not sure of the added value.
I understand your concern, Geert. I want to do this only for selected tables with few objects.
To your point q.
You could export the contents of the DB and import via CSV (if you don't like to script it).
If I did that, will EA model the records as objects in object diagrams?
Or should I reverse engineer the DB (to build the class diagram in EA), then export the records of the selected tables from the DB (as CSV) and import them to selected classes in EA as objects (I am not sure if this is even possible)?
-
I don't use the EA import since I script anything by myself. I guess you could configure Geert's CSV importer so it creates objects rather than classes. He will comment for sure.
q.
-
It would be great to be able to import attribute values of objects using Geert's Excel tool!
Like this object https://ibb.co/nbnvkFJ
Looking forward to Geert's response.
-
You can import attributes on classes, but not runstate values for objects.
I did write a script in the past that did something like that:
Here's the relevant part:
function processRoleProperties(roleElement, roleNode)
dim runstateString
'get propertyNodes
dim propertyNodes
set propertyNodes = roleNode.SelectNodes("./properties/property")
'loop propertyNodes
dim propertyNode
for each propertyNode in propertyNodes
'get name
dim nameNode
set nameNode = propertyNode.SelectSingleNode("./name")
'start of the runstatestring
runstateString = runstateString & "@VAR;Variable=" & nameNode.Text
'get the values
dim valueString
valueString = ""
dim valueNodes
set valueNodes = propertyNode.SelectNodes("./value")
dim valueNode
for each valueNode in valueNodes
if len(valueString) > 0 then
valueString = valueString & ","
end if
valueString = valueString & valueNode.Text
next
'add the valueString to the runstatestring
runstateString = runstateString & ";Value=" & valueString & ";Op==;@ENDVAR;"
next
'set runstate on element
if len(runstateString) > 0 then
roleElement.RunState = runstateString
roleElement.Update
end if
end function
Geert
-
Thank you, Geert for your response.
So if I cannot import runstate values for objects.
What is the use of this script? (I am sorry I don't have experience with scripts)
Mo
-
This is part of a larger scripts that reads an XML file and creates a bunch of stuff.
Among that bunch of stuff some objects with runstate values.
Geert
-
Is it possible to edit your Excel tool (with this script) to export/import runstate values?
-
Is it possible to edit your Excel tool (with this script) to export/import runstate values?
Yes, it's basically a bunch of VBA code.
The syntax resembles vbscript closely, so it should be relatively easy to translate from vbscript to VBA.
Geert
-
Thank you, Geert.
So when I look for someone to help me do this, I should look for "someone who can translate a vbscript to VBA", correct?
Does that person need to have any experience in EA?
Thank you so much,
Mo
-
Does that person need to have any experience in EA?
That's probably more important than knowing the VBA/Vbscript syntax.
Geert
-
Thank you, Geert for your response.
I hope a member of the forum would respond that he can do this kind of work. Other than that, I will be looking for a needle in a haystack :o
-
I could send you a quote if you want to.
But I would need a bit more detailed requirements before being able to estimate work correctly.
If you we are talking about import only I guess that would be about a day of work. I'm not sure what you had in mind in terms of budget?
Exporting is another matter as the runstate is not stored in a normalized way. That makes querying a lot harder.
Geert
-
Thank you, Geert. I will send you an email to discuss.