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 - Heidi V.

Pages: [1] 2
1
It seems that the limit of 255 characters is removed for tags in .qea (SQLite) files. The documentation of e.g. the TaggedValue class says that the Value field “has a 255 character limit. If the value is greater than 255 characters long, set the value to “<memo>” and insert the body of text in the 'Notes' attribute.”. See also https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/taggedvalue.html

I tested this with a string longer than 255 characters, and the text was saved without being cut off. In an exported XMI file, the full text was present as well.

As I understand it, the main difference between normal tags and the so-called memo-tags is that normal tags cannot contain end of line characters or newline characters (or at the least the user interface does not support entering those characters), whereas memo-tags can contain end of line characters and newline characters.

It would be great to have an official confirmation regarding the removal of this limit (and optimally, this would of course be reflected in the documentation).

2
When running the following query on a .qea repository using the model search facility

Code: [Select]
select 1+1 as addition;
the result is 11.

When running the same query from within DBeaver and on the command line using SQLite, the result is 2.

For some reason, a string concatenation is done in EA.

This apparently has been reported to Sparx earlier, see https://sparxsystems.com/forums/smf/index.php/topic,46874.msg273987.html#msg273987, but is not fixed yet in 16.1.1627.

I've submitted a bug report as well.



3
Bugs and Issues / Notation for template bindings
« on: June 15, 2023, 06:10:59 pm »
As far as I can see, EA uses a wrong notation for template bindings. The UML 2.5.1 specification states that “A TemplateBinding is shown as a dashed arrow with the tail on the bound element and the arrowhead on the template and the keyword «bind».” So it does not state that a hollow triangular arrowhead is used. See Figure 7.6 Template package with string parameters in UML 2.5.1 for an example.

When looking at older specifications, it seems that the older UML specifications have been inconsistent on this point. The inconsistency has been removed in UML 2.5.1. See e.g. https://issues.omg.org/issues/UML25-479.

4
@Geert: thanks for taking the time to test this!

I filed a bug report at Sparx.

5
I now tried with literal strings, that didn't change anything, the dialog is still shown. I tried with Java, and I tried with JavaScript, same result.

Java:
Code: [Select]
package dk.gov.data.modellingtools.projectmanagement;

import org.sparx.Repository;

public class Main {

  public static void main(String[] args) {
    System.out.println("Start");
    Repository repository = new Repository();
    boolean projectTransferResult = repository.GetProjectInterface().ProjectTransfer("C:\\Users\\B004114\\Documents\\workingdir\\EA2\\EABase.eap",
        "C:\\Users\\B004114\\Documents\\workingdir\\EA2\\EABase.feap",
        "C:\\Users\\B004114\\Documents\\workingdir\\EA2\\log.txt");
    System.out.println("Result: " + projectTransferResult);
    repository.Exit();
    repository = null;
    System.out.println("Stop");
  }

}

JavaScript:
Code: [Select]
function main() {
Repository.EnsureOutputVisible("Script");
Session.Output("Start");
var project as EA.Project;
project = Repository.GetProjectInterface();
project.ProjectTransfer("C:\\Users\\B004114\\Documents\\workingdir\\EA2\\EABase.eap",
"C:\\Users\\B004114\\Documents\\workingdir\\EA2\\EABase.feap",
"C:\\Users\\B004114\\Documents\\workingdir\\EA2\\log.txt");
Session.Output("Stop");
}

main();

The project is also not transferred, even when I click on the Transfer button when it shows up. It's just an empty file, there's no model in it.

6
I did make sure that the target file did not exist, before running the application. I can see that right after invoking org.sparx.Project.ProjectTransfer(String, String, String), the target file is created, and then the GUI, the "Project Transfer" window, appears.

Some more information: I tested using EA 16.0.1605.

I noticed that the release notes of EA 16.1.1623, released yesterday (17.01.2023), state:

Quote
ProjectInterface.ProjectTransfer now accepts .qea and .qeax as Source and Target extensions

A way to bulk migrate a set of EAP(X) projects to QEA(X) projects would be really useful.

7
I am trying to use the method

Code: [Select]
org.sparx.Project.ProjectTransfer(String, String, String)
in a Java project.

It is described as:

Quote
Notes: Transfers the project from a source .eap file or DBMS to a target .eap file, .eapx file or .feap file.

Parameters:

    SourceFilePath: String - the path of the source file to transfer
    TargetFilePath: String - the path of the target file, including the file type extension; Enterprise Architect creates a new Base project in this location (using the TargetFilePath as its name) and then transfers the content of the source project into that file
    LogFilePath: String - the path of the log file where the status of the transfer process is updated

In automation, the target file must not previously exist. Enterprise Architect creates a new, empty Base.* file using the specified target name and extension, and transfers the source project into it.

So something like the following:

Code: [Select]
// ...
Repository repository = new Repository();
repository.OpenFile(sourceProjectFile.getAbsolutePath());
repository.GetProjectInterface().ProjectTransfer(sourceProjectFile.getAbsolutePath(), targetProjectFile.getAbsolutePath(), new File(FileUtils.getTempDirectoryPath(), "projecttransferlog.txt").getAbsolutePath());
repository.CloseFile();
repository.Exit();
// ...

When running my application, a new file is created, but a window appears, titled "Project Transfer", the same one as described on https://sparxsystems.com/enterprise_architect_user_guide/16.0/model_exchange/performadatatransfer.html.

In order to continue the application, I have to click, meaning I cannot actually perform a fully automated project transfer.

