Book a Demo

Author Topic: Automatic RTF generation with Java API  (Read 4056 times)

Albert De La Fuente

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Automatic RTF generation with Java API
« on: April 18, 2012, 06:50:00 am »
Hi,

I'm quite new to EA and it's API.

I'm working in a quite big project that has several teams involved, and we would like to generate on a daily basis the updated documentation in both RTF and HTML format and publish it on our internal systems.

What I thought is to generate several RTF templates for each report type we want, and after do something like:

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            String guid, out;
            org.sparx.Repository r = new org.sparx.Repository();
            
            System.out.println("Repository: " + args[0]);
            System.out.println("Package:    " + args[1]);
            System.out.println("Output:     " + args[2]);
            r.OpenFile(args[0]);
          
            guid = r.GetProjectInterface().GUIDtoXML(args[1]);


             r.GetProjectInterface().RunReport(guid, "default-requirements", args[2]);
             r.CloseFile();
      }

My doubt comes with the second parameter or RunReport, is it an internal EAP report, or an external one (Ex: C:\EA-reports\test.rtf). Perhaps this is a really basic question but I couldn't find anything about it nor examples, so any help would be appreciated.

Is it possible to do so using external reports? The idea is to use different templates through the command line (args[3])

Thanks a lot

Ian E Mitchell

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Automatic RTF generation with Java API
« Reply #1 on: April 23, 2012, 11:37:48 pm »
If you are this serious about producing documentation out of EA, have a look at eaDocX - lots of options for creating documents.
eaDocX - Document Generator for EA -  http://www.eadocx.com

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Automatic RTF generation with Java API
« Reply #2 on: April 24, 2012, 08:37:15 am »
I see no reason why you can't do what you're doing.

The template name is the list of templates available to EA. There are two sources for these. Those available in the model or those available from MDG Technologies.

I assume that you'll be running this application once for every document you want to run. You may find in that case that it will be more efficient to just code the exact templates into the application so it doesn't need to start EA and open the model for each one.

Alternatively, have a look at Resource Documents, which allow batch generation of documents to specific filenames.