use of org.jkiss.dbeaver.model.edit.DBERegistry in project dbeaver by dbeaver.
the class DBStructUtils method generateObjectDDL.
public static String generateObjectDDL(@NotNull DBRProgressMonitor monitor, @NotNull DBSObject object, Map<String, Object> options, boolean addComments) throws DBException {
final DBERegistry editorsRegistry = object.getDataSource().getContainer().getPlatform().getEditorsRegistry();
final SQLObjectEditor entityEditor = editorsRegistry.getObjectManager(object.getClass(), SQLObjectEditor.class);
if (entityEditor != null) {
SQLObjectEditor.ObjectCreateCommand createCommand = entityEditor.makeCreateCommand(object, options);
DBEPersistAction[] ddlActions = createCommand.getPersistActions(monitor, DBUtils.getDefaultContext(object, true), options);
return SQLUtils.generateScript(object.getDataSource(), ddlActions, addComments);
}
log.debug("Object editor not found for " + object.getClass().getName());
return SQLUtils.generateCommentLine(object.getDataSource(), "Can't generate DDL: object editor not found for " + object.getClass().getName());
}
Aggregations