Author Topic: MDG: how to set class attributes default scope = public? (_AttPub not working)  (Read 357 times)

Richard Freggi

  • EA User
  • **
  • Posts: 42
  • Karma: +1/-1
    • View Profile
I created a MDG toolbox for regular class diagram.  In the profile metaclass I added an attribute _AttPub, type int, initial value 1 (following the MDG technologies user guide on page 43).  When MDG deployed everything works except when I add an attribute to the class using this toolbox, the attribute scope is Private by default. 

The MDG XML file is below.  My goal is to have all attributes scope set to public by default whenever I create a new attribute in a class.  Any help appreciated!
(p.s. crosspost notice: in separate post I'm asking for help to get attribute creation via toolbox)

Code: [Select]
<?xml version="1.0" encoding="windows-1252"?>
<MDG.Technology version="1.0"><Documentation id="0730" name="RFClass0730MDG" version="0730" notes="0730"/><DiagramProfile><UMLProfile profiletype="uml2">
<Documentation id="8B780C68-B" name="RFClass" version="1.0" notes="RFClass"/>
<Content>
<Stereotypes>
<Stereotype name="RFClassDiagram" notes="">
<AppliesTo>
<Apply type="Diagram_Logical">
<Property name="alias" value="RFClass"/>
<Property name="toolbox" value="RFClass"/>
<Property name="diagramID" value="RFClass"/>
</Apply>
</AppliesTo>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
</Content>
</UMLProfile>
</DiagramProfile><UIToolboxes><UMLProfile profiletype="uml2">
<Documentation id="CABB778E-B" name="RFClass0730" version="1.0" alias="RFClass0730" notes="RFClass0730"/>
<Content>
<Stereotypes>
<Stereotype name="RFClassElements" alias="RFClassElements" notes="RFClassElements">
<AppliesTo>
<Apply type="ToolboxPage">
<Property name="_AttPub" value="1"/>
</Apply>
</AppliesTo>
<TaggedValues>
<Tag name="UML::Package" type="" description="" unit="" values="" default="Package"/>
<Tag name="UML::Class" type="" description="" unit="" values="" default="Class"/>
<Tag name="UML::Attribute" type="" description="" unit="" values="" default="Attribute"/>
<Tag name="UML::Operation" type="" description="" unit="" values="" default="Operation"/>
</TaggedValues>
</Stereotype>
<Stereotype name="RFClassConnectors" alias="RFClassConnectors" notes="RFClassConnectors">
<AppliesTo>
<Apply type="ToolboxPage">
<Property name="_AttPub" value="1"/>
</Apply>
</AppliesTo>
<TaggedValues>
<Tag name="UML::Association" type="" description="" unit="" values="" default="Association"/>
<Tag name="UML::AssociationClass" type="" description="" unit="" values="" default="AssociationClass"/>
<Tag name="UML::Generalization" type="" description="" unit="" values="" default="Generalization"/>
<Tag name="UML::Aggregation" type="" description="" unit="" values="" default="Aggregation"/>
<Tag name="UML::Composition" type="" description="" unit="" values="" default="Composition"/>
<Tag name="UML::Dependency" type="" description="" unit="" values="" default="Dependency"/>
<Tag name="UML::Realization" type="" description="" unit="" values="" default="Realization"/>
<Tag name="UML::Nesting" type="" description="" unit="" values="" default="Nesting"/>
</TaggedValues>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
</Content>
</UMLProfile>
</UIToolboxes></MDG.Technology>

Richard Freggi

  • EA User
  • **
  • Posts: 42
  • Karma: +1/-1
    • View Profile
 BUMP!  Anyone has ideas?  Thanks!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2436
  • Karma: +29/-2
    • View Profile
_AttPub has no meaning in a Toolbox Profile.

Use _AttPub in a UML Profile. If you have a stereotype that extends Class (for example), you might set _AttPub to "0" in order to hide all public attributes owned by the stereotyped Class (by default, EA shows all attributes).
The Sparx Team
support@sparxsystems.com

Richard Freggi

  • EA User
  • **
  • Posts: 42
  • Karma: +1/-1
    • View Profile
Thank you KP.  I understand the point of _AttPub not being relevant to a toolbox profile.  So I would need to extend a class to have the characteristics that I want, then add the extended class to the toolbox.  But how to extend class so that the default scope for its attributes (and operations too) is public instead of EA default of private?  Thanks!!!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2436
  • Karma: +29/-2
    • View Profile
But how to extend class so that the default scope for its attributes (and operations too) is public instead of EA default of private?

There is no setting for this. The only solution would be to write an add-in that implements the EA_OnPostNewAttribute broadcast handler.
The Sparx Team
support@sparxsystems.com