@Test public void testUpdate() throws Exception { removeAllUserGroups(); UserGroup group = createRole("u1"); boolean oldEnabled; { UserGroup loaded = userGroupAdminService.get(group.getId()); assertNotNull(loaded); assertEquals("u1", loaded.getName()); oldEnabled = loaded.getEnabled(); loaded.setEnabled(!oldEnabled); ShortGroup sg = new ShortGroup(loaded); userGroupAdminService.update(sg); } { UserGroup loaded = userGroupAdminService.get(group.getId()); assertNotNull(loaded); assertEquals((boolean)!oldEnabled, (boolean)loaded.getEnabled()); } }
@Override public long update(ShortGroup group) throws NotFoundServiceEx { UserGroup orig = userGroupDAO.find(group.getId()); if ( orig == null ) { throw new NotFoundServiceEx("UserGroup not found", group.getId()); } if ( group.isEnabled() != null ) { orig.setEnabled(group.isEnabled()); } if ( group.getExtId() != null ) { orig.setExtId(group.getExtId()); } userGroupDAO.merge(orig); return orig.getId(); }
UserGroupAdminServiceImpl implements UserGroupAdminService { @Override public long update(ShortGroup group) throws NotFoundServiceEx { UserGroup orig = userGroupDAO.find(group.getId()); if ( orig == null ) { throw new NotFoundServiceEx("UserGroup not found", group.getId()); } if ( group.isEnabled() != null ) { orig.setEnabled(group.isEnabled()); } if ( group.getExtId() != null ) { orig.setExtId(group.getExtId()); } userGroupDAO.merge(orig); return orig.getId(); } }
UserGroupAdminServiceImpl implements UserGroupAdminService { @Override public long update(ShortGroup group) throws NotFoundServiceEx { UserGroup orig = userGroupDAO.find(group.getId()); if ( orig == null ) { throw new NotFoundServiceEx("UserGroup not found", group.getId()); } if ( group.isEnabled() != null ) { orig.setEnabled(group.isEnabled()); } if ( group.getExtId() != null ) { orig.setExtId(group.getExtId()); } userGroupDAO.merge(orig); return orig.getId(); }  }
UserGroupAdminServiceImpl implements UserGroupAdminService { @Override public long update(ShortGroup group) throws NotFoundServiceEx { UserGroup orig = userGroupDAO.find(group.getId()); if ( orig == null ) { throw new NotFoundServiceEx("UserGroup not found", group.getId()); } if ( group.isEnabled() != null ) { orig.setEnabled(group.isEnabled()); } if ( group.getExtId() != null ) { orig.setExtId(group.getExtId()); } userGroupDAO.merge(orig); return orig.getId(); }  @Override long insert(ShortGroup group); @Override long update(ShortGroup group); @Override UserGroup get(long id); @Override UserGroup get(String name); @Override boolean delete(long id); @Override List<ShortGroup> getList(String nameLike, Integer page, Integer entries); @Override long getCount(String nameLike); void setUserGroupDAO(UserGroupDAO userGroupDAO); }
UserGroupAdminServiceImpl implements UserGroupAdminService { @Override public long update(ShortGroup group) throws NotFoundServiceEx { UserGroup orig = userGroupDAO.find(group.getId()); if ( orig == null ) { throw new NotFoundServiceEx("UserGroup not found", group.getId()); } if ( group.isEnabled() != null ) { orig.setEnabled(group.isEnabled()); } if ( group.getExtId() != null ) { orig.setExtId(group.getExtId()); } userGroupDAO.merge(orig); return orig.getId(); }  @Override long insert(ShortGroup group); @Override long update(ShortGroup group); @Override UserGroup get(long id); @Override UserGroup get(String name); @Override boolean delete(long id); @Override List<ShortGroup> getList(String nameLike, Integer page, Integer entries); @Override long getCount(String nameLike); void setUserGroupDAO(UserGroupDAO userGroupDAO);  }