Book a Demo

Author Topic: Connecting a Throw to a Catch  (Read 7288 times)

harjaapsandhu

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Connecting a Throw to a Catch
« on: November 22, 2016, 05:31:32 am »
Hello guys,

I have created different models in Sparx and I wanted to connect them together.

For example, I have an intermediate event that is a throw at the end of one of the routes in diagram1 and I have an intermediate event that is a catch at the beginning of diagram. What I want to be able to do is click on the throw and it will show me the diagram for entire diagram for catch. I want to keep diagram2 a separate model for re-usability in other models which is why I didn't add it directly in diagram1. I've seen that all of the posts I've seen link activities together but nothing about linking the throw and catch together.

I am currently on Sparx 12.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13453
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connecting a Throw to a Catch
« Reply #1 on: November 22, 2016, 07:05:05 am »
You'll have to give us some more details about your issue.
The modelling language you are using would be a good start.

Geert

harjaapsandhu

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #2 on: November 22, 2016, 07:48:07 am »
I was using the Analysis diagram from the Sparx UML extended window. I've just been using on screen things like out of the toolbox to create my diagram.

I haven't done any actual coding if that's what you were asking.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #3 on: November 22, 2016, 09:24:59 am »
You mention Intermediate Event, so I assume you're modeling with BPMN. There are some elements that allow you to create a link to another diagram that will open when you double-click them, but unfortunately Intermediate Event isn't one of those. There is a work-around though:

Create a Class element on your diagram. Right-click > New Child Diagram > Select Composite Diagram and choose the diagram that you want to open on double-click. Ribbon > Design > Element > Manage > Change Type and change the Class to an Event. Drag a BPMN IntermediateEvent from the toolbox onto the Event element, choose "Stand-alone" and "Apply". You should now have an Intermediate Event which can be double-clicked to open a diagram.
« Last Edit: November 22, 2016, 10:54:12 am by KP »
The Sparx Team
[email protected]

harjaapsandhu

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #4 on: November 24, 2016, 08:40:51 am »
So when I go to create a child element the only options I get are "Attach Note" and "Attach Constraint"

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #5 on: November 24, 2016, 09:50:34 am »
So when I go to create a child element the only options I get are "Attach Note" and "Attach Constraint"

My instructions didn't mention creating a child element. Please try again.

Quote
Create a Class element on your diagram. Right-click > New Child Diagram > Select Composite Diagram and choose the diagram that you want to open on double-click. Ribbon > Design > Element > Manage > Change Type and change the Class to an Event. Drag a BPMN IntermediateEvent from the toolbox onto the Event element, choose "Stand-alone" and "Apply". You should now have an Intermediate Event which can be double-clicked to open a diagram.
The Sparx Team
[email protected]

harjaapsandhu

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #6 on: November 24, 2016, 10:03:08 am »
It lets me make the child diagram on Activities but then when I went to Ribbon > Element > Advanced > Change Type > Event the symbol didn't change to the one that looks like an IntermediateEvent symbol but it does work how I want it to. But for the purposes I'm using it for I need this to look like the IntermediateEvent Symbol.

Also I just figured out that I'm on BPMN 2.0.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #7 on: November 24, 2016, 10:15:55 am »
It lets me make the child diagram on Activities but then when I went to Ribbon > Element > Advanced > Change Type > Event the symbol didn't change to the one that looks like an IntermediateEvent symbol but it does work how I want it to. But for the purposes I'm using it for I need this to look like the IntermediateEvent Symbol.

Also I just figured out that I'm on BPMN 2.0.

Did you do the final step: Drag a BPMN IntermediateEvent from the toolbox onto the Event element, choose "Stand-alone" and "Apply"? This will apply the BPMN stereotype to the Event element.
The Sparx Team
[email protected]

harjaapsandhu

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Connecting a Throw to a Catch
« Reply #8 on: November 24, 2016, 10:48:23 am »
Yup I figured it out. When you drag it into the Event it asks if you want to convert to an IntermediateEvent. Thank you for all your help.

Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 320
  • Karma: +15/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
Re: Connecting a Throw to a Catch
« Reply #9 on: July 07, 2017, 11:36:42 am »
Came across a similar situation, and put together a Diagram script.. 

Just in case someone else needs it
Code: [Select]
sub ConvertToCatch()

' Get a reference to the current diagram
dim currentDiagram as EA.Diagram
set currentDiagram = Repository.GetCurrentDiagram()

if not currentDiagram is nothing then
' Get a reference to any selected connector/objects
dim selectedObjects as EA.Collection
set selectedObjects = currentDiagram.SelectedObjects

if selectedObjects.Count > 0 then
Dim eaObj as EA.DiagramObject
for each eaObj in selectedObjects
Dim eaElem as EA.Element
set eaElem = Repository.GetElementByID (eaObj.ElementID)
eaElem.Type = "Event"
eaElem.Stereotype = ""
eaElem.StereotypeEx = ""
eaElem.Stereotype = "BPMN2.0::IntermediateEvent"
eaElem.Update

Dim tag as EA.TaggedValue

for each tag in eaElem.TaggedValues
if tag.Name = "eventDefinition" then
tag.Value = "Link"
tag.Update
eaElem.TaggedValues.Refresh
End If
if tag.Name = "catchOrThrow" then
tag.Value = "Catch"
tag.Update
eaElem.Taggedvalues.Refresh
End If
Next

Next
else
' Nothing is selected
end if
else
Session.Prompt "This script requires a diagram to be visible", promptOK
end if