use of org.olat.basesecurity.model.GroupImpl in project openolat by klemens.
the class GroupDAOTest method createGroupMembership_v2.
@Test
public void createGroupMembership_v2() {
Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("bgrp-1-");
Group group = groupDao.createGroup();
GroupMembership membership = groupDao.addMembershipTwoWay(group, id, "author");
dbInstance.commit();
Assert.assertNotNull(membership);
dbInstance.getCurrentEntityManager().detach(group);
dbInstance.commitAndCloseSession();
GroupImpl loadedGroup = (GroupImpl) groupDao.loadGroup(group.getKey());
Assert.assertNotNull(loadedGroup);
Set<GroupMembership> members = loadedGroup.getMembers();
Assert.assertNotNull(members);
Assert.assertEquals(1, members.size());
}
use of org.olat.basesecurity.model.GroupImpl in project openolat by klemens.
the class GroupDAO method createGroup.
public Group createGroup(String name) {
GroupImpl group = new GroupImpl();
group.setCreationDate(new Date());
group.setName(name);
dbInstance.getCurrentEntityManager().persist(group);
return group;
}
use of org.olat.basesecurity.model.GroupImpl in project openolat by klemens.
the class GroupDAO method removeGroup.
public Group removeGroup(Group group) {
EntityManager em = dbInstance.getCurrentEntityManager();
GroupImpl reloadedGroup = em.getReference(GroupImpl.class, group.getKey());
em.remove(reloadedGroup);
return group;
}
Aggregations