Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: McMannus 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:
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:
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 :)
-
Does this one help you further: http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1375916353?
q.
-
Not really, because the profile looks like this:
(https://dl.dropboxusercontent.com/u/15260967/screenshot%201.jpg)
-
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.
-
Do you mean that SOMESTEREOTYPE's tags appear in the Tagged Values window after those lines?
elem.StereotypeEx += "," + SOMESTEREOTYPE;
elem.Update();
-
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.
-
I also work with build 1007, but it doesn't work there.
-
Can you try doing it manually? Create a plain class and assign the stereotypes from the ellipsis. That should add the tags.
q.
-
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.
-
So doesn't that make SynchTaggedValues (/Profile) superfluous? The help does not tell.
q.
-
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.
-
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.
-
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.