use of org.dashbuilder.dataset.DataColumn in project kie-wb-common by kiegroup.
the class ContributorsManagerTest method testBuildDataSet.
@Test
public void testBuildDataSet() throws Exception {
DataSet dataSet = contributorsManager.buildDataSet(null);
assertEquals(68, dataSet.getRowCount());
assertEquals(6, dataSet.getColumns().size());
DataColumn column = dataSet.getColumns().get(0);
assertEquals(ColumnType.LABEL, column.getColumnType());
assertEquals(COLUMN_ORG, column.getId());
column = dataSet.getColumns().get(1);
assertEquals(ColumnType.LABEL, column.getColumnType());
assertEquals(COLUMN_REPO, column.getId());
column = dataSet.getColumns().get(2);
assertEquals(ColumnType.LABEL, column.getColumnType());
assertEquals(COLUMN_PROJECT, column.getId());
column = dataSet.getColumns().get(3);
assertEquals(ColumnType.LABEL, column.getColumnType());
assertEquals(COLUMN_AUTHOR, column.getId());
column = dataSet.getColumns().get(4);
assertEquals(ColumnType.TEXT, column.getColumnType());
assertEquals(COLUMN_MSG, column.getId());
column = dataSet.getColumns().get(5);
assertEquals(ColumnType.DATE, column.getColumnType());
assertEquals(COLUMN_DATE, column.getId());
DataSetMetadata metadata = dataSet.getMetadata();
assertNotNull(metadata);
}
use of org.dashbuilder.dataset.DataColumn in project jbpm by kiegroup.
the class AbstractQueryMapper method getColumnStringValue.
protected String getColumnStringValue(DataSet currentDataSet, String columnId, int index) {
DataColumn column = currentDataSet.getColumnById(columnId);
if (column == null) {
return null;
}
Object value = column.getValues().get(index);
return value != null ? value.toString() : null;
}
use of org.dashbuilder.dataset.DataColumn in project jbpm by kiegroup.
the class AbstractQueryMapper method getColumnLongValue.
protected Long getColumnLongValue(DataSet currentDataSet, String columnId, int index) {
DataColumn column = currentDataSet.getColumnById(columnId);
if (column == null) {
return null;
}
Object value = column.getValues().get(index);
if (value instanceof String) {
value = Long.parseLong((String) value);
}
return value != null ? ((Number) value).longValue() : null;
}
use of org.dashbuilder.dataset.DataColumn in project jbpm by kiegroup.
the class AbstractQueryMapper method getColumnIntValue.
protected int getColumnIntValue(DataSet currentDataSet, String columnId, int index) {
DataColumn column = currentDataSet.getColumnById(columnId);
if (column == null) {
return -1;
}
Object value = column.getValues().get(index);
return value != null ? ((Number) value).intValue() : -1;
}
use of org.dashbuilder.dataset.DataColumn 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());
}
}
Aggregations