Book a Demo

Author Topic: Automating and Scheduling HTML Report Generation  (Read 5764 times)

perry

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Automating and Scheduling HTML Report Generation
« on: August 26, 2009, 06:34:23 am »
Has anyone come up with a way to automate the HTML report generation in EA?
I've made a little visual basic app that can automatically generate the output, but it can't really be run as a scheduled task on a server (it requires a user to be logged into a desktop/remote-desktop in order to run - i think this is because it works mostly by sending key strokes to EA).
I need a way to generate the HTML report daily and automatically.
Any input is very much appreciated.

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: Automating and Scheduling HTML Report Generati
« Reply #1 on: August 26, 2009, 06:03:20 pm »
I have set up such a scenario in JAVA.
A Java process is running on a machine installed with EALite (which requires no extra license).
The process wakes up at night, opens the repository, logs in and calls the RunReport method on several projects.

That's it. Works like a charm. The machine can be any machine with access to the model repository, even a terminal server.

HTH

Oliver

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #2 on: August 26, 2009, 06:28:15 pm »
Quote
...
A Java process is running on a machine installed with EALite (which requires no extra license).
The process wakes up at night, opens the repository, logs in and calls the RunReport method on several projects.

...
Just to be clear Oliver...

Instead of starting EA.exe you start EALite.exe.

When EALite starts, you can connect in the the normal manner for Automation and (presumably) so long as you don't try to write anything, the automation works as expected.

Any chance of a snippet to demonstrate that?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

perry

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #3 on: August 27, 2009, 01:20:08 am »
Could I have some help with implementing the "RunHTMLReport" Method? Sorry, I'm a little clueless on this.

RunHTMLReport (string PackageGUID, string ExportPath, string ImageFormat, string Style, string Extension)

I'm just looking to open the project, and spit out the html report:

Code: [Select]
class report
{
   public static void main(String[] args)

   {
      org.sparx.Repository r = new org.sparx.Repository();
      r.OpenFile("c:\\server\\EA\\project.eap");

      ??? RunHTMLReport ("Model", "C:\\server\\auto\\map", "PNG", "<default>", ".html"); ???
   }
}


perry

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #4 on: August 27, 2009, 02:54:24 am »
OK, so I've gotten a little further.
Code: [Select]
class report
{
   public static void main(String[] args)

   {
      org.sparx.Repository r = new org.sparx.Repository();
      r.OpenFile("c:\\server\\EA\\project.eap");
      org.sparx.Project pi = r.GetProjectInterface();

      Object obj =  r.GetTreeSelectedObject();

      if (obj!=null)
      {
      pi.RunReport (obj.ElementGUID,"Model","c:\\temp.rtf");
      }
   }
}

In order to give that first argument to RunReport, should I be trying to get something back from r.GetTreeSelectedObject() and then finding its ElementGUID?
If so, what sort of Object does r.GetTreeSelectedObject() return?
If not, what do I need for that first argument?

Thanks.

perry

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #5 on: August 27, 2009, 05:28:18 am »
Got it!
This is generating an HTML report:

Code: [Select]
import org.sparx.Project;
public class reportGen {
      public static void main(String[] args)
         {
            org.sparx.Repository r = new org.sparx.Repository();
            r.OpenFile("c:\\server\\EA\\server project\\serverProject.eap");
            org.sparx.Project pi = r.GetProjectInterface();
            String id1 = r.GetProjectGUID();        
          
            pi.RunHTMLReport(id1, "C:\\server\\auto\\map", "PNG", "<default>", ".htm");
         }
}

Now I need a way to do the equivalent of a "Get All Latest" via the automation interface... I'll start a new topic.

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: Automating and Scheduling HTML Report Generati
« Reply #6 on: August 27, 2009, 05:50:34 pm »
Quote
Just to be clear Oliver...

Instead of starting EA.exe you start EALite.exe.

When EALite starts, you can connect in the the normal manner for Automation and (presumably) so long as you don't try to write anything, the automation works as expected.

Any chance of a snippet to demonstrate that?

You can use EALite in the same way for automation as EA full. I am not 100% sure but as far as I remember you can even create baselines and perform write operations.
EALite is perfect for daemons performing actions on regular tasks. No need to waste a license for a computer on which nobody is physically working.

Oliver

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #7 on: August 27, 2009, 06:25:03 pm »
Quote
You can use EALite in the same way for automation as EA full. I am not 100% sure but as far as I remember you can even create baselines and perform write operations.
EALite is perfect for daemons performing actions on regular tasks. No need to waste a license for a computer on which nobody is physically working.

Oliver
COOOOOL!  Thanks for that! (My emphasis).

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

perry

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Automating and Scheduling HTML Report Generati
« Reply #8 on: September 04, 2009, 02:18:38 am »
I am having trouble with scheduling the report generator.
I have exported it as a runnable jar and I have written a batch file that runs it.
Then I scheduled it to run via windows Scheduled Tasks. If I am logged into the server (through remote desktop), the task executes just fine and the report is generated.
BUT I don't want to have to be logged in. If I log out and schedule the task to execute while I am logged out, it crashes. The next time I log back in, I see "Enterprise Architect - UML CASE Tool encountered a problem and needed to close"

Any suggestions?

Thanks a lot!