@Override protected void onFormSubmit(GeoServerRole role) throws IOException { GeoServerRoleStore store = null; try { store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); //copy into a new one so we can set the name properly GeoServerRole newRole= store.createRoleObject(get("form:name").getDefaultModelObjectAsString()); newRole.setUserName(role.getUserName()); newRole.getProperties().putAll(role.getProperties()); role = newRole; store.addRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
@Override protected void onFormSubmit(GeoServerRole role) throws IOException { GeoServerRoleStore store = null; try { //copy into a new one so we can set the name properly GeoServerRole newRole = new GeoServerRole(get("form:name").getDefaultModelObjectAsString()); newRole.setUserName(role.getUserName()); newRole.getProperties().putAll(role.getProperties()); role = newRole; store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName)); store.addRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName); store.setParentRole(role, parentRole); } store.store(); } catch (IOException ex) { try {store.load(); } catch (IOException ex2) {}; throw ex; } }
store.createRoleObject(get("form:name").getDefaultModelObjectAsString()); newRole.setUserName(role.getUserName()); newRole.getProperties().putAll(role.getProperties()); store.addRole(role); String parentRoleName = get("form:parent").getDefaultModelObjectAsString(); if (parentRoleName != null) { GeoServerRole parentRole = store.getRoleByName(parentRoleName);