Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ngong

Pages: [1] 2 3 ... 16
1
General Board / Integrate helper functions to EA
« on: April 02, 2022, 04:55:22 pm »
Currently, I have some Python scripts which access remote REST services deployed on a server hosting a MySQL EA repository. On the server the REST service accesses the EA repository as well as other project information in order to gather some analysis result. The result is stored locally on the client site in a text file.

The Python scripts offer some simple item list selection or file selection dialog to specify one or two parameters for the REST service.

Now, I got the request to start these scripts from within EA - or rewrite them as an EA extension. The analysis result shall be presented in a window which shall pop up from the start of a script.

As there are several options to go - and I am not experienced in any of them - I need some help with the decision how to achive this.


2
General Board / Re: How to change XSD generation to flat style?
« on: March 20, 2022, 02:16:52 am »
The solution was simple:

I forgot to move the classes (ComplexTypes) from under the outer class to the top level. This means that the XSD generation is sensitive not only to the associations between the classes but also to the hierarchy in the project browser.

Once you know, its simple.

3
General Board / Re: How to change XSD generation to flat style?
« on: March 17, 2022, 10:38:32 pm »
updated

4
General Board / How to change XSD generation to flat style?
« on: March 17, 2022, 09:07:09 pm »
Some time ago I created a XSDschema package to generate an XML schema. The XML schema is taken as an input to XMLBeans for Java code generation.
XMLBeans works best for me, if I define just one top element and associate other complex types to it.
The result shall be totally flat, no nested element definitions inside complex types. Elements in a Sequence should just refer to types on the outer level.
This worked some time ago.
Now I had to introduce an extention (named runnable). The Schema Composer/Export XSD generates all complex types in a flat manner for all older classes. But all newly introduced classes are generated in an unwanted nested style (with some errors as well, non-associated complex types added as elements in the Sequence).
I was not able to find the difference between the new and the old complex types.
I have zipped the eapx and the generaed result here. (updated to include the eapx and the expected XML schema generation result, that I did manually.)

I would really appriciate if someone would get me back on track, so that a completely flat XML schema will be generated.

5
General Board / Re: automatic XMI export
« on: November 06, 2021, 04:13:31 pm »
"very much no": Eve, I am a bit lost with the license issue: if Jenkins runs every night and exports an xmi, who is the "user" that needs a license (I may replace "Jenkins" by "the operator responsible for Jenkins maintenance").

6
General Board / Re: automatic XMI export
« on: October 14, 2021, 01:35:08 am »
Thank you, Eve, for pointing me to the license issue. It would mean - and I see no problem about it - (let me repeat in my words:) that for Jenkins as a user we buy a personal license.

For my technical question: It would be better to use Repository.GetProjectInterface() from an EA-external program which is Connect to the Interface, rather than trying to start EA in a way executing an internal script.

7
General Board / Re: automatic XMI export
« on: October 13, 2021, 04:33:31 am »
Thank you, Geert - that works:
Code: [Select]
!INC Local Scripts.EAConstants-JScript

function OnProjectBrowserScript()
{
// Get the type of element selected in the Project Browser
var thePackage as EA.Package;
thePackage = Repository.GetTreeSelectedPackage();
theProject = Repository.GetProjectInterface();
theProject.ExportPackageXMI(thePackage.PackageGUID,22,0,-1,0,0,"C:\\Temp\\my.xmi");
}

OnProjectBrowserScript();

Now the next question is: how can I start EA from a batch file - e.g. called from Jenkins - for a certain model and running that script unattended?

8
General Board / Re: understanding SQL access
« on: September 11, 2021, 02:26:34 pm »
Yes, thank you Geert. Some feedback:
I started with your suggestion - realized that I do not have ActiveX in JavaScript - but in JScript. I could not get ActiveX in JScript work for me. However, as the xmlResult is fairly regular, regex is doing well by switching back to JavaScript:

Code: [Select]
!INC Local Scripts.EAConstants-JScript

