Book a Demo

Author Topic: Own defined attribute types  (Read 10782 times)

lex_cz

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Own defined attribute types
« on: June 07, 2005, 06:56:27 am »
Hi,
i am new to EA and i have the following question. In the class diagram i am trying to model some class. Now I want to add some attributes to the class i created. How can I model my own "attribute types" beforehand that I can use in this class diagram ? (I am in the modelling phase, concrete architecture Java, C# or whatever will be decided later).

Because my models are spread accross several packages, I think my attribute types should be declared in some base package that should be included. How to do this ?

Thanks Martin
« Last Edit: June 07, 2005, 09:00:25 am by lex_cz »

Pascal

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Own defined attributes
« Reply #1 on: June 07, 2005, 07:34:28 am »
Hey Martin,

I'm not sure I understand your question... attributes are part of a class, so I'd suggest you add them to the attribute list of the class (press F9 when you've selected the class). Or do you mean something else?

Pascal.

lex_cz

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Own defined attributes
« Reply #2 on: June 07, 2005, 08:41:48 am »
Hi Pascal,
thanks for the fast response. Now I see I made a mistake when formulating my question. I want to create my own "attribute types" not attributes.

I hope the rest of my question becomes clear now.

Regards Martin
PS: I will change my first post accordingly.

Pascal

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Own defined attribute types
« Reply #3 on: June 08, 2005, 12:48:27 am »
Hey Martin,

Now I understand what you mean!  :)

I stereotype my basic attribute types with <<datatype>>. I declare my datatypes in a package that is contained in the package that represents the scope in which I want the datatype to be visible. E.g. in all my logical models I'd like to use the datatypes Date, MonetaryValue and such; I have defined them in a package named "Shared Datatypes" in my "Logical view" package. On a more detailed level I have specified my components, which have their own set of specific attributes. E.g. say you have a "Customer Manager" component; I'll have this in "Customer Manager" package, which contains a "Datatypes" package for all datatypes used by classes within the "Customer Manager" component, like Gender, Zipcode, etc.

Hope this helps!

Pascal.

lex_cz

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Own defined attribute types
« Reply #4 on: June 08, 2005, 01:12:19 am »
Hi Pascal,
thats exactly what i need, thanks ! :D

I looked into EA and I see that stereotype <<datatype>> is not defined by default. How did you define this stereotype (what is its base class, are you using metafile) ?

Martin

Pascal

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Own defined attribute types
« Reply #5 on: June 08, 2005, 01:58:30 am »
Hey Martin,

I defined my attribute stereotypes by creating my own UML modeling profile (see the "Create a UML profile" topic in the help file).

Basically this comes down to this:

  • Create a package (e.g. in the "Custom" package) with stereotype "profile"
  • Insert a custom diagram
  • From the "Profile" toolbox, drag a Metaclass onto the diagram and select the "Class" element
  • From the "Profile" toolbox, drag a Stereotype class onto the diagram and name it "datatype"
  • Create an <<extends>> relation from the stereotype to the Class metaclass
  • Save the diagram
  • Export the package to a UML profile file (XML), by right clicking on the "profile" package and selecting "Save package as UML profile"
  • Switch to the "Resource view", right click on "UML profiles", select "Import profile" and select the XML file you just exported
  • Once imported, you'll have the stereotype avaliable for typing your attributes.


One more thing: next to the <<datatype>> stereotype, I use the <<enumeration>> stereotype for my attribute types to denote this special kind of datatype holding a predefined number of values.

Of course you can also do this the easy way, by using the Configuration/UML/Stereotypes dialog. But I like the UML profile way, since it allows me to manage my own stereotypes in a seperate file.

Hope this helps!

Good luck!

Pascal.
« Last Edit: June 08, 2005, 02:05:27 am by Pascal »

lex_cz

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Own defined attribute types
« Reply #6 on: July 03, 2005, 02:20:44 pm »
Hi Pascal,
it has been some while, thank you for your help. I did as you wrote, an example can be seen here:
http://gforge.eusoft.cz/scm/?group_id=18
(use the "Browse CVS Repository" link on the right)

If you have time to spare, please check it if its correct ?

Thank you
Martin

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Own defined attribute types
« Reply #7 on: July 03, 2005, 07:50:51 pm »
Quote
Hey Martin,

I defined my attribute stereotypes by creating my own UML modelling profile (see the "Create a UML profile" topic in the help file).

[SNIP]

Pascal.
Hi Pascal,

I haven't got into Profiles as yet - for the present they don't seem to give me very much I can use at the current stage I'm at with my models.  [Not a criticism of EA, just an observation of where I am in relation to the questions I'm about to ask]

