Book a Demo

Author Topic: Element.synchTaggedValues Confusion  (Read 8698 times)

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Element.synchTaggedValues Confusion
« on: August 08, 2013, 08:37:45 pm »
Hi all,

I have an element with stereotype "InputFailureMode", which should additionally get the stereotype "Input Event" (Input Event contains several Tagged Values).

The code looks like this:
Code: [Select]
if (elem.Stereotype.Equals(FailurePropagationModel.STEREO_INPUTFAILUREMODE) {
                    elem.StereotypeEx += "," + STEREO_INPUTEVENT;
                    elem.Update();
                    System.Diagnostics.Debug.WriteLine("FM Name: " + elem.Name + " Stereo: " + elem.Stereotype + " StereoEx: " + elem.StereotypeEx);
                    System.Diagnostics.Debug.WriteLine("Synching: "+elem.SynchTaggedValues(FailurePropagationModel.PROFILE_NAME, FailurePropagationModel.STEREO_INPUTFAILUREMODE));
                    System.Diagnostics.Debug.WriteLine("Synching: " + elem.SynchTaggedValues(PROFILE_NAME, STEREO_INPUTEVENT));
                }

For any strange reason, the output of those lines is:
Code: [Select]
FM Name: NewElement115 Stereo: InputFailureMode StereoEx: InputFailureMode,Input Event
Synching: True
Synching: False

I don't understand, why the first synch succeeds while the second one doesn't. As background information, the element is created with the InputFailureMode-stereotype from the toolbox.

Please give me some enlightment  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #1 on: August 08, 2013, 08:46:43 pm »

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #2 on: August 08, 2013, 08:53:19 pm »
Not really, because the profile looks like this:

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #3 on: August 08, 2013, 10:00:03 pm »
I tried that. And, interestingly, I did not need to synch at all! The tags were immediately present after applying the stereotype(s). It seems that Sparx has done something with tagged values. Also if you remove the stereotype the tags go away (which was not the case with 9.3).

q.

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #4 on: August 08, 2013, 10:18:45 pm »
Do you mean that SOMESTEREOTYPE's tags appear in the Tagged Values window after those lines?

Code: [Select]
elem.StereotypeEx += "," + SOMESTEREOTYPE;
elem.Update();

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #5 on: August 08, 2013, 11:34:31 pm »
Yes. At least it did with my test MDG (build 1007).

Release notes for build 1005: Synchronizing tagged values for a stereotype will no longer duplicate inherited tagged values.

To me it looks like this has introduced a complete new behavior with tagged values.

q.
« Last Edit: August 08, 2013, 11:36:45 pm by qwerty »

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #6 on: August 08, 2013, 11:39:29 pm »
I also work with build 1007, but it doesn't work there.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #7 on: August 09, 2013, 05:21:05 am »
Can you try doing it manually? Create a plain class and assign the stereotypes from the ellipsis. That should add the tags.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #8 on: August 09, 2013, 08:40:43 am »
Quote
Release notes for build 1005: Synchronizing tagged values for a stereotype will no longer duplicate inherited tagged values.

To me it looks like this has introduced a complete new behavior with tagged values.
Release notes for version 10.

  Applying a stereotype to anything will now automatically add the tagged values specified by the stereotype.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #9 on: August 09, 2013, 09:27:27 am »
So doesn't that make SynchTaggedValues (/Profile) superfluous? The help does not tell.

q.
« Last Edit: August 09, 2013, 09:29:13 am by qwerty »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #10 on: August 09, 2013, 09:40:46 am »
Quote
So doesn't that make SynchTaggedValues (/Profile) superfluous? The help does not tell.

q.
Synchronizing still has its uses. It can restore deleted tags, and it can apply new tags when a profile changes.
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #11 on: August 09, 2013, 08:04:00 pm »
I see. But generally speaking you would not need to call synch with V10 as (my observation) adding the stereotype automatically adds the tagged values. Right?

q.

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Element.synchTaggedValues Confusion
« Reply #12 on: August 14, 2013, 01:26:46 am »
After long trial and error, I got the issue to work now.

The problem was that...

1) The stereotype I assigned to an element did not extend a metaclass.
2) when the stereotype extended a metaclass, it was apparently not the right one

Finally, I used the metaclass Property for the stereotype I wanted to assign to another one. I wasn't really able to figure out why metaclass DataType didn't work.