@Test public void testGetFilteredRequestParameters() throws Exception { final CommandConfig commandConfig = context.mock(CommandConfig.class, "config"); context.checking(new Expectations() {{ allowing(commandConfig).isCommandKey("asd"); will(returnValue(false)); allowing(commandConfig).isCommandKey("cmd1"); will(returnValue(true)); allowing(commandConfig).isCommandKey("cmd2"); will(returnValue(true)); }}); assertNotNull(new WicketUtil(commandConfig).getFilteredRequestParameters(null)); PageParameters parametersToFilter = new PageParameters() .add("cmd1", "val1") .add("asd", "dsa") .add("cmd2", "ppp"); assertEquals(3, parametersToFilter.getNamedKeys().size()); PageParameters filtered = new WicketUtil(commandConfig).getFilteredRequestParameters(parametersToFilter); assertNotNull(filtered); assertEquals(1, filtered.getNamedKeys().size()); assertEquals("dsa", filtered.get("asd").toString()); }
public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); }
WicketUtil { public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); } }
WicketUtil { public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); } WicketUtil();  WicketUtil(final CommandConfig commandConfig); }
WicketUtil { public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); } WicketUtil();  WicketUtil(final CommandConfig commandConfig); HttpServletRequest getHttpServletRequest(); long getCategoryId(final PageParameters pageParameters); Map<String, String> pageParametersAsMap(final PageParameters pageParameters); Map<String, List<String>> pageParametersAsMultiMap(final PageParameters pageParameters); PageParameters getFilteredRequestParameters(final PageParameters parameters); PageParameters getFilteredRequestParameters(final PageParameters pageParameters,
                                                              final Collection<String> nameFilter); PageParameters getFilteredRequestParameters(final PageParameters parameters,
                                                              final String key,
                                                              final String value); PageParameters getRetainedRequestParameters(final PageParameters pageParameters,
                                                              final Set<String> nameFilter); int getSelectedItemsPerPage(final PageParameters pageParameters, final List<String> itemsPerPageValues); boolean isSelectedProductSortOnPage(final PageParameters pageParameters, final String sortOrder, final String sortField); boolean isSelectedPageActive(final PageParameters pageParameters, final String pageParameterName, final int page); String constructLatinStringValue(final String ... values); static StringResourceModel createStringResourceModel(final Component component,
                                                                final String resourceKey); static StringResourceModel createStringResourceModel(final Component component,
                                                                final String resourceKey,
                                                                final Map<String, Object> parameters); }
WicketUtil { public PageParameters getFilteredRequestParameters(final PageParameters parameters) { if (parameters != null) { final PageParameters rez = new PageParameters(parameters); for (final String key : parameters.getNamedKeys()) { if (commandConfig.isCommandKey(key)) { rez.remove(key); } } return rez; } return new PageParameters(); } WicketUtil();  WicketUtil(final CommandConfig commandConfig); HttpServletRequest getHttpServletRequest(); long getCategoryId(final PageParameters pageParameters); Map<String, String> pageParametersAsMap(final PageParameters pageParameters); Map<String, List<String>> pageParametersAsMultiMap(final PageParameters pageParameters); PageParameters getFilteredRequestParameters(final PageParameters parameters); PageParameters getFilteredRequestParameters(final PageParameters pageParameters,
                                                              final Collection<String> nameFilter); PageParameters getFilteredRequestParameters(final PageParameters parameters,
                                                              final String key,
                                                              final String value); PageParameters getRetainedRequestParameters(final PageParameters pageParameters,
                                                              final Set<String> nameFilter); int getSelectedItemsPerPage(final PageParameters pageParameters, final List<String> itemsPerPageValues); boolean isSelectedProductSortOnPage(final PageParameters pageParameters, final String sortOrder, final String sortField); boolean isSelectedPageActive(final PageParameters pageParameters, final String pageParameterName, final int page); String constructLatinStringValue(final String ... values); static StringResourceModel createStringResourceModel(final Component component,
                                                                final String resourceKey); static StringResourceModel createStringResourceModel(final Component component,
                                                                final String resourceKey,
                                                                final Map<String, Object> parameters);  }