I'm working on an Intellij (all products: phpStorm, Rider, Idea, etc) plugin to generate code from a data source (database tool window).
I get the needed data like this:
// Get all data sources
ProjectManager pm = ProjectManager.getInstance();
Project[] projects = pm.getOpenProjects();
Arrays.stream(projects).map(project ->
DbPsiFacade.getInstance(project).getDataSources())
.flatMap(Collection::stream).collect(Collectors.toList());
// Get Tables
DasUtil.getTables(source);
// Get columns
DasUtil.getColumns(table);
But I did not find any way to get a list of DbRoutine, which seems to represent the stored procedure.
Anyone knows how to get it?
Thank you
I finally did it using a different method:
DbDataSource dataSource = ...;
dataSource.getModel().traverser().forEach(dasObject ->
{
if (dasObject instanceof DasTable) {
}
else if (dasObject instanceof DasColumn) {
}
else if (dasObject instanceof DasIndex) {
}
else if (dasObject instanceof DasConstraint) {
}
else if (dasObject instanceof DasRoutine) {
}
});