AppDefinition appDef = appService.getAppDefinition(appId, version);
map.addAttribute("appId", appId);
map.addAttribute("appVersion", appDef.getVersion());
map.addAttribute("appDefinition", appDef);
PluginDefaultProperties pluginDefaultProperties = null;
if ("create".equals(action)) {
pluginDefaultProperties = new PluginDefaultProperties();
pluginDefaultProperties.setAppDefinition(appDef);
pluginDefaultProperties.setId(id);
} else {
pluginDefaultProperties = pluginDefaultPropertiesDao.loadById(id, appDef);
}
try {
Plugin plugin = (Plugin) pluginManager.getPlugin(id);
pluginDefaultProperties.setPluginName(plugin.getName());
pluginDefaultProperties.setPluginDescription(plugin.getDescription());
} catch (Exception e) {
}
if (pluginProperties == null) {
//request params
Map<String, String> propertyMap = new HashMap();
Enumeration<String> e = request.getParameterNames();
while (e.hasMoreElements()) {
String paramName = e.nextElement();
if (!paramName.startsWith("param_")) {
String[] paramValue = (String[]) request.getParameterValues(paramName);
propertyMap.put(paramName, CsvUtil.getDeliminatedString(paramValue));
}
}
// form csv properties
StringWriter sw = new StringWriter();
try {
CSVWriter writer = new CSVWriter(sw);
Iterator it = propertyMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> pairs = (Map.Entry) it.next();
writer.writeNext(new String[]{pairs.getKey(), pairs.getValue()});
}
writer.close();
} catch (Exception ex) {
LogUtil.error(getClass().getName(), ex, "");
}
String pluginProps = sw.toString();
pluginDefaultProperties.setPluginProperties(pluginProps);
} else {
pluginDefaultProperties.setPluginProperties(PropertyUtil.propertiesJsonStoreProcessing(pluginDefaultProperties.getPluginProperties(), pluginProperties));
}
if ("create".equals(action)) {
pluginDefaultPropertiesDao.add(pluginDefaultProperties);
} else {