Author Topic: Include requirements into source code generation  (Read 3854 times)

SvenHerbold

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Include requirements into source code generation
« on: April 27, 2006, 08:01:59 am »
Hi everbody,

I already have searched the forum but haven't found anything regarding my problem.

I have a class model and a requirements model, which is in fact a list of requirements taken from the functional concept. I have assigned some of the requirements to some of the classes, e.g. Class1 realizes Requirement1.

I now want to include the name of the requirement into the Class Notes template of the source code generation in order to have the requirements included in the javadoc.

I tried a lot but wasn't able to get the requirements into my soure code. Hopefully you can help.

Thanks and best regards,
Sven
« Last Edit: April 28, 2006, 02:55:29 am by SvenHerbold »

Hans

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: Include requirements into source code generati
« Reply #1 on: May 01, 2006, 12:43:56 pm »
Hi Sven,

that's a great idea: having requirements printed out in source code. For this, you'll need to customize the templates.
Although I myself are seeking the function, te idea will be to scan all realtionships ans filter out all requirements. Once you'll have these, they could be printed out.

Regards
Hans

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Include requirements into source code generati
« Reply #2 on: May 04, 2006, 03:38:50 pm »
Hi,

It should be possible to edit the class notes template to do this.  You could either add a call to an addin, or list over all appropriate connectors.

Class Notes
Code: [Select]
$notes=%WRAP_LINES(classNotes,genOptWrapComment," * ")%
$notes+="\n" + %list="Connector__Requirements" @separator="\n" @indent=" * " connectorType=="Realisation"%
$notes=%TRIM($notes)%
%if $notes!=""%
/*
$notes
*/
%endIf%

Connector__Requirements
Code: [Select]
@requirement %connectorDestElemName%
%WRAP_LINES(connectorDestElemNotes,genOptWrapComment,"   ")%

What that doesn't do is filter out realizations to elements other than requirements, or anything realizing the current class.

The EXEC_ADD_IN solution may be a bit more work to set up, but if you're not fond of the code templates, may be your preferred solution.

Anyway, I hope that helps.

SvenHerbold

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Include requirements into source code generati
« Reply #3 on: May 05, 2006, 07:39:19 am »
Hi Simon,

thanks a lot for your great assistance :D. I have tried your template suggestion and it worked pretty fine, but as you already mentioned, it doesn't filter out the requirements, which is vital for us. Anyway it helped a lot to understand the usage of code templates.
I'm now using the EXEC_ADD_IN solution, which indeed was a bit more work to set up. But in the end I got it running and now I'm very happy to be promoted to an E.A.S.E. (Enterprise Architect System Expert) by my company ;).
I will post the solution to the sharepoint, as it might be of interest to other users as well.

Thanks again for your help and have a nice weekend.
Best regards,
Sven

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Include requirements into source code generati
« Reply #4 on: May 07, 2006, 05:10:36 pm »
Glad to help.

Just so you know, I'm adding in two macros (probably for 6.5) that will mean this can be done entirely within the templates.  The list I included before would just need an extra condition added.

Code: [Select]
%list="Connector__Requirements" @separator="\n" @indent=" * " connectorType=="Realisation" and connectorSourceElemGUID==classGUID and connectorDestElemType=="Requirement"%
« Last Edit: May 07, 2006, 05:11:02 pm by simonm »