Book a Demo

Author Topic: Copy Domain to Class  (Read 4087 times)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Copy Domain to Class
« on: October 05, 2007, 07:15:49 am »
I have a domain object diagram whose evolution is slowing down enough to consider moving on to thinking about implementation.  Because the user is comfortable with class diagrams and the backing information, this diagram is a lot closer to a meaningful class diagram than I suspect is typical of domain object diagrams.  I expected there to be a way for me to copy over the objects to the class diagram in order to add in the inheritance and implementation details, but it isn't being obvious to me how one does that.  Am I missing something?

thomaskilian

  • Guest
Re: Copy Domain to Class
« Reply #1 on: October 05, 2007, 01:30:37 pm »
You could write a transformation to do that for you.

However, it is not unusual to create the class diagram manually as the design might take some brain effort a transofrmation can not do for you ;)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Copy Domain to Class
« Reply #2 on: October 05, 2007, 02:39:19 pm »
Well, I figured I could write one and I did figure the reason it might not be there was the expectation of needing analysis, but in my case it would be a good running head start if I could just copy.

thomaskilian

  • Guest
Re: Copy Domain to Class
« Reply #3 on: October 08, 2007, 01:45:46 am »
Just copy is not that complicated. There are already some transformations you could deploy. I had my class-copy transformation ready within a few hours (including learning the basics of transformation).

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Copy Domain to Class
« Reply #4 on: October 08, 2007, 07:07:39 am »
Well, I suppose it would be good for me ... it just wasn't what I had planned to work on!

thomaskilian

  • Guest
Re: Copy Domain to Class
« Reply #5 on: October 08, 2007, 09:01:50 am »
It's never the way you want it ;D

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Copy Domain to Class
« Reply #6 on: October 08, 2007, 01:01:54 pm »
I believe a class copy transformation is even easier now than it was when Thomas first wrote his.

If you create a new transformation EA will automatically fill the templates with defaults that copy nearly everything.  The only additional thing that you can copy with the transformations is the tags, which you will need to add to the templates manually.  Just add as many of these as needed to any templates.

Code: [Select]
%if classTag:"myTag" != ""%
Tag
{
 name="myTag"
 value=%qt%%classTag:"myTag"%%qt%
}

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Copy Domain to Class
« Reply #7 on: October 14, 2007, 02:38:59 pm »
Turns out it is even easier than that!  Nothing to develop.  When I finally decided that the domain object diagram was settled enough and we were needing the class diagram to generate from, I started reading up on transformation and poking about.  In the process, I did a right click on the package in the Domain Model, check Transform Current Package, selected Java, since that is what we will be implementing in, and off it went.  I suppose that, if I cared in the current round about keeping the Class diagram as PIM, I would have to add that, but for a specific language context, it is already there.

My one question about this process is that under Domain Objects, I have 5 packages defined for the sake of helping mostly to organize the documentation -- Base, Primary, Supporting, Type, and Association.  I generated each of these one at a time.  I created corresponding packages under Base Classes prior to the transformation, intending those to the the targets.  But, what I got instead of my Primary Classes under Primary Classes, for example, was that under the target Primary Class there was Java Model/Domain Objects/Primary Classes.  IT was easy enough to drag the lowest level up to the intended target, but is there a way that one should be doing this to make it come out more tidily?