Author Topic: Export / Import - or Copy CodeGen Templates?  (Read 4530 times)

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Export / Import - or Copy CodeGen Templates?
« on: January 17, 2013, 12:30:59 pm »
Hi again,

1. Is it possible to somehow export a CodeGen Template to disk?
2. Is it possible to copy an existing CodeGen Template (as to start from when customizing my own)?
3. Is a "Profile" the way to go to make any custom CodeGen Templates available at any time ? (It looks like it stores my CodeGen Templates only in the model in which I created them. Is that correct?)

// Rolf Lampa
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #1 on: January 17, 2013, 12:55:14 pm »
Ok, I found the answer, or the menu, for exporting the Code Templates:

Project > Model Import/Export > Export Reference Data

Then look up the row "Model Data Types - Code and DDL" and tick the  checkboxes for desired Template languages to export / import.

// Rolf Lampa
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #2 on: January 18, 2013, 06:45:02 pm »
Hm, unfortunately the templates themselves are not exported, only some variable definitions it seems.  

Is there a way to save into one file the numerous templates I've already designed, or do I really have to move the whole set of templates one by one by hand?

// Rolf Lampa
-- There's always a solution --

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7736
  • Karma: +103/-18
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #3 on: January 21, 2013, 08:26:48 am »
Go a bit further down the list. You'll find '<Language> Code Template'.

Also look at Code Modules in MDG Technologies.
Eve

support@sparxsystems.com

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #4 on: January 21, 2013, 11:19:35 am »
Quote
Go a bit further down the list. You'll find '<Language> Code Template'.
Ah, there it is. How could I miss that? Well, I could. Sorry about that.

But not only that. Unfortunately it seems to be too late for this file because when I tried to open that very model a moment ago, the EA fileopen dialog throws an error saying "An error has occured: Unrecognized database format '<filename>.eab'".  There goes many hours of work...?   
Q1: How can I figure out what "database format" EA expects in order to open the file?

As for my second question (about existing CodeGen Templates) the documentation doesn't give any hints, and they do unfortunately not show up in the aforementioned export list.

Q2: I take that as meaning  that I can not copy an existing (ea shipping) language template to start from?

Regards,
// Rolf Lampa
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12841
  • Karma: +367/-296
  • I'm no guru at all
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #5 on: January 21, 2013, 10:50:41 pm »
The database format is MS Access. You can open EAP files with Access directly.

I have currently no idea about the EAB. Maybe you can look into it with notepad++ ?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11851
  • Karma: +460/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Export / Import - or Copy CodeGen Templates?
« Reply #6 on: January 21, 2013, 11:25:08 pm »
.EAB is a branch file, it allows for easier importing/exporting xmi files.

Geert

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #7 on: January 22, 2013, 03:06:03 am »
Quote
The database format is MS Access. You can open EAP files with Access directly.

Yess! that did the trick. Opening the eap file with Access 2010 suggested repair, which I was bold enough to accept (...) and off we went. I now can view & edit the file again without any problems.  [smiley=thumbsup.gif]

Thanks again. What would I do without you guys?

Regards,
// Rolf Lampa
« Last Edit: January 22, 2013, 03:27:13 am by Rolf_Lampa »
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #8 on: January 22, 2013, 03:41:17 am »
Quote
Go a bit further down the list. You'll find '<Language> Code Template'.
Now when I managed to open the model again and try to export the templates (which I now find by name) I get only the following output in the exported file:

<?xml version="1.0" encoding="windows-1252"?>
<RefData version="1.0" exporter="EA.25">
</RefData>

Thus it seems like I still can't export the templates. This must be a bug?

Using EA10 on a vmware XP (sp3) on a win7 machine.

Regards,
// Rolf Lampa
-- There's always a solution --

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #9 on: January 22, 2013, 03:49:13 am »
Quote
Using EA10 on a vmware XP (sp3) on a win7 machine.
I also tried exporting from the "mother machine" (the win7 host) which (still) has a EA9.3 installed, and that version could export my customized templates.

So I guess there is a reason to have the testers looking at it. Either something broke the export in version 10 or there's some spooky things going on in vm-machines.

// Rolf Lampa
« Last Edit: January 22, 2013, 03:51:15 am by Rolf_Lampa »
-- There's always a solution --

qwerty

  • EA Guru
  • *****
  • Posts: 12841
  • Karma: +367/-296
  • I'm no guru at all
    • View Profile
Re: Export / Import - or Copy CodeGen Templates?
« Reply #10 on: January 22, 2013, 05:13:44 am »
Quote
Opening the eap file with Access 2010 suggested repair
You can also do that with EA (Tools/Data Management/Manage.../Repair...). Silly though you have to open a dummy EAP to access this menu :-X

q.