@Test public void deleteGroup() { int before = tableSize(); groupDAO.deleteGroup(group1); assertThat(tableSize()).isEqualTo(before - 1); assertThat(groupDAO.getGroups()).containsOnly(group2); }
public void deleteGroup(Group group) { dslContext.transaction(configuration -> { DSL.using(configuration) .delete(GROUPS) .where(GROUPS.ID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(MEMBERSHIPS) .where(MEMBERSHIPS.GROUPID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.GROUPID.eq(group.getId())) .execute(); }); }
GroupDAO { public void deleteGroup(Group group) { dslContext.transaction(configuration -> { DSL.using(configuration) .delete(GROUPS) .where(GROUPS.ID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(MEMBERSHIPS) .where(MEMBERSHIPS.GROUPID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.GROUPID.eq(group.getId())) .execute(); }); } }
GroupDAO { public void deleteGroup(Group group) { dslContext.transaction(configuration -> { DSL.using(configuration) .delete(GROUPS) .where(GROUPS.ID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(MEMBERSHIPS) .where(MEMBERSHIPS.GROUPID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.GROUPID.eq(group.getId())) .execute(); }); } private  GroupDAO(DSLContext dslContext, GroupMapper groupMapper, ObjectMapper mapper); }
GroupDAO { public void deleteGroup(Group group) { dslContext.transaction(configuration -> { DSL.using(configuration) .delete(GROUPS) .where(GROUPS.ID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(MEMBERSHIPS) .where(MEMBERSHIPS.GROUPID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.GROUPID.eq(group.getId())) .execute(); }); } private  GroupDAO(DSLContext dslContext, GroupMapper groupMapper, ObjectMapper mapper); long createGroup(String name, String creator, String description, ImmutableMap<String, String> metadata); void deleteGroup(Group group); Optional<Group> getGroup(String name); Optional<Group> getGroupById(long id); ImmutableSet<Group> getGroups(); }
GroupDAO { public void deleteGroup(Group group) { dslContext.transaction(configuration -> { DSL.using(configuration) .delete(GROUPS) .where(GROUPS.ID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(MEMBERSHIPS) .where(MEMBERSHIPS.GROUPID.eq(group.getId())) .execute(); DSL.using(configuration) .delete(ACCESSGRANTS) .where(ACCESSGRANTS.GROUPID.eq(group.getId())) .execute(); }); } private  GroupDAO(DSLContext dslContext, GroupMapper groupMapper, ObjectMapper mapper); long createGroup(String name, String creator, String description, ImmutableMap<String, String> metadata); void deleteGroup(Group group); Optional<Group> getGroup(String name); Optional<Group> getGroupById(long id); ImmutableSet<Group> getGroups();  }