private String parseProperties(List<String> props, String ns, String geom_prop) throws ServiceException { try { return WFSFilterBuilder.parseProperties(props, ns, geom_prop); } catch (Exception e) { log.warn(e, "Properties parse failed"); } return null; }
/** * Parses WFS filter * * @param lc WFS layer configuration * @param filter WFS filter params * @param analysisId Analysis id when input is analysislayer, in other case null * @return String WFS filter xml * @throws fi.nls.oskari.service.ServiceException * ********************************************************************** */ private String parseFilter( WFSLayerConfiguration lc, String filter, String analysisId, String categoryId) throws ServiceException { JSONObject filter_js = null; try { if (filter == null) { String idfilter = null; if (analysisId != null) { // Add analysis id filter when analysis in analysis idfilter = FILTER_ID_TEMPLATE1.replace("{propertyName}", ANALYSIS_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", analysisId); } else if (categoryId != null) { // Add category id filter when myplaces in analysis idfilter = FILTER_ID_TEMPLATE1.replace("{propertyName}", MYPLACES_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", categoryId); } if (idfilter != null) filter_js = JSONHelper.createJSONObject(idfilter); } else { filter_js = JSONHelper.createJSONObject(filter); // Add analysis id filter when analysis in analysis if (filter_js.has(JSON_KEY_FILTERS)) { String idfilter = null; if (analysisId != null) { // Add analysis id filter when analysis in analysis idfilter = FILTER_ID_TEMPLATE2.replace("{propertyName}", ANALYSIS_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", analysisId); } else if (categoryId != null) { // Add category id filter when myplaces in analysis idfilter = FILTER_ID_TEMPLATE2.replace("{propertyName}", MYPLACES_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", categoryId); } if (idfilter != null) { JSONObject analysis_id_filter = JSONHelper.createJSONObject(idfilter); filter_js.getJSONArray(JSON_KEY_FILTERS).put(analysis_id_filter); } } else { String idfilter = null; if (analysisId != null) { // Add analysis id filter when analysis in analysis idfilter = FILTER_ID_TEMPLATE3.replace("{propertyName}", ANALYSIS_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", analysisId); } else if (categoryId != null) { // Add category id filter when myplaces in analysis idfilter = FILTER_ID_TEMPLATE3.replace("{propertyName}", MYPLACES_PROPERTY_NAME); idfilter = idfilter.replace("{propertyValue}", categoryId); } if (idfilter != null) { JSONArray idfilter_js = JSONHelper.createJSONArray(idfilter); filter_js.put(JSON_KEY_FILTERS, idfilter_js); } } } } catch (JSONException e) { log.warn(e, "JSON parse failed"); } // Build filter final String wfs_filter = WFSFilterBuilder.parseWfsFilter(filter_js, lc.getSRSName(), lc.getGMLGeometryProperty()); return wfs_filter; }