protected boolean onSubmit(AjaxRequestTarget target, Component contents) { // cascade delete the whole selection Catalog catalog = GeoServerApplication.get().getCatalog(); CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(catalog); DataAccessRuleDAO dao = DataAccessRuleDAO.get(); for (DataAccessRule rule : removePanel.getRoots()) { dao.removeRule(rule); } try { dao.storeRules(); } catch (IOException e) { e.printStackTrace(); } // the deletion will have changed what we see in the page // so better clear out the selection rules.clearSelection(); return true; }
@Test public void testRemove() { assertEquals(4, dao.getRules().size()); DataAccessRule newRule = dao.parseDataAccessRule("*.*.w", "ROLE_GENERIC_W"); assertFalse(dao.removeRule(newRule)); DataAccessRule first = dao.getRules().get(0); assertTrue(dao.removeRule(first)); assertFalse(dao.removeRule(first)); assertEquals(3, dao.getRules().size()); }
protected boolean onSubmit( AjaxRequestTarget target, Component contents) { // cascade delete the whole selection Catalog catalog = GeoServerApplication.get().getCatalog(); CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(catalog); DataAccessRuleDAO dao = DataAccessRuleDAO.get(); for (DataAccessRule rule : removePanel.getRoots()) { dao.removeRule(rule); } try { dao.storeRules(); } catch (IOException e) { e.printStackTrace(); } // the deletion will have changed what we see in the page // so better clear out the selection rules.clearSelection(); return true; }
protected boolean onSubmit(AjaxRequestTarget target, Component contents) { // cascade delete the whole selection Catalog catalog = GeoServerApplication.get().getCatalog(); CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(catalog); DataAccessRuleDAO dao = DataAccessRuleDAO.get(); for (DataAccessRule rule : removePanel.getRoots()) { dao.removeRule(rule); } try { dao.storeRules(); } catch (IOException e) { e.printStackTrace(); } // the deletion will have changed what we see in the page // so better clear out the selection rules.clearSelection(); return true; }