public CommandResponse actionSave(CommandRequest request) throws Exception {
WorkspaceImpl workspace = NavigationManager.lookup().getCurrentWorkspace();
WorkspacePermission workspacePerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_ADMIN);
UserStatus.lookup().checkPermission(workspacePerm);
PanelInstance instance = getPanelInstance();
request.getRequestObject().setAttribute(PanelInstanceGeneralPropertiesFormatter.PANEL_INSTANCE, instance);
PanelProviderParameter[] params = getPanelProviderParameters(instance);
String language = formStatus.getValueAsString("lang");
boolean anyParamWritten = false;
if (params != null && params.length > 0) {
for (int i = 0; i < params.length; i++) {
String value = params[i].readFromRequest(request.getRequestObject());
log.debug("Panel " + instance.getInstanceId() + " field:" + params[i].getId() + " = " + value);
if (params[i].isI18n()) {
String oldValue = instance.getParameterValue(params[i].getId(), language);
if (!RenderUtils.noNull(oldValue).equals(RenderUtils.noNull(value)) && params[i].isValid(value)) {
instance.setParameterValue(params[i].getId(), value, language);
anyParamWritten = true;
}
} else {
String oldValue = instance.getParameterValue(params[i].getId());
if (!RenderUtils.noNull(oldValue).equals(RenderUtils.noNull(value)) && params[i].isValid(value)) {
instance.setParameterValue(params[i].getId(), value);
anyParamWritten = true;
}
}
if (!params[i].isValid(value)) formStatus.addWrongField(params[i].getId());