function getDiagramIDFromQuery(sqlQuery) {
r = [];
xmlResult = Repository.SQLQuery(sqlQuery);
m = xmlResult.split('<Diagram_ID>');
for (i=1; i<m.length; i++) {
id = m[i].match(/^(\d+).*/)[1];
r.push(id);
}
return r;
}

function main()
{
diagIds = getDiagramIDFromQuery(
"select Diagram_ID from " +
"t_diagram t " +
"where t.Diagram_Type = 'Logical' " +
"and t.Name like '*Overview*' "
);
for(id of diagIds) {
diag = Repository.GetDiagramByID(id);
Session.Output(diag.Name);
}
}

main();

This selects the diagram ids of Class diagrams exposing the word "Overview" in its name.

9
General Board / understanding SQL access
« on: September 07, 2021, 06:17:10 pm »
I wonder why I am not able to access t_diagram by

Code: [Select]
!INC Local Scripts.EAConstants-JScript

 function getClassDiags() {
var ids = Repository.GetElementSet(
"select Diagram_ID from " +
"t_diagram"
,2)
return ids.Count;
 }
 
function main()
{
var diags = getClassDiags();
Session.Output(diags + " finished");
}

main();

Whereas
Code: [Select]
!INC Local Scripts.EAConstants-JScript

 function getClassDiags() {
var ids = Repository.GetElementSet(
"select Object_ID from " +
"t_object"
,2)
return ids.Count;
 }
 
function main()
{
var diags = getClassDiags();
Session.Output(diags + " diagrams");
}

main();

works fine.

I am looking at the create statements of t_object and t_diagram in EASchema_1558_MySQL, which I believe shall describe the JET4 database of the eapx file as well.

10
General Board / Re: print/println in Javascript
« on: September 06, 2021, 05:24:10 pm »
Thank you Geert - now I found WriteOutput also in the automation.pdf. Nice that one can create a dedicated tab. I found the doc of Session.Output here and in automation.pdf.

It is kind of confusing when officially delivered examples - like JavaScript1 - do not work. Thinking about bad local installation or environment, prior to lack in quality of delivery cost time and productivity. Not delivering those examples would be better, instead.

11
General Board / Re: print/println in Javascript
« on: September 06, 2021, 04:03:32 pm »
ok, qwerty - where do I find the documentation about the Repository functions? I looked in some User Guides, e.g. Automation, Object Model, Scripting - and could not identify it.

12
General Board / print/println in Javascript
« on: September 05, 2021, 07:37:52 pm »
does not work for me.
e.g. there is a simple example in Local Scripts: JavaScritp1, that also does not work on my computer: Win10+EA15.2:1559

Do you got any idea to make print for Javascript scripting work?

13
General Board / Re: multiple values in a Tag
« on: June 20, 2021, 08:33:52 pm »
Ok, thank you, Eve, Geert

A String type for Variants attribute seems to me the most appropriate one.
Also, a check routine that all Variants tag values have correct the spelling can help achieving consistency.

14
General Board / highlighting a variant
« on: June 08, 2021, 12:40:29 am »
I was looking around Shape Scripts in order to find how I can conditionally highlight elements belonging to a certain variant of my architecture. Could not find it immedately.
Therefore this question:

In a tag (introduced by a stereotype) there I have variant values, e.g. V1, V2, V3, ALL.
If I select - somehow interactivily - a certain system Variant (other than ALL) on the diagram I only what to see or highlight those elements having ALL or the selected variant. E.g. if I select V1, all elements shall be highlited having V1 and ALL in that Variant tag. All elements having only V2 or V3 are not shown or grey out.

Is there a Shape Script example (or any other method) to do this?
I am also interested in similar concepts.

Thank you in advance for helping.

15
General Board / update stereotypes profile is not recognized
« on: May 21, 2021, 12:20:18 am »
I am maintaining a project specific profile in a separate EA model. I am changing it with about a biweekly frequency (as the definition of our DSL progresses).
In the past I could Import Profile and then Sychronize and the updated version takes place for all used DSL stereotypes.

Now, when importing, a new profile is shown by the same name with about the same stereotype names.

How to tell EA (15.2) that is shall update the exiting one rather than creating a new one?

Pages: [1] 2 3 ... 16