Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ted Speers on September 27, 2016, 01:34:33 pm
-
I want to create a class stereotytpe that when I pull it into a diagram, it has the attributes and methods already attached. The documentation only shows how to add tags to a stereotype (I have no idea what good tags are BTW ... would love to be enlightened).
The behaviour i want is found in the ArcGIS toolkit .
When a <<CodedValueDomain>> is added to a diagram, it has attributes ... 3 of which have nothing to do with the Profile.
-
The way I would do this, and the way it has been implemented in ArcGIS, is as follows:
- Create a profile with your stereotype. Save it.
- Create an MDG Technology that includes your profile. Let the Technology Wizard create a .MTS file so you can rebuild the technology later.
- Deploy the MDG Technology.
- Create a stereotyped element on a diagram. Give it all the attributes and operations you want it to be created with.
- Save the diagram as a Pattern.
- Create a toolbox profile. One of the toolbox commands will be "MyTechnology::MyPattern(UMLPatternSilent)". Save the toolbox profile.
- Rebuild your technology, including the Pattern and the Toolbox Profile.
- Re-deploy your technology.
Instructions for each step can be found in the help file. Good luck!
-
thanks ... it wasn't obvious
-
thanks ... it wasn't obvious
Hi Ted,
When you get it working, can you post the relevant snippet(s) of the MDG? I'm interested in seeing the effects of the process on the output MDG.
TIA,
Paolo
-
Just got around to it and haven't been able to get it working.
When I drag the pattern onto the diagram, it says 'Pattern not found in model's resources.'
I am definitely including the pattern in the MDG build wizard.
In the toolbox ... I'm naming the attribute TechName::PatternName(UMLPatternSilent) where
- TechName is the name I enter in the first line "Technology" in the MDG wizard and
- PatternName is what i call the pattern in the save as UML pattern dialog.
BTW, if i right click on 'Pattern' in the model resources box, i do not get an option to import a pattern. I don't think importing is necessary if it is included in the MDG build dialog.
Using EA v11
-
Patterns are NOT included in the MDG file (unfortunately) and have to be distributed separately.
There's a discussion from a few months ago about this specific shortcoming of MDG's
Geert
-
Can you tell me how to modify the procedure supplied earlier in this thread? Does the fact that I can't appear to import patterns cause an issue?
<copied from above>
Create a profile with your stereotype. Save it.
Create an MDG Technology that includes your profile. Let the Technology Wizard create a .MTS file so you can rebuild the technology later.
Deploy the MDG Technology.
Create a stereotyped element on a diagram. Give it all the attributes and operations you want it to be created with.
Save the diagram as a Pattern.
Create a toolbox profile. One of the toolbox commands will be "MyTechnology::MyPattern(UMLPatternSilent)". Save the toolbox profile.
Rebuild your technology, including the Pattern and the Toolbox Profile.
Re-deploy your technology.
-
Ted, the "redeploy your technology" step has to include distributing your pattern xmi to a specific location (I don't remember exactly where)
Geert
-
so this thread ( http://sparxsystems.com/forums/smf/index.php/topic,30878.msg224230.html#msg224230 ) refers to putting stuff in this directory ... C:\Program Files (x86)\Sparx Systems\EA\ModelPatterns
will give that a try
-
didn't work
-
I know this does not sound quite helpful, but sleeping a night over it did solve such issues for me in most cases. Usually it was a simple typo or I saved the wrong date in the wrong place (double the error!). Yes, EA is very unforgiving when it comes to errors in MDG creation. You just get a "does not work" and no hint what might be wrong. If sleeping over it did not solve it, start over with a tiny sample and grow that stepwise (!) until it has everything you need.
q.
-
haven't quite slept on it ... did inspect the .xml file generated by the wizard ... i'd attach it if i could
in the xml the data structure is
<UMLPatterrns>
<UMLPattern>
---- from the pattern file ...named after the drawing
</UMLPattern>
<UMLPattern>
---- from the MDG generation wizard ... name = MyName
</UMLPattern>
</UMLPatterns>
in the toolbox, i tried both names ... drawing name in first UMLPattern tag and name in second tag ... both give same error when i drag it from toolbox onto a drawing.
-
In the toolbox ... I'm naming the attribute TechName::PatternName(UMLPatternSilent) where
- TechName is the name I enter in the first line "Technology" in the MDG wizard and
- PatternName is what i call the pattern in the save as UML pattern dialog.
It's the technology ID, not name. The second line of your technology will be something like this:
<Documentation id="GoF" name="Gang of Four Patterns" version="2" notes="Use patterns from the book Design Patterns by Gamma, Helm, Johnson and Vlissides." infoURI="http://www.sparxsystems.com" supportURI="[email protected]"/>
In this case, it will be "GoF" that you need to use, not "Gang of Four Patterns".
-
that works, thanks
-
that works, thanks
Hi Ted,
That's great! Just so there's no confusion, can you post a snippet?
TIA,
Paolo
-
that works, thanks
Hi Ted,
That's great! Just so there's no confusion, can you post a snippet?
TIA,
Paolo
Until Ted gets back to you, have a look at C:\Program Files (x86)\Sparx Systems\EA\MDGTechnologies\GoF.xml - it's a technology containing nothing but patterns and toolboxes.
-
Thanks KP,
I'm not ready to "pull the trigger" just yet, but soon.
Paolo
-
Don't know how to send attachment or paste XML into this tool.
<?xml version="1.0"?>
-<MDG.Technology version="1.0"><Documentation version="0" notes="RISC-V" name="RISC-V" id="RISC-V"/>-<UMLProfiles>+<UMLProfile profiletype="uml2">---------------</UMLProfiles>-<UMLPatterns>-<UMLPattern>-<XMI timestamp="2016-10-03 20:13:08" xmlns:UML="omg.org/UML1.3" xmi.version="1.1">+<XMI.header>--<XMI.content>-<UML:Model name="EA Model" xmi.id="MX_EAID_EB91BB1F_965E_4180_96B6_983A85D53E0A">-<UML:Namespace.ownedElement>-<UML:Class name="R-Type" xmi.id="EAID_92E22597_1970_4db6_903D_5D49EDABABE0" isActive="false" isAbstract="false" isLeaf="false" isRoot="false" namespace="EAPK_EB91BB1F_965E_4180_96B6_983A85D53E0A" visibility="public">-<UML:ModelElement.stereotype><UML:Stereotype name="Instruction"/></UML:ModelElement.stereotype>+<UML:ModelElement.taggedValue>+<UML:Classifier.feature>-----------------------</UML:Class></UML:Namespace.ownedElement></UML:Model><UML:TaggedValue xmi.id="EAID_5870EE46_4501_f145_B554_C49465EDD7A2" tag="Function" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/><UML:TaggedValue value="R-type#NOTES#Values: R-type,I-type,S-type,SB-type,U-type,UJ-type " xmi.id="EAID_81FBE1CB_0A26_730a_934D_F9E4C1591F9C" tag="Instruction Format" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/><UML:TaggedValue xmi.id="EAID_18F47F6E_2E49_a72e_A4AF_23A437402F50" tag="InstructionSet" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/><UML:TaggedValue xmi.id="EAID_034EE602_51FD_c451_9E84_7890EDF68DC5" tag="Length" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/><UML:TaggedValue xmi.id="EAID_0B0F853A_6515_7365_B239_5CC84651A175" tag="OpCode" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>-<UML:Diagram name="RISC-V MDG" xmi.id="EAID_5AE55109_A5EE_4aa0_85B8_139C76326F32" toolName="Enterprise Architect 2.5" owner="EAPK_5AE55109_A5EE_4aa0_85B8_139C76326F32" diagramType="ClassDiagram">+<UML:ModelElement.taggedValue>-<UML:Diagram.element><UML:DiagramElement style="HideIcon=0;DUID=6A3DF6E5;ImageID=0;" seqno="1" subject="EAID_92E22597_1970_4db6_903D_5D49EDABABE0" geometry="Left=470;Top=159;Right=672;Bottom=299;imgL=5;imgT=5;imgR=207;imgB=145;"/></UML:Diagram.element></UML:Diagram></XMI.content><XMI.difference/>+<XMI.extensions xmi.extender="Enterprise Architect 2.5">--</XMI></UMLPattern></UMLPatterns>-<UIToolboxes>-<UMLProfile profiletype="uml2"><Documentation version="1.0" notes="RISC_V_Toolbox" name="RISC_V_Toolbox" id="45E1CDED-3"/>-<Content>-<Stereotypes>-<Stereotype notes="" name="RISC-V Elements" hideicon="0" borderwidth="-1" bordercolor="-1" fontcolor="-1" bgcolor="-1" cy="70" cx="306">+<AppliesTo>--<TaggedValues><Tag name="RISC_V_Primitives::Instruction(UML::Class)" type="int" default="Instruction" values="" unit="" description=""/><Tag name="RISC-V::RISC-V(UMLPatternSilent)" type="int" default="R-Type" values="" unit="" description=""/></TaggedValues></Stereotype></Stereotypes><TaggedValueTypes/></Content></UMLProfile></UIToolboxes></MDG.Technology>
-
Thanks for that Ted,
I popped it into an XML parser and it complained. This version seems to have the correct syntax. You may wish to "compare and contrast". I haven't had a close look, so I can't comment on the content.
<?xml version="1.0"?>
<MDG.Technology version="1.0">
<Documentation version="0" notes="RISC-V" name="RISC-V" id="RISC-V"/>
<UMLProfiles>
<UMLProfile profiletype="uml2"/>
</UMLProfiles>
<UMLPatterns>
<UMLPattern>
<XMI timestamp="2016-10-03 20:13:08" xmlns:UML="omg.org/UML1.3" xmi.version="1.1">
<XMI.header>
<XMI.content>
<UML:Model name="EA Model" xmi.id="MX_EAID_EB91BB1F_965E_4180_96B6_983A85D53E0A">
<UML:Namespace.ownedElement>
<UML:Class name="R-Type" xmi.id="EAID_92E22597_1970_4db6_903D_5D49EDABABE0" isActive="false" isAbstract="false" isLeaf="false" isRoot="false" namespace="EAPK_EB91BB1F_965E_4180_96B6_983A85D53E0A" visibility="public">
<UML:ModelElement.stereotype>
<UML:Stereotype name="Instruction"/>
</UML:ModelElement.stereotype>
<UML:ModelElement.taggedValue/>
<UML:Classifier.feature/>
</UML:Class>
</UML:Namespace.ownedElement>
</UML:Model>
<UML:TaggedValue xmi.id="EAID_5870EE46_4501_f145_B554_C49465EDD7A2" tag="Function" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>
<UML:TaggedValue value="R-type#NOTES#Values: R-type,I-type,S-type,SB-type,U-type,UJ-type " xmi.id="EAID_81FBE1CB_0A26_730a_934D_F9E4C1591F9C" tag="Instruction Format" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>
<UML:TaggedValue xmi.id="EAID_18F47F6E_2E49_a72e_A4AF_23A437402F50" tag="InstructionSet" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>
<UML:TaggedValue xmi.id="EAID_034EE602_51FD_c451_9E84_7890EDF68DC5" tag="Length" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>
<UML:TaggedValue xmi.id="EAID_0B0F853A_6515_7365_B239_5CC84651A175" tag="OpCode" modelElement="EAID_92E22597_1970_4db6_903D_5D49EDABABE0"/>
<UML:Diagram name="RISC-V MDG" xmi.id="EAID_5AE55109_A5EE_4aa0_85B8_139C76326F32" toolName="Enterprise Architect 2.5" owner="EAPK_5AE55109_A5EE_4aa0_85B8_139C76326F32" diagramType="ClassDiagram">
<UML:ModelElement.taggedValue/>
<UML:DiagramElement style="HideIcon=0;DUID=6A3DF6E5;ImageID=0;" seqno="1" subject="EAID_92E22597_1970_4db6_903D_5D49EDABABE0" geometry="Left=470;Top=159;Right=672;Bottom=299;imgL=5;imgT=5;imgR=207;imgB=145;"/>
</UML:Diagram>
</XMI.content>
<XMI.difference/>
<XMI.extensions xmi.extender="Enterprise Architect 2.5"/>
</XMI.header>
</XMI>
</UMLPattern>
</UMLPatterns>
<UIToolboxes>
<UMLProfile profiletype="uml2">
<Documentation version="1.0" notes="RISC_V_Toolbox" name="RISC_V_Toolbox" id="45E1CDED-3"/>
<Content>
<Stereotypes>
<Stereotype notes="" name="RISC-V Elements" hideicon="0" borderwidth="-1" bordercolor="-1" fontcolor="-1" bgcolor="-1" cy="70" cx="306">
<AppliesTo>
<TaggedValues>
<Tag name="RISC_V_Primitives::Instruction(UML::Class)" type="int" default="Instruction" values="" unit="" description=""/>
<Tag name="RISC-V::RISC-V(UMLPatternSilent)" type="int" default="R-Type" values="" unit="" description=""/>
</TaggedValues>
</AppliesTo>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
</Content>
</UMLProfile>
</UIToolboxes>
</MDG.Technology>
Paolo