archimatetool/archi-scripting-plugin

Problem with launching @ArchimateRelationshipProxy.java@ for connection merge

dmaximenko opened this issue · 5 comments

Version of jArchi, Operating System

MAC, archi 4.9.3, jArchi 1.2

Expected Behaviour

I suppose that my connections should be merged

Actual Behaviour

Script falls into error

Script Error: javax.script.ScriptException: SyntaxError: .../Library/Application Support/Archi4/scripts/merge connections.ajs:8:0 Expected an operand but found import
import com.archimatetool.model.IArchimateRelationship;
^ in at line number 1
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(Unknown Source)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(Unknown Source)

Steps to Reproduce the Behaviour (with attached test files/script)

  1. Try to add using "Archi Script manager" this script https://github.com/archimatetool/archi-scripting-plugin/blob/master/com.archimatetool.script/src/com/archimatetool/script/dom/model/ArchimateRelationshipProxy.java

ArchimateRelationshipProxy.java is not a jArchi script, it's source code for jArchi.

I think you might be misunderstanding this. If you want to merge connections you can simply use the in-built merge function of jArchi:

https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Object#merge2

Thank you
I'm new in jArchi scripting. Could you tell a little bit more how to launch connection merging?
Thank you

Take a look through the wiki and some examples found here in GitHub and on the Archi Forum.

For merge the basics are to get a reference to the two relationships to be merged and then call:

relation.merge(otherRelation);

If two connections are selected in a View:

var selectedRelationship = $(selection).first().concept;
console.log("Selected: ", selectedRelationship);

var otherRelationship = $(selection).get(1).concept;
console.log("Other: ", otherRelationship);

selectedRelationship.merge(otherRelationship);