Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PartenaJH

Pages: [1]
1
Just FYI, this is how we did it here (I only have some Java knowledge from yeeeeeaaars ago at school, but it does the trick :) ).

Code: [Select]
import org.sparx.*;

public class valuecircle2html {
  public static void main(String[] args) {
      org.sparx.Repository       repo             =       new org.sparx.Repository();
      org.sparx.Package      corporate      =      null;
      org.sparx.Package      bpm            =      null;
      org.sparx.Package      bpm_vc            =      null;
      org.sparx.Package      vc            =      null;
      org.sparx.Package      pack             =       null;

// Connect to database
      
      String conn      = "SparxEa --- DBType=1;Connect=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SparxEa;Data Source=SS-BXL-DBSQL10";

      repo.OpenFile(conn);

// Browse through structure

      corporate       = repo.GetModels().GetByName("Corporate");
      bpm             = corporate.GetPackages().GetByName("BPM");
      bpm_vc             = bpm.GetPackages().GetByName("BPM Value Circle)");
      vc             = bpm_vc.GetPackages().GetByName("Value Circle");

// Generate HTML Documentation
      
      String guid      = "" + vc.GetPackageGUID() + "";
      String tmppath      = "C:\\Users\\usjolb\\Desktop\\export";
      String image      = "PNG";
      String template = "Value Circle";
      String ext      = ".htm";

      repo.GetProjectInterface().RunHTMLReport(guid, tmppath, image, template, ext);

// Close connection to database

      repo.CloseFile();
  }
}

The connection string is easy to find by right clicking the project in the popup when starting EA.

We have a few models, my required package is in the "Corporate" model, then browsing through a few package directories until you got at the one you would be right clicking on when doing it yourself.

The tmppath is just to publish this locally (afterwards I have a scheduled bat-file that runs the java program and copy pastes the HTML files to our SharePoint).

The template is a copy of the default web template with a few modifications, called "Value Circle".

Hopefully it helps you, I would have been happy to find that kind of script when I was looking for it :)

2
I am currently working on the same topic for my project: we would like to have a nightly HTML generation.

Unfortunately, even though I was searching for "RunHTMLReport"
- I don't find any explanation / examples on the forum neither in the EA Help
- I don't find any related code in the EA installation directory

I do found a little piece of code while searching the net: http://stackoverflow.com/questions/221654/how-to-automate-the-generation-of-html-output-in-enterprise-architect

Hence I was able to create this little script, but I am stuck on the PackageGUID (as now it renders an almost empty webpage and no XML files with content are in the directories). I found the used ID string in the XMI export...
Even using a local file on my C drive does not give me more, so may be the SQL connection string is not correct either as I was not able to test this yet...
FYI, we created a web style template "value chain" as well (4th parameter of the function).

Code: [Select]
import org.sparx.Repository;

public class valuecircle2html {
  public static void main(String[] args) {
     org.sparx.Repository r = new org.sparx.Repository();

     r.OpenFile("SparxEa --- DBType=1;Connect=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SparxEa;Data Source=SS-BXL-DBSQL10");
     r.GetProjectInterface().RunHTMLReport("<packagedElement xmi:type=\"uml:Package\" xmi:id=\"EAPK_3C05F74F_D0A2_4a18_A38B_A32E95896923\" name=\"Value Circle\" visibility=\"public\">", "C:\\Users\\usjolb\\Desktop\\export", "PNG", "Value Circle", ".htm");
     r.CloseFile();
  }
}

Please help!  :-/ :'(

Pages: [1]