Book a Demo

Author Topic: No permissions to write into .eapx file using Update()  (Read 37513 times)

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
No permissions to write into .eapx file using Update()
« 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

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #1 on: March 01, 2024, 08:43:39 am »
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.

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #2 on: March 06, 2024, 02:50:42 am »
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

ea0522

  • EA User
  • **
  • Posts: 134
  • Karma: +5/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #3 on: March 06, 2024, 05:46:28 pm »
When you are on EA V16(.1), you could try to migrate to a QEAX file?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #4 on: March 06, 2024, 09:29:46 pm »
In your code above you clearly miss the update for the TV.

q.

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #5 on: March 08, 2024, 07:01:37 pm »
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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #6 on: March 08, 2024, 09:16:40 pm »
Have you run a model consitency check?

Also try exporting as xmi and importing into an empty eap.

q.

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #7 on: March 09, 2024, 12:04:28 am »
Thank you,

both export and import working without errors. Also consistency check without problems :(

Regards,
Cesar

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #8 on: March 09, 2024, 12:15:36 am »
One more hint in case relevant: when I change the extension to .eap instead of .eapx, I cant even open the repository.

wivel

  • EA User
  • **
  • Posts: 243
  • Karma: +12/-1
  • Driven by Models
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #9 on: March 09, 2024, 01:26:40 am »
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 

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #10 on: March 09, 2024, 02:44:06 am »
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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #11 on: March 09, 2024, 07:57:44 am »
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.

cmesbal

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #12 on: March 09, 2024, 08:17:33 am »
Yes

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #13 on: March 09, 2024, 11:40:43 am »
Maybe your EA installation broke?

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: No permissions to write into .eapx file using Update()
« Reply #14 on: March 12, 2024, 08:45:44 am »
Is your file read only (or do you have write permissions to that file)?