use of org.olat.group.BusinessGroupRef in project openolat by klemens.
the class BusinessGroupMembershipProcessor method processResourceRemoved.
private void processResourceRemoved(Long groupKey, Long repoKey) {
BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repoKey);
OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
List<Long> memberKeys = businessGroupRelationDao.getMemberKeys(Collections.singletonList(groupRef), GroupRoles.coach.name(), GroupRoles.participant.name());
for (Long memberKey : memberKeys) {
IdentityRef member = new IdentityRefImpl(memberKey);
List<String> remaingRoles = repositoryEntryRelationDao.getRoles(member, entryRef);
if (remaingRoles.isEmpty()) {
notificationsManager.unsubscribeAllForIdentityAndResId(member, resource.getResourceableId());
}
}
}
use of org.olat.group.BusinessGroupRef in project openolat by klemens.
the class BusinessGroupRelationDAO method getRoles.
public List<String> getRoles(IdentityRef identity, List<? extends BusinessGroupRef> groups) {
if (groups == null || groups.isEmpty())
return Collections.emptyList();
StringBuilder sb = new StringBuilder();
sb.append("select membership.role from businessgroup as bgroup ").append(" inner join bgroup.baseGroup as baseGroup").append(" inner join baseGroup.members as membership").append(" where bgroup.key in (:businessGroupKeys) and membership.identity.key=:identityKey");
List<Long> groupKeys = new ArrayList<>(groups.size());
for (BusinessGroupRef group : groups) {
groupKeys.add(group.getKey());
}
return dbInstance.getCurrentEntityManager().createQuery(sb.toString(), String.class).setParameter("businessGroupKeys", groupKeys).setParameter("identityKey", identity.getKey()).getResultList();
}
Aggregations