Author Topic: Code Generation Template  (Read 4896 times)

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Code Generation Template
« on: September 13, 2012, 07:33:35 pm »
Hello,

I would like to ask how can I call my user defined template from Class or Attribute templates for example. I tried %myTemplate%, but it did not worked.

Thanks.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #1 on: September 13, 2012, 08:06:47 pm »
That's the way it is supposed to 'call' templates. I guess there's either something wrong inside your template or the path where it's called is not reached. Did you try something simple 1st (as just outputtting some comment text)?

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #2 on: September 13, 2012, 09:39:31 pm »
I see. The Code inside the template is fine, but when I'm putting it inside the custom template it looks like the template was not called at all. How can I check the pass or what ever can I check?

Thanks.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #3 on: September 13, 2012, 10:39:06 pm »
Type of master (calling) template and custom template need to match.
What did you try? Executing the code directly in the master template works, but replacing it with %custom_template% doesn't? Can you show (excerpts) of the template code?

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #4 on: September 13, 2012, 10:45:49 pm »
From class template I call my custom template:

%Class_DDlCLASSG%.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #5 on: September 14, 2012, 12:56:41 am »
Can you show a bit more please, that's not helpful for an analysis (use code formatting for your post).
Although I can see that template types seem to be correct.
« Last Edit: September 14, 2012, 12:57:50 am by g.makulik »
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #6 on: September 14, 2012, 01:07:28 am »
%if classStereotype == "Error" %
%Class_DDLFROMCLASS%
CREATE TABLE %qt%%CONVERT_NAME(className, "Pascal Case","Camel Case")%%qt%
(\n
%list="Attribute" @separator="\n" @indent="  "%
)GO
%endTemplate%
%ClassNotes%
%PI=" "%
%ClassDeclaration%
%ClassBody%

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #7 on: September 14, 2012, 03:00:23 am »
So do you see the follow up statements after
Code: [Select]
%Class_DDLFROMCLASS% as expected? Can you show, what you've got inside your custom template?
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Code Generation Template
« Reply #8 on: September 14, 2012, 08:29:31 am »
Double underscore.

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #9 on: September 14, 2012, 09:23:45 pm »
Thanks Simon, I didn't spot that. I rarely use custom templates if it can be avoided.
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: Code Generation Template
« Reply #10 on: September 20, 2012, 12:00:09 am »
Ooh, I see. That's my mistake.

Thanks for everybody.