Is it not possible at all to transfer (a rather large bunch of existing) projects in a fully automated way? That would especially be useful when migrating from EA 15 to EA 16, and thus migrating from .eap(x) to .qea files (once the feature request mentioned in https://sparxsystems.com/forums/smf/index.php/topic,47405.msg276388.html is implemented).

8
I spent some time on writing an application that connect to the Java API, so I thought I would document some of my findings in order to save others the time to find out the same things.

According to https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/automation_connect_setup.html, the first step is the following:

Quote
Copy the file:

      SSJavaCOM.dll

from the Java API subdirectory of your installed directory, usually:

      Program Files/Sparx Systems/EA

into any location within the Windows PATH

      windows\system32 directory.

Note:  Under 64-bit operating systems, the SSJavaCOM.dll file must be copied into C:\Windows\SysWOW64.

Under 64-bit versions of Windows, the 'System32' directory is for 64-bit applications, and 'SysWOW64' is for 32-bit applications.

A (cleaner?) way, that does not involve having to copy dll files – and that therefore does not require administrator rights on your machine, and that works also if you forget to copy these files when you update EA – is to call java with system property java.library.path. System property java.library.path is in the javadoc of the java.lang.System class defined as “List of paths to search when loading libraries” (that is, native libraries), see also https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html, and loading libraries is done using method java.lang.System.loadLibrary(String).

So if "C:\Program Files (x86)\Sparx Systems\EA\Java API" is the folder that contains SSJavaCOM.dll and possibly also SSJavaCOM64.dll, then a Java application that connects to the EA interface can be called this way:

Code: [Select]
java -Djava.library.path="C:\Program Files (x86)\Sparx Systems\EA\Java API" -jar myapp.jar
Note: see also the static initializers in org.sparx.Services and org.sparx.Repository:

Code: [Select]
package org.sparx;

public class Services {
// ...

static {
if (System.getProperty("os.arch").equals("x86")) {
System.loadLibrary("SSJavaCOM");
} else {
System.loadLibrary("SSJavaCOM64");
}
}
}

Code: [Select]
package org.sparx;

import java.util.Date;

public class Repository {
// ...

static {
if (System.getProperty("os.arch").equals("x86")) {
System.loadLibrary("SSJavaCOM");
} else {
System.loadLibrary("SSJavaCOM64");
}

}
}


9
You may not have to use a hybrid approach as the EAScriptLib has JScript-XML in V15 which has been ported to JavaScript-XML in V16 Beta. So you could potentially use that.

Thanks for the information. I haven't migrated to EA 16 yet. I would like to use the hybrid approach for several reasons, not only XML handling, so I'll probably stick to that anyway, but I'll have a look at the ported libraries.

10
Ok, so the difference with JScript is that the methods are case-sensitive. So I corrected that in the scripts where needed. And made a copy of the scripts from EAScriptLib that we use to change "new ActiveXObject" to "new COMObject" and included those instead of the original scripts.

Then I run into another problem with Scripting.Dictionary:

Code: [Select]
function main() {
Repository.EnsureOutputVisible("Script");
var valueMap = new COMObject("Scripting.Dictionary");
valueMap.Add("Header", "value");
Session.Output(valueMap.Exists("Header"));
Session.Output(valueMap.Item("Header"));
}

main();

gives the following error:

Code: [Select]
Sandbox.My first Javascript error: Incorrect number of arguments
passed:1, expected:2, Line:8

Any ideas on how to solve this? According to https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/item-property-dictionary-object (the site referred to in the previous post), this is a property, not a method, and it takes one parameter.

JavaScript has built-in support for Maps, see e.g. https://www.w3schools.com/js/js_maps.asp

So the code above should be updated as follows:

Code: [Select]
function main() {
Repository.EnsureOutputVisible("Script");
var valueMap = new Map();
valueMap.set("Header", "value");
Session.Output(valueMap.has("Header"));
Session.Output(valueMap.get("Header"));
}

main();

For working with XML (see the error described above), I'll use Java instead, using the Hybrid Scripting Approach, e.g. as described at https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/HybridScripting.

11
General Board / Re: Diagrams in report cropped again!
« on: October 02, 2021, 01:16:27 am »
I experienced the same behaviour today. It may have a relation to the fact that first I had a model open while my computer was not in its docking station, I still had it open when I connected to the docking station. The generated file had cropped images. When closing EA and opening the project file again, the problem disappeared...

12
Quote
When trying to use this functionality I get the following error message:
Model Template Pattern failed to load. Ensure the selected template file is available.

Where can I find these template files?? And where should I put them?

You have to enable the "Custom Diagram Style" MDG.

13
Ok, so the difference with JScript is that the methods are case-sensitive. So I corrected that in the scripts where needed. And made a copy of the scripts from EAScriptLib that we use to change "new ActiveXObject" to "new COMObject" and included those instead of the original scripts.

Then I run into another problem with Scripting.Dictionary:

Code: [Select]
function main() {
Repository.EnsureOutputVisible("Script");
var valueMap = new COMObject("Scripting.Dictionary");
valueMap.Add("Header", "value");
Session.Output(valueMap.Exists("Header"));
Session.Output(valueMap.Item("Header"));
}

main();

gives the following error:

Code: [Select]
Sandbox.My first Javascript error: Incorrect number of arguments
passed:1, expected:2, Line:8

Any ideas on how to solve this? According to https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/item-property-dictionary-object (the site referred to in the previous post), this is a property, not a method, and it takes one parameter.


14
I tested again, now with 15.1.1526, I get the same errors.

15
I have 15.0.1507 installed. According to https://www.sparxsystems.com/products/ea/15/history.html that includes:

Build 1500
Quote
Javascript engine updated

    Built-in javascript support updated to use the Mozilla Spidermonkey 63
    Provides new functions such as JSON parsing


Build 1505:
Quote
Javascript handling of optional parameters on ActiveX objects improved

Pages: [1] 2