/** * Parses AGGREGATE method parameters for WPS execute xml variables * * @param lc WFS layer configuration * @param json Method parameters and layer info from the front * @param baseUrl Url for Geoserver WPS reference input (input * @param aggre_field Field name for aggregate function * @return AggregateMethodParams parameters for WPS execution * ********************************************************************** */ private AggregateMethodParams parseAggregateParams( WFSLayerConfiguration lc, JSONObject json, String baseUrl, String aggre_field, List<String> aggre_funcs) throws ServiceException { AggregateMethodParams method = new AggregateMethodParams(); // method.setMethod(AGGREGATE); try { method.setLayer_id(ConversionHelper.getInt(lc.getLayerId(), 0)); method.setServiceUrl(lc.getURL()); baseUrl = baseUrl.replace("&", "&"); method.setHref(baseUrl + String.valueOf(lc.getLayerId())); method.setTypeName(lc.getFeatureNamespace() + ":" + lc.getFeatureElement()); method.setMaxFeatures(String.valueOf(lc.getMaxFeatures())); method.setSrsName(lc.getSRSName()); method.setOutputFormat(DEFAULT_OUTPUT_FORMAT); method.setVersion(lc.getWFSVersion()); method.setXmlns( "xmlns:" + lc.getFeatureNamespace() + "=\"" + lc.getFeatureNamespaceURI() + "\""); method.setGeom(lc.getGMLGeometryProperty()); JSONObject bbox = null; bbox = json.getJSONObject("bbox"); method.setX_lower(bbox.optString("left")); method.setY_lower(bbox.optString("bottom")); method.setX_upper(bbox.optString("right")); method.setY_upper(bbox.optString("top")); // TODO: loop fields - current solution only for 1st field method.setAggreField1(aggre_field); method.setAggreFunctions(aggre_funcs); } catch (JSONException e) { throw new ServiceException("Method parameters missing."); } return method; }