*/
public String save() {
// only set values for properties that are already defined
String propName = null;
RuntimeConfigProperty updProp = null;
String incomingProp = null;
Iterator propsIT = getProperties().keySet().iterator();
while(propsIT.hasNext()) {
propName = (String) propsIT.next();
updProp = (RuntimeConfigProperty) getProperties().get(propName);
incomingProp = this.getParameter(updProp.getName());
log.debug("Checking property ["+propName+"]");
log.debug("Request value is ["+incomingProp+"]");
// some special treatment for booleans
// this is a bit hacky since we are assuming that any prop
// with a value of "true" or "false" is meant to be a boolean
// it may not always be the case, but we should be okay for now
if( updProp.getValue() != null // null check needed w/Oracle
&& (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
if(incomingProp == null || !incomingProp.equals("on"))
incomingProp = "false";
else
incomingProp = "true";
}
// only work on props that were submitted with the request
if(incomingProp != null) {
log.debug("Setting new value for ["+propName+"]");
// NOTE: the old way had some locale sensitive way to do this??
updProp.setValue(incomingProp.trim());
}
}
// special handling for comment plugins
String enabledPlugins = "";
if(getCommentPlugins().length > 0) {
enabledPlugins = StringUtils.join(getCommentPlugins(), ",");
}
RuntimeConfigProperty prop =
(RuntimeConfigProperty) getProperties().get("users.comments.plugins");
prop.setValue(enabledPlugins);
try {
// save 'em and flush
PropertiesManager mgr = WebloggerFactory.getWeblogger().getPropertiesManager();
mgr.saveProperties(getProperties());