Author Topic: adding attributes in profiles  (Read 12650 times)

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
adding attributes in profiles
« 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.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: adding attributes in profiles
« Reply #1 on: September 27, 2016, 02:02:19 pm »
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!
« Last Edit: September 27, 2016, 02:24:17 pm by KP »
The Sparx Team
[email protected]

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #2 on: September 28, 2016, 12:09:01 pm »
thanks ... it wasn't obvious

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: adding attributes in profiles
« Reply #3 on: September 28, 2016, 04:41:39 pm »
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
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #4 on: October 03, 2016, 06:13:21 am »
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
« Last Edit: October 03, 2016, 08:26:43 am by Ted Speers »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: adding attributes in profiles
« Reply #5 on: October 03, 2016, 07:27:26 pm »
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

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #6 on: October 04, 2016, 12:10:56 am »
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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: adding attributes in profiles
« Reply #7 on: October 04, 2016, 12:29:59 am »
Ted, the "redeploy your technology" step has to include distributing your pattern xmi to a specific location (I don't remember exactly where)

Geert

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #8 on: October 04, 2016, 03:24:20 am »
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

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #9 on: October 04, 2016, 06:05:22 am »
didn't work

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: adding attributes in profiles
« Reply #10 on: October 04, 2016, 06:45:24 am »
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.

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #11 on: October 04, 2016, 02:24:11 pm »
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.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: adding attributes in profiles
« Reply #12 on: October 04, 2016, 02:38:11 pm »
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:

Code: [Select]
  <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".
« Last Edit: October 04, 2016, 02:41:22 pm by KP »
The Sparx Team
[email protected]

Ted Speers

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: adding attributes in profiles
« Reply #13 on: October 05, 2016, 01:28:09 am »
that works, thanks

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: adding attributes in profiles
« Reply #14 on: October 05, 2016, 10:34:35 am »
that works, thanks
Hi Ted,

That's great!  Just so there's no confusion, can you post a snippet?

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!