private void fixConfiguration(Section section, HashMap<String, String> openerp_settings, HashMap<String, String> postgres_settings, HashMap<String, ?> parameters) throws Exception {
//If one of the datasources is an OpenERP datasource, reset the connection to the passed parameters
if(section instanceof AbstractReportDefinition) {
CompoundDataFactory factories = (CompoundDataFactory) ((AbstractReportDefinition) section).getDataFactory();
for(int j = 0; j < factories.size(); j++) {
DataFactory data_factory = factories.getReference(j);
if(data_factory instanceof OpenERPDataFactory)
fixOpenERPDataFactoryConfiguration((OpenERPDataFactory) data_factory, openerp_settings, parameters, section);
else if(data_factory instanceof SQLReportDataFactory && postgres_settings != null) {
String[] postgres_setting_names = {"host", "port", "db", "login", "password"};
boolean custom_settings = false;
for(String custom_setting_name : postgres_setting_names)
custom_settings |= (postgres_settings.get(custom_setting_name) != null);
if(custom_settings)
factories.set(j, fixSQLDataFactoryConfiguration((SQLReportDataFactory) data_factory, postgres_settings));
}
}
}
//Go through all children and fix up their datasources too