ConnectorForm connForm = (ConnectorForm) actionForm;
String[] paramNames = connForm.getConfigNames();
String[] paramValues = connForm.getConfigValues();
/* create ApplicationConfigData from this form */
ApplicationConfigData appConfigData = new ApplicationConfigData();
Map<String, String> paramValueMap = new HashMap<String, String>();
paramValueMap.put(ConnectorForm.CONNECTOR_ID, connForm.getConnectorId());
for (int i = 0; i < paramNames.length; i++) {
paramValueMap.put(paramNames[i], paramValues[i]);
}
appConfigData.setName(connForm.getName());
appConfigData.setType(connForm.getType());
appConfigData.setParamValues(paramValueMap);
ConfigurationService service = ServiceFactory.getConfigurationService();
appConfigData = service.addApplication(Utils.getServiceContext(context), appConfigData);
// TODO: This should be handled in a listener to NewApplicationEvent
// and ApplicationChangedEvent -rk
/* add qualifying dashboards */
ApplicationConfig appConfig =
ApplicationConfigManager.getApplicationConfig(appConfigData.getApplicationId());
List<String> dashboardIDs =
DashboardRepository.getInstance().getQualifyingDashboardIDs(appConfig);
appConfig.setDashboards(dashboardIDs);
ApplicationConfigManager.updateApplication(appConfig);