问题
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.
Best regards.
回答1:
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");
来源:https://stackoverflow.com/questions/59138659/does-sap-powerdesigner-have-an-api