AnalysisParser { protected static String getUserContentAnalysisInputId(String layerId) { if (layerId == null) { return null; } String prefixedId = KNOWN_LAYER_PREFIXES.stream() .filter(pre -> layerId.startsWith(pre)) .findFirst() .orElse(null); if (prefixedId == null) { return null; } String sids[] = layerId.split("_"); if (sids.length > 1) { return sids[sids.length-1]; } return null; }  AnalysisLayer parseAnalysisLayer(JSONObject json, String filter1, String filter2, String baseUrl, User user); String getSourceLayerId(JSONObject json); String getNamespacePrefix(OskariLayer layer); String parseAggregateResults(String response,
                                        AnalysisLayer analysisLayer); String harmonizeElementNames(String featureSet, final AnalysisLayer analysisLayer); AnalysisLayer parseSwitch2UnionLayer(AnalysisLayer analysisLayer, String analyse, String filter1,
                                               String filter2, String baseUrl, String outputFormat); String mergeAggregateResults2FeatureSet(String featureSet, AnalysisLayer analysisLayer, List<String> rowOrder, List<String> colOrder); JSONArray reorderAggregateResult(JSONObject jsaggregate, List<String> rowOrder, List<String> colOrder); void fixTypeNames(AnalysisLayer analysisLayer, JSONObject analysejs); void removeTextTypeFields(AnalysisLayer analysisLayer); static final String ANALYSIS_LAYER_PREFIX; static final String MYPLACES_LAYER_PREFIX; static final String USERLAYER_PREFIX; static final String BUFFER; static final String INTERSECT; static final String SPATIAL_JOIN; static final String SPATIAL_JOIN_STATISTICS; static final String DIFFERENCE; static final String AGGREGATE; static final String UNION; static final String LAYER_UNION; static final String ZONESECTOR; }
@Test public void testGetUserContentAnalysisInputId() { assertNull("Non-prefixed layer should not have user content id", AnalysisParser.getUserContentAnalysisInputId("548569")); assertEquals("Myplaces-prefixed layer should have user content id", "1", AnalysisParser.getUserContentAnalysisInputId("myplaces_1")); assertEquals("Userlayer-prefixed layer should have user content id", "5235", AnalysisParser.getUserContentAnalysisInputId("userlayer_5235")); assertEquals("Analysis-prefixed layer should have user content id", "347", AnalysisParser.getUserContentAnalysisInputId("analysis_347")); assertEquals("Analyzing an analysis layer should have user content id", "68568", AnalysisParser.getUserContentAnalysisInputId("analysis_347_68568")); }