use of org.olat.basesecurity.model.GroupMembershipImpl in project openolat by klemens.
the class GTAReminderRuleTest method addEnrollmentDate.
private void addEnrollmentDate(RepositoryEntry entry, Identity id, GroupRoles role, int amount, int field) {
RepositoryEntryToGroupRelation rel = entry.getGroups().iterator().next();
rel.getGroup();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(field, amount);
GroupMembershipImpl membership = new GroupMembershipImpl();
membership.setCreationDate(cal.getTime());
membership.setLastModified(cal.getTime());
membership.setGroup(rel.getGroup());
membership.setIdentity(id);
membership.setRole(role.name());
dbInstance.getCurrentEntityManager().persist(membership);
dbInstance.commit();
}
use of org.olat.basesecurity.model.GroupMembershipImpl in project openolat by klemens.
the class BusinessGroupRelationDAO method touchMembership.
public void touchMembership(IdentityRef identity, BusinessGroupRef group) {
StringBuilder sb = new StringBuilder();
sb.append("select membership from businessgroup as bgroup ").append(" inner join bgroup.baseGroup as baseGroup").append(" inner join baseGroup.members as membership").append(" where bgroup.key=:businessGroupKey and membership.identity.key=:identityKey");
List<GroupMembershipImpl> memberships = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), GroupMembershipImpl.class).setParameter("businessGroupKey", group.getKey()).setParameter("identityKey", identity.getKey()).getResultList();
for (GroupMembershipImpl membership : memberships) {
membership.setLastModified(new Date());
}
}
Aggregations