new PieChartBuilder(field.getIndex()).start();
}
private Map<String, Integer> getDataMap(DcField field) {
DcModule mainModule = DcModules.get(field.getModule());
DcModule referenceModule = DcModules.get(field.getReferenceIdx());
DcModule mappingModule = DcModules.get(DcModules.getMappingModIdx(module, field.getReferenceIdx(), field.getIndex()));
String sql;
if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTREFERENCE) {
sql = "select sub." + referenceModule.getField(referenceModule.getDisplayFieldIdx()).getDatabaseFieldName() +
", count(parent.id) from " + mainModule.getTableName() +
" parent inner join " + referenceModule.getTableName() + " sub on " +
" parent. " + field.getDatabaseFieldName() + " = sub.ID " +
" group by sub." + referenceModule.getField(referenceModule.getDisplayFieldIdx()).getDatabaseFieldName() +
" order by 1";
} else if (field.getValueType() == DcRepository.ValueTypes._DCOBJECTCOLLECTION) {
sql = "select sub." + referenceModule.getField(referenceModule.getDisplayFieldIdx()).getDatabaseFieldName() +
", count(parent.id) from " + mainModule.getTableName() + " parent " +
" inner join " + mappingModule.getTableName() + " mapping on " +
" parent. ID = mapping." + mappingModule.getField(DcMapping._A_PARENT_ID).getDatabaseFieldName() +
" inner join " + referenceModule.getTableName() + " sub on " +
" mapping." + mappingModule.getField(DcMapping._B_REFERENCED_ID).getDatabaseFieldName() + " = sub.ID " +
" group by sub." + referenceModule.getField(referenceModule.getDisplayFieldIdx()).getDatabaseFieldName() +
" order by 1";
} else {
sql = "select " + field.getDatabaseFieldName() + ", count(ID) from " + mainModule.getTableName() +
" group by " + field.getDatabaseFieldName() +