archimatetool / archi-modelrepository-plugin

coArchi - a plug-in to share and collaborate on Archi models.
151 stars 52 forks source link

Get error when use specialization #177

Closed osanimmnt closed 2 years ago

osanimmnt commented 2 years ago

Version of Archi, Operating System

Windows 10

Version of this plug-in

0.7.1

Any other plug-ins installed?

Archi Excel Plug-in 0.1.0 Archi Scripting 1.1.1 Icon Plug for ArchimateTool 1.0.11

Expected Behaviour

when commit all is ok

Actual Behaviour

image

Steps to Reproduce the Behaviour

  1. Create an specialization and udpdate and object with specialization generated
  2. Commit the change
  3. in other computer "Refresh Model"
Phillipus commented 2 years ago

Hi, could you provide some details about the issue?

osanimmnt commented 2 years ago

Hi, could you provide some details about the issue?

Sure. details added

Phillipus commented 2 years ago

@jbsarrodie Can you say what the main issues are regarding coArchi and Specializations? Are there any quick fixes we can apply to coArchi to handle them?

Phillipus commented 2 years ago

@osanimmnt What version of Archi 4.9 is this? Beta 1?

Phillipus commented 2 years ago

@osanimmnt Does the error occur on commit, or when you push and then refresh on another machine?

jbsarrodie commented 2 years ago

Hi,

First, as written on the forum:

For those interrested in the new specialization mecanism in Archi 4.9: note that there is no support planned for it in coArchi (this will have to wait for coArchi 2 which will certainly take several months to be out). This doesn't mean you can't use both, but in case of conflicts there will be no mean to decide which "version" to keep, and thus this will most certainly block the merge process and thus the publication of changes on the remote server. You've been warned ;-)

@jbsarrodie Can you say what the main issues are regarding coArchi and Specializations? Are there any quick fixes we can apply to coArchi to handle them?

I'll look at it. I think it should be quite easy to make it work (slight changes in the underlying GRAFICO engine), except for conflict handling which would require changes on the UI itself (to show concept's specialization and to expose specialization's definition)

Phillipus commented 2 years ago

@jbsarrodie Thanks. If you can give me the analysis and what's needed, I'll implement it.

osanimmnt commented 2 years ago

r when you push and then refresh on another machine?

nop, commit is ok. it it when someone try to refresh model in other computer

Phillipus commented 2 years ago

@osanimmnt Thanks for the info.

As Archi 4.9 is still in beta and we haven't yet implemented support for Specializations in coArchi it's best not to use Specializations in models shared with coArchi.

osanimmnt commented 2 years ago

I create this Specialization image and i assigned to a node: image

commit ok.

and when someone else refresh model get this: image

osanimmnt commented 2 years ago

@osanimmnt Thanks for the info.

As Archi 4.9 is still in beta and we haven't yet implemented support for Specializations in coArchi it's best not to use Specializations in models shared with coArchi.

:'( so bad, because it is a great functionallity to create very good views the users love!

Phillipus commented 2 years ago

@jbsarrodie Exporting to Grafico the reference to the Profile is using an absolute file href:

<archimate:BusinessRole
    xmlns:archimate="http://www.archimatetool.com/archimate"
    name="Business Role"
    id="id-e3873a0fb2db49d7bd8b8d42f46d6326">
  <profiles
      href="file:/C:/Users/Phillipus/AppData/Roaming/Archi4/model-repository/archisurance1/model/folder.xml#id-5348a711271e41f0b2d77c791046fde6"/>
</archimate:BusinessRole>

But when referencing from an object from a View it's not using file:/:

    <archimateElement
        xsi:type="archimate:BusinessActor"
        href="BusinessActor_id-fe9cddb8e22d420ba22e2c475520b97a.xml#id-fe9cddb8e22d420ba22e2c475520b97a"/>

I can't remember why or how this happens?

Phillipus commented 2 years ago

I think the place to look is in GraficoExporter#createAndSaveResource:

URI key = file.getName().equals(IGraficoConstants.FOLDER_XML) ?
        URI.createFileURI(file.getAbsolutePath()) : URI.createFileURI(file.getName());

URI.createFileURI(file.getAbsolutePath()) : URI.createFileURI(file.getName());
URI value = URI.createFileURI(file.getAbsolutePath());
fResourceSet.getURIConverter().getURIMap().put(key, value);

folder.xml files are stored with absolute file paths, and other resources with file name. Therefore references to profiles in the main folder.xml file are absolute.

Phillipus commented 2 years ago

Adding this line solves the problem:

if(object instanceof IArchimateModel) {
   key = URI.createFileURI(file.getName());
}
<archimate:BusinessRole
    xmlns:archimate="http://www.archimatetool.com/archimate"
    name="Business Role"
    id="id-e3873a0fb2db49d7bd8b8d42f46d6326">
  <profiles
      href="folder.xml#id-5348a711271e41f0b2d77c791046fde6"/>
