use of org.guvnor.common.services.shared.exceptions.GenericPortableException in project kie-wb-common by kiegroup.
the class DataManagementServiceImpl method getDisplayerSettings.
@Override
public DisplayerSettings getDisplayerSettings(String dataSourceUuid, String schema, String table) {
checkNotNull("dataSourceUuid", dataSourceUuid);
checkNotNull("table", table);
try {
DataSourceDeploymentInfo deploymentInfo = dataSourceRuntimeManager.getDataSourceDeploymentInfo(dataSourceUuid);
DataSetDef dataSetDef = DataSetDefBuilder.newBuilder().dataSetUuid(buildDataSetUuid(dataSourceUuid, schema, table)).dataSetName(buildDataSetName(schema, table)).dataSourceUuid(deploymentInfo.getUuid()).schema(schema).table(buildDataSetTableName(dataSourceUuid, table)).isPublic(false).build();
dataSetDefRegistry.registerDataSetDef(dataSetDef);
DataSetLookup lookup = new DataSetLookup();
lookup.setDataSetUUID(dataSetDef.getUUID());
DataSet dataSet = dataSetManager.lookupDataSet(lookup);
TableDisplayerSettingsBuilder settingsBuilder = DisplayerSettingsFactory.newTableSettings().dataset(dataSetDef.getUUID()).title(table).titleVisible(true).tablePageSize(20).tableOrderEnabled(true);
List<DataColumn> columns = dataSet.getColumns();
for (DataColumn column : columns) {
settingsBuilder.column(column.getId());
}
int tableWith = columns.size() * COLUMN_WIDTH;
settingsBuilder.tableWidth(tableWith);
settingsBuilder.renderer(DefaultRenderer.UUID);
return settingsBuilder.buildSettings();
} catch (Exception e) {
throw new GenericPortableException(e.getMessage());
}
}
use of org.guvnor.common.services.shared.exceptions.GenericPortableException in project kie-wb-common by kiegroup.
the class DatabaseMetadataServiceImpl method findTables.
@Override
public List<TableMetadata> findTables(String dataSourceUuid, String schema, String tableNamePattern, DatabaseMetadata.TableType... types) {
checkNotNull("dataSourceUuid", dataSourceUuid);
checkNotNull("types", types);
try {
DataSource dataSource = dataSourceRuntimeManager.lookupDataSource(dataSourceUuid);
return DatabaseMetadataUtil.findTables(dataSource.getConnection(), schema, tableNamePattern, types);
} catch (Exception e) {
logger.error("It was not possible to get database metadata for data source: " + dataSourceUuid, e);
throw new GenericPortableException("It was not possible to get database metadata for data source: " + dataSourceUuid + ": " + e.getMessage(), e);
}
}
use of org.guvnor.common.services.shared.exceptions.GenericPortableException in project drools-wb by kiegroup.
the class ScenarioRunnerService method run.
public TestScenarioResult run(final String identifier, final Scenario scenario, final KieModule module) {
try {
final HashMap<String, KieSession> ksessions = new HashMap<String, KieSession>();
final String ksessionName = getKSessionName(scenario.getKSessions());
ksessions.put(ksessionName, loadKSession(module, ksessionName));
final AuditLogger auditLogger = new AuditLogger(ksessions);
final ScenarioRunner4JUnit scenarioRunner = new ScenarioRunner4JUnit(scenario, ksessions, getMaxRuleFirings());
run(identifier, scenarioRunner, defaultTestResultMessageEvent);
return new TestScenarioResult(scenario, auditLogger.getLog());
} catch (InitializationError initializationError) {
throw new GenericPortableException(initializationError.getMessage());
}
}
Aggregations