Do I understand correctly, that a profile gives you the ability to predefine a stereotyped element with preexisting tagged values (derived from attributes tab in the original extending stereotype) and constraints (derived from the constraints tab of the extending stereotype)?

You can merge a new definition of the stereotype with existing definitions.

Since I'm not yet using tagged values, this doesn't seem to give me much over simply stereotyping the original element.  Or have I missed something?

Also, does this work with multiple stereotypes?  Have you confirmed it does?  (Particularly if the profiled stereotype is not the primary one?)

If I correctly stereotype my elements and later create profiles, can I use the merge mechanism to add the profilable features to my existing elements using the profile merging mechanism?

Do you have any idea what the <Redefinitions/> clause is used for in the actual profile XML?

Cheerz,
Paolo


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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Own defined attribute types
« Reply #8 on: July 03, 2005, 08:57:52 pm »
I've just had a look at the UML 2 Superstructure specification and it seems to me that the current EA rendering of an «Extension» association is incorrect.  The open arrow should be a closed, blocked in, arrow.

Cheerz,
Paolo
« Last Edit: July 04, 2005, 03:18:34 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

thomaskilian

  • Guest
Re: Own defined attribute types
« Reply #9 on: July 04, 2005, 02:00:58 am »

thomaskilian

  • Guest
Re: Own defined attribute types
« Reply #10 on: July 04, 2005, 02:05:33 am »
Quote
Do I understand correctly, that a profile gives you the ability to predefine a stereotyped element with preexisting tagged values (derived from attributes tab in the original extending stereotype) and constraints (derived from the constraints tab of the extending stereotype).

Yes. That's correct. I use that for Issue and Bug elements. When I drag them from my profile I receive elements with a predefined set of Tags (e.g. Responsible, History, DateDue, etc.). I have some macros that use these Tags to produce reports. I just started using profiles, but they are very handy.

Pascal

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Own defined attribute types
« Reply #11 on: July 04, 2005, 04:03:16 am »
Hi Martin,

I checked your profile: that's indeed the way I do it. (I wasn't able to open your EAP file, BTW).

Paolo, I've only used the profiles for managing my custom stereotypes so far.  I haven't used it for setting default properties, for example.

Thomas, I'd be interested to know how you define default tagged values in your profiles in such a way that, when you drag the item from your profile, the tagged values are also included in the new instance. I've tried this with a stereotype I created for a use case, but the only I only managed to set a number of default constraints in the profile (and no tagged values, for example).

Pascal.

thomaskilian

  • Guest
Re: Own defined attribute types
« Reply #12 on: July 04, 2005, 04:53:02 am »
Pascal,
send me your e-mail via private message and I send you my model containing the profile.

Regarding "opening the model": maybe you have to use the Jet4-option?

lex_cz

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Own defined attribute types
« Reply #13 on: July 04, 2005, 10:44:05 am »
Hi Pascal,
thanks for the check. Can you please describe the error when opening .EAP file so i can contact SPARX ?

Question on others reading this topic: Anyone else having problems opening the .EAP ?

BTW, it was created with EA Professional Edition 5.00.765

Martin