2

Does PowerDesigner have an Java/Python etc. API that can be called so that I can retrieve a physical table's columns and data types programmatically?

Googling did not help me locate a documentation and possibly a tutorial.

Any directions would me extremely helpful.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

3

The basic API for PowerDesigner uses OLE Automation.

This API is readily accessible from VBScript, .NET languages, PowerShell...

PowerDesigner comes with a helper jar named pdj2com*.jar.

You should have a JavaProxy.doc under the Java Samples sub-directory, with instructions to use this jar.

The code looks like this, from the example for the creation of an Object-Oriented Model:

import org.eclipse.swt.internal.ole.win32.COM;
import com.sybase.stf.powerdesigner.PdCommon.*;
import com.sybase.stf.powerdesigner.PdOOM.*;

int hr = COM.OleInitialize(0);
Application pdApp = Application.getInstance();
Model newModel = new Model(pdApp.CreateModel(PdOOM_Classes.cls_Model, "|Language=Java|Diagram=ClassDiagram"));
newModel.SetName("Customer Management");
newModel.SetCode("CustomerManagement");
com.sybase.stf.powerdesigner.PdOOM.Class newClass = new com.sybase.stf.powerdesigner.PdOOM.Class(newModel.GetClasses().CreateNew());
newClass.SetName("Customer");
newClass.SetCode("Customer");
pascal
  • 3,287
  • 1
  • 17
  • 35