Author Topic: Batch Mode for HTML Report Generation  (Read 6119 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Batch Mode for HTML Report Generation
« on: June 05, 2009, 07:43:50 am »
Hi!


I'd like to set EA up to generate a nightly HTML snapshot of a model.

Can I?

In other words, is there a batch mode? Shot in the dark, but worth the powder.

If not, is there another simple way to achieve this? Maybe an EA command-line option? If I wrote this in the Automation Interface, how hard would it be? Would I need to recreate the html page layout manually?

My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8067
  • Karma: +118/-20
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #1 on: June 05, 2009, 08:10:06 am »
From the automation it would go something like this:

Create an instance of EA.
Get the Repository.
Repository.OpenFile()
Repository.GetProjectInterface().RunHTMLReport().
Close model, EA.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #2 on: June 08, 2009, 06:21:54 am »
Hi again,


Thanks! Just what I wanted.

Except it doesn't work. When I open up the resulting index.html, I get an error message saying "Access to restricted URI denied" (NS_ERROR_DOM_BAD_URI).
The same report generated from the EA GUI works perfectly.

I'm using the Java API.
Code: [Select]
void GenerateReports(String repositoryFile, String reportRootDir) {
      repository = new Repository();
      repository.OpenFile(repositoryFile);
      Project projectInterface = repository.GetProjectInterface();

      Collection<Package> models = repository.GetModels();
      Iterator<Package> modelIterator = models.iterator();
      Package model;

      while (modelIterator.hasNext()) {
            model = modelIterator.next();
            File reportDir = new File(reportRootDir, model.GetName());
            reportDir.mkdirs();
            projectInterface.RunHTMLReport(projectInterface.GUIDtoXML(model.GetPackageGUID()),
                                           reportDir.getPath(), "PNG", "", ".html");
      }

      repository.CloseFile();
}
Am I missing something?

Cheers

/Uffe
« Last Edit: June 08, 2009, 11:35:11 am by Uffe »
My theories are always correct, just apply them to the right reality.

benjaminK

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #3 on: June 12, 2009, 09:01:18 pm »
Hey Uffe,

I have the same problem with a VB Script.
And if I switch to RTF generation, the script will be executed without errors but generate nothing (BUT in the background you can see the pop-up dialog of the Report Generator for a half a second) I guess it might be the same problem?

Have you already found a solution?

My code looks like that:

Code: [Select]
 Dim MyRep As New EA.Repository
        Dim MyPro As New EA.Project
        Dim GUID As String

        MyRep.OpenFile("C:\temp\EA\Basissoftware_neu.EAP")
        MyPro = MyRep.GetProjectInterface()

        'GUID of one ExamplePackage
        GUID = MyPro.GUIDtoXML("F2E27D9F-85F6-466d-B0F3-3E434C036C1C")

        'MyPro.RunReport(GUID, "Template_MDD", "C:\temp\crc16.rtf")
        MyPro.RunHTMLReport(GUID, "C:\temp\generatedHTML", "PNG", "<default>", ".htm")
        MyRep.CloseFile()

Many Thanks

raymix

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #4 on: June 18, 2009, 02:15:10 am »
Hi all,

I have the same problem with RTF reports.

Any news regarding this issue?

rinia

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #5 on: July 18, 2009, 12:33:56 am »
Hi,

is there any solution for this issue?

Furthermore, I want to open a DBMS repository. Can I do that with the OpenFile method of the Repository object?

Additionally, is it possible to run an add-in after opening a repository? How can I do that?

Regards,
Andreas

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: Batch Mode for HTML Report Generation
« Reply #6 on: July 18, 2009, 01:10:26 am »
Quote
Hi,

is there any solution for this issue?

Furthermore, I want to open a DBMS repository. Can I do that with the OpenFile method of the Repository object?

Additionally, is it possible to run an add-in after opening a repository? How can I do that?

Propably you can do all this but remember one thing: The scripts are all operating on a currently open repository (like an add-in).
If you open a new instance of EA (with the OpenFile method) it will consume memory and I have no idea how well it will separate the instances. So expect some interesting effects in the worst case.

Oliver

rinia

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #7 on: July 18, 2009, 02:23:06 am »
Hi Oliver,

thx for the response. I am keeping this in my mind.

Now I have tried it opening a DBMS repository from command line with this VBScript:
Code: [Select]
Dim MyRep ' As New EA.Repository
Dim MyPro ' As New EA.Project
Dim GUID ' As String
 
Set MyRep = CreateObject("EA.Repository")
 
MyRep.OpenFile("dddd --- DBType=1;Connect=Provider=SQLOLEDB.1;Password=password;Persist Security Info=True;User ID=EADBUser;Initial Catalog=CCCC;Data Source=host,6200")
 Set MyPro = MyRep.GetProjectInterface()

but now I get a small login dialog with EADBUser. I have to click ok and then it works fine but I want to run the script in batch  :( Therefore, how can I suppress this dialog?

Additionally, how can I call an add-in from this script?

Andreas

Jan S

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Batch Mode for HTML Report Generation
« Reply #8 on: September 25, 2009, 10:23:12 pm »
Hi,
The error message "Access to restricted URI denied" can be avoided by incrementing the index of tocTab at line 685 in the template for displayToc.js

Code: [Select]
tocLoadData(tocTab[1][7].substring(1,tocTab[1][7].length-1)+".xml");
/Jan