Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: SvenHerbold 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
-
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
-
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 $notes=%WRAP_LINES(classNotes,genOptWrapComment," * ")%
$notes+="\n" + %list="Connector__Requirements" @separator="\n" @indent=" * " connectorType=="Realisation"%
$notes=%TRIM($notes)%
%if $notes!=""%
/*
$notes
*/
%endIf%
Connector__Requirements @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.
-
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
-
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.
%list="Connector__Requirements" @separator="\n" @indent=" * " connectorType=="Realisation" and connectorSourceElemGUID==classGUID and connectorDestElemType=="Requirement"%