Hi,
I'm trying to build a program that iterates trough all the packages, elements and diagrams using Java EA API.
I found some python code that does something similar, ideally I would like to translate that code to Java but I'm not able to find some properties. Here are some Python snippets that I need to run on Java.
def DumpRepository(Earepository):
print "-- Repostitory --"
print "Instance GUID: ", Earepository.InstanceGUID
print "ConnectionString: ", Earepository.ConnectionString
print "Library version: ", Earepository.LibraryVersion
print
print "Model count: ", Earepository.Models.Count
print "Terms count: ", Earepository.Terms.Count
print "Issues count: ", Earepository.Issues.Count
print "Author count: ", Earepository.Authors.Count
print "Client count: ", Earepository.Clients.Count
print "Task count: ", Earepository.Tasks.Count
print "Datatypes count: ", Earepository.Datatypes.Count
print "Recource count: ", Earepository.Resources.Count
print "Stereotype count: ", Earepository.Stereotypes.Count
print "PropertyType count: ", Earepository.PropertyTypes.Count
print
def expand_diags(diagrams, indent):
for i in xrange(0, diagrams.Count):
diagram = diagrams.GetAt(i)
print (" " * indent) + "Diagram ID: " + `diagram.DiagramID` + "\t" + diagram.Name
def expand_elems(elements, indent):
for i in xrange(0, elements.Count):
element = elements.GetAt(i)
print (" " * indent) + "Element ID: " + `element.ElementID` + "\t" + element.Name
def expand_pkgs(packages, indent):
for i in xrange(0, packages.Count):
package = packages.GetAt(i)
if 'p' in opts:
print (" " * indent) + "Package ID: " + `package.PackageID` + "\t" + package.Name
if 'd' in opts:
expand_diags(package.Diagrams, indent + 1)
if 'e' in opts:
expand_elems(package.Elements, indent + 1)
innerpkg = package.Packages
if innerpkg.Count > 0:
expand_pkgs(innerpkg, indent + 1)
Does anyone can please help me with something similar? I couldn't find similar examples on Java. I'm running this code and I always get NullPointerException:
public void run (String[] args) throws Exception
{
inputFile = "C:\\EA\\siga.EAP";
org.sparx.Repository r = new org.sparx.Repository();
r.OpenFile(inputFile);
out.println("-- Repostitory --");
out.println("Models Count: " + r.GetModels().GetCount());
Thanks a lot for your help.