</archimate:BusinessRole>

But don't know yet whether href="folder.xml#id-5348a711271e41f0b2d77c791046fde6" will resolve when importing...

jbsarrodie commented 2 years ago

But don't know yet whether href=\"folder.xml#id-5348a711271e41f0b2d77c791046fde6\" will resolve when importing...

I think it wont because of the "folder.xml" in the fragment. There's some slight changes needed. Nothing complicated, I just need some time to work on it :-)

Phillipus commented 2 years ago

I think it wont because of the "folder.xml" in the fragment. There's some slight changes needed. Nothing complicated, I just need some time to work on it :-)

No it doesn't resolve. I'll wait until you get some time ;-)

osanimmnt commented 2 years ago

did you find the error?

Phillipus commented 2 years ago

did you find the error?

Yes. As you can see from the previous comments, we're working on it.

jbsarrodie commented 2 years ago

I'll wait until you get some time ;-)

Done in edb69c8ef046c72dd2b17933f65ec84e811e2aeb

Phillipus commented 2 years ago

Thanks!

One question regarding this in resolveProxies():

if(eObject instanceof IArchimateConcept) {
...
...
} else if(eObject instanceof IArchimateRelationship) {

If eObject is an IArchimateRelationship it will execute the first block as it inherits from IArchimateConcept. Maybe remove the else?

Phillipus commented 2 years ago

And resolvedPrimaryProfile might be null and concept.getProfiles(); might return an empty list?

jbsarrodie commented 2 years ago

Ok, see this as a POC ;-)

I'll fix it completely tomorrow.

Phillipus commented 2 years ago

Ok, see this as a POC ;-)

Aha! :-)

jbsarrodie commented 2 years ago

Should be good with 3ba562babe8753a5375a53f46bdba700c84ac042 (I've force pushed an amended commit)

Phillipus commented 2 years ago

My OCD is playing up again...

import com.archimatetool.model.IProfiles; <------------------ 😟

Phillipus commented 2 years ago

I wasn't aware of Iterator#set. Interesting!

jbsarrodie commented 2 years ago

My OCD is playing up again...

import com.archimatetool.model.IProfiles; <------------------ 😟

Should be good now ;-)

Phillipus commented 2 years ago

Should be good now ;-)

Phew, I can stop shaking now... 😄

Phillipus commented 2 years ago

Merged to master.

osanimmnt commented 2 years ago

I downloaded and installes and new version of archimate and new version of plug-ins but the error pesist.

image

jbsarrodie commented 2 years ago

I downloaded and installes and new version of archimate and new version of plug-ins but the error pesist.

Could you double check the version of Archi and your plugins and test with a new model (not one containing specialization but exported using an old version of the plugin).

osanimmnt commented 2 years ago

the archi version:

image

plug-in versions: image

yes, I tried everything without specialization and it worked properly. but, when I added some especialization I published and all good, but, when I tried to refresh model from other PC I get that error

jbsarrodie commented 2 years ago

Can you publish a model on a github repository so that I can try to import it ?

osanimmnt commented 2 years ago

listo https://github.com/osanimmnt/TestArchiSpecialization

jbsarrodie commented 2 years ago

The repo is empty, can you publish into it (it might require you to setup the proxy)

osanimmnt commented 2 years ago

try with this one: https://github.com/osanimmnt/Testing2Specialization you should get this one: image

jbsarrodie commented 2 years ago

I've just tried (using a newly downloaded version of Archi for Linux and coArchi) and everything is fine: I can import this model successfully.

jbsarrodie commented 2 years ago

yes, I tried everything without specialization and it worked properly. but, when I added some especialization I published and all good, but, when I tried to refresh model from other PC I get that error

Thinking about it: you have the latest versioni of Archi and coArchi on the PC from which you published the model, but do you also have the latest version of coArchi on the other PC ?

osanimmnt commented 2 years ago

yes, it is the same. could you please share your plug-ins versions?

osanimmnt commented 2 years ago

can you check? I tried with th other computar the test I shared to you and I get the same error, did you try?

jbsarrodie commented 2 years ago

yes, it is the same. could you please share your plug-ins versions?

That's the latest version published on archimatetool.com (Archi 4.9.0 and coArchi 0.8.0).

osanimmnt commented 2 years ago

Yes, I have the same. Did you try to get from repository I shared?

jbsarrodie commented 2 years ago

Yes, I have the same. Did you try to get from repository I shared?

yes, that was my point in a previous comment: I can get it without any issue and can see defined specializations and their usage.

osanimmnt commented 2 years ago

Can you see the same image and icons I shared in previous message?

image

jbsarrodie commented 2 years ago

Can you see the same image and icons I shared in previous message?

yes

osanimmnt commented 2 years ago

I uninstalled everything and I deleted all old folder and now it is working!! Thanks! you can close this bug now!

jbsarrodie commented 2 years ago

Great!

Don't hesitate to reopen if needed.