Book a Demo

Author Topic: How do I link an operation to a transition trigger  (Read 3452 times)

AndyB

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
How do I link an operation to a transition trigger
« on: August 02, 2009, 02:16:35 am »
How do I strongly associate Operations with Triggers (of State transitions)?

Here's the problem:

I have a Class called LightBulb.

It has two Operations:

switchOn()
switchOff()

It has a State Machine containing two States:

On
Off

How do I associate the Operation 'switchOn()' with the Trigger for the transition between 'Off' and 'On'?

When I edit the properties for the transition between 'Off' and 'On', I do not see the list of Operations. Should I? I can add a new Trigger, but it is still not associated with the operation?

Am tearing my hair out on this one! I must be doing something stupid!

Thanks in advance for any help,
Andy.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How do I link an operation to a transition tri
« Reply #1 on: August 02, 2009, 02:43:50 am »
I think you need to use an event rather than an operation. You can create an event element to represent this, and go from there.
No, you can't have it!

AndyB

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: How do I link an operation to a transition tri
« Reply #2 on: August 02, 2009, 02:50:53 am »
I don't think there is such a thing as an 'Event' element. I can create a 'Trigger' element, but how do I associate this with the operation using the correct UML notation?


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How do I link an operation to a transition tri
« Reply #3 on: August 02, 2009, 03:23:16 am »
I beg to differ...

EA Help index: Event | Element.

EA Help index: Trigger | Create in Transition Properties.
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: How do I link an operation to a transition tri
« Reply #4 on: August 03, 2009, 04:24:51 pm »
Andy,

AFAIK a trigger cannot be linked directly to an operation in EA (unless a new version now supports something which I may not have seen). You can check "Effect is an Activity" for the trigger and choose an activty  element. This can contain an action, and an action an be linked to an operation.

If you think this is twisted or to much effort and don't want to use additional activity diagrams with your state machines, you can define a RefGUID tagged value type and then give your triggers tagged values pointing directly to an operation. This will be enough if you just want to have the information within the model for further processing (like trying some XUML stuff). If you want to see the name of the operation on your state machine diagram, maybe it can be done with shape scripting, but I'm not sure if there is a way to retrieve the name of an operation from the GUID contained in the tagged value. It's no problem with the automation interface, but most probably the Neanderthal macro language used for shape scripts will not allow this.

Frank