use of org.kie.workbench.common.screens.datasource.management.model.DeploymentInfo in project kie-wb-common by kiegroup.
the class DataSourceDefQueryServiceImpl method findGlobalDataSources.
@Override
public Collection<DataSourceDefInfo> findGlobalDataSources(boolean includeUnManaged) {
Collection<DataSourceDefInfo> result = resolveDataSources(serviceHelper.getGlobalDataSourcesContext());
if (includeUnManaged) {
Map<String, DataSourceDefInfo> managedDataSources = new HashMap<>();
for (DataSourceDefInfo dataSourceDefInfo : result) {
managedDataSources.put(dataSourceDefInfo.getUuid(), dataSourceDefInfo);
}
try {
List<DataSourceDef> allDeployments = providerFactory.getDataSourceProvider().getDeployments();
DeploymentInfo deploymentInfo;
for (DataSourceDef dataSourceDef : allDeployments) {
deploymentInfo = runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid());
if (!managedDataSources.containsKey(dataSourceDef.getUuid()) && (deploymentInfo != null && !deploymentInfo.isManaged())) {
result.add(new DataSourceDefInfo(dataSourceDef.getUuid(), dataSourceDef.getName(), runtimeManager.getDataSourceDeploymentInfo(dataSourceDef.getUuid())));
}
}
} catch (Exception e) {
logger.warn("It was not possible to read all deployed data sources. ", e);
}
}
return result;
}
Aggregations