private List<List<String>> generateData(DataObject tableObject) { List<List<String>> list = new ArrayList<List<String>>(); IDataAggregator aggregator = getAggregator(tableObject.getType()); aggregator.addDataSource(tableObject.getDataSources()); List<IDataItem> itemList = aggregator.get(); if (aggregator instanceof IDataAggregator2) { IDataAggregator2 aggregator2 = (IDataAggregator2) aggregator; List<String> headers = aggregator2.getColumnHeaders(); list.add(headers); } else { ArrayList<String> headers = new ArrayList<String>(); for (int i = 0; i < 2; i++) headers.add(""); list.add(headers); } for (int rowIdx = 0; rowIdx < itemList.size(); rowIdx++) { List<String> item = generateDataRow(itemList, rowIdx); list.add(item); } return list; }
public List<List<String>> getData(String type) { List<IDataSource> list = dataSourceService.getDataSources(); DataObject analyzedData = new DataObject(type, ""); analyzedData.addDataSources(list); return generateData(analyzedData); }