public void handleAction(ActionParameters params) throws ActionException { final JSONObject root = new JSONObject(); // Because of analysis layers String sid = params.getHttpParam(ID, "n/a"); final int id = ConversionHelper.getInt(getBaseLayerId(sid), 0); final HttpServletResponse response = params.getResponse(); response.setContentType("application/json"); if (id == 0) { JSONHelper.putValue(root, ERROR, ERROR_NO_ID); ResponseHelper.writeResponse(params, root); // FIXME: throw ActionParamsException instead and modify client // response parsing return; } String json = WFSLayerConfiguration.getCache(id + ""); if (json == null) { WFSLayerConfiguration lc = layerConfigurationService.findConfiguration(id); log.warn("id", id); log.warn(lc); // Extra manage for analysis if (sid.indexOf(ANALYSIS_PREFIX) > -1) { log.warn("sid", sid); // set id to original analysis layer id lc.setLayerId(sid); // Set analysis layer fields as id based lc.setSelectedFeatureParams(getAnalysisFeatureProperties(sid)); } // Extra manage for analysis else if (sid.indexOf(MYPLACES_PREFIX) > -1) { log.warn("sid", sid); // set id to original my places layer id lc.setLayerId(sid); } else if (sid.indexOf(USERLAYER_PREFIX) > -1) { log.warn("sid", sid); // set id to original user layer id lc.setLayerId(sid); } if (lc == null) { JSONHelper.putValue(root, ERROR, ERROR_NOT_FOUND); ResponseHelper.writeResponse(params, root); // FIXME: throw ActionParamsException instead and modify client // response parsing return; } lc.save(); } JSONHelper.putValue(root, RESULT, RESULT_SUCCESS); ResponseHelper.writeResponse(params, root); }