Sparx Systems Forum
Enterprise Architect => Bugs and Issues => Topic started by: cmesbal on February 29, 2024, 08:43:32 pm
-
Hello everyone,
I would like to update a taggedValue of my EA model via API. The value seems to be set after using taggedValue.Set("NewValue"). Also, it looks like the database is temporarily updated. However, the "NewValue" is never written into the .eapx file.
Here is my example code:
Element element = repository.GetElementByGuid("{CD7E7E60-5086-4fc8-B3B6-FE69094B659B}");
Collection<TaggedValue> taggedValues = element.GetTaggedValuesEx();
for (TaggedValue taggedValue : taggedValues) {
if (taggedValue.GetName().equals("isEncapsulated")) {
String value = "NewValue";
taggedValue.SetValue(value);
taggedValues.Refresh();
}
repository.SaveAllDiagrams();
repository.CloseFile();
The new value is of the correct type.
Using taggedValue.Update() returns always false with exception "You do not have the required permissions to perform this operation. "
It looks like an access issue in order to be able to write into the .eapx file, which I never did before.
Can anyone help?. Thank you.
Best regards, César
-
Update is the function that actually saves to the database.
Based on the error you get, I would guess that security is enabled on the model you're using, and the user your code is logging in as doesn't have edit permissions.
-
Thank you Eve,
according to my model on EA, security is not enabled. I also checked it using repository.GetIsSecurityEnabled() method.
I never had to log in in order to adapt the model manually in EA before. When using repository.OpenFile2() and passing password and user, result is still the same.
So in summary, it doesnt seem to be an authentification or security issue. Or did I missundertand anything?.
After running my program, the .ldb file is updated and stays open (it does not close until I kill the process in the windows task list). However, the .eapx file does not update.
Do you have any other idea/suggestion?.
Thank you,
César
-
When you are on EA V16(.1), you could try to migrate to a QEAX file?
-
In your code above you clearly miss the update for the TV.
q.
-
Hello,
thank you for your comments.
I use EA 15.2, so the migration would not be relevant as far as I know.
Also, I had already considered the update of the TV, but the returned value is always false.
I still believe it has something to do with writting rights, as Eve mentioned, because I can read the midel without problem. However, the security is definitely not enabled...
Any other idea?
Thank you!
Cesar
-
Have you run a model consitency check?
Also try exporting as xmi and importing into an empty eap.
q.
-
Thank you,
both export and import working without errors. Also consistency check without problems :(
Regards,
Cesar
-
One more hint in case relevant: when I change the extension to .eap instead of .eapx, I cant even open the repository.
-
Hi
Where is your project stored? Locally, on a file server, onedrive, etc.? I have had issues on a file server, where Access created lock files, that didn't get deleted when the model was closed. Caused all sorts of problems for us.
Henrik
-
Hello Henrik,
my model is stored locally for the moment. I created a very simple model just to test the writing capability from a very simple program in eclipse (basically the lines above inside a main method and a repository object.
Regards,
Cesar
-
Thank you,
both export and import working without errors. Also consistency check without problems :(
Regards,
Cesar
And you run into the same issue on the re-imported model??
q.
-
Yes
-
Maybe your EA installation broke?
q.
-
Is your file read only (or do you have write permissions to that file)?
-
Hello everyone,
I was able to run the program in another laptop. However, the problem still occurs in my laptop. I definitely think it is a rights or configuration issue: whenever I try to write into the file, the temporary .ldb is kept open and it does not close. After execution, I always have to kill the EA process in the task manager and delete the .ldb manually. My next idea would be to delete and reinstall EA.
Regards,
Cesar
-
Cesar,
The problem you are describing looks like a problem we have seen with things like onedrive; where the folder is actually synchronized with a folder in the cloud.
To make sure that isn't the problem, I would try to store the file in something c:\temp\
Geert
-
Hello everyone,
problem is solved: I had two installations of EA: EA and EA Lite. Somehow the programm was always starting the EA Lite version. After deinstallation of EA Lite the programm writes into the file without issues.
Thank you everyone!
Cesar