use of org.olat.group.model.BusinessGroupMembershipImpl in project openolat by klemens.
the class BusinessGroupServiceImpl method getBusinessGroupMembership.
@Override
public List<BusinessGroupMembership> getBusinessGroupMembership(Collection<Long> businessGroups, Identity... identity) {
List<BusinessGroupMembershipViewImpl> views = businessGroupDAO.getMembershipInfoInBusinessGroups(businessGroups, identity);
Map<IdentityGroupKey, BusinessGroupMembershipImpl> memberships = new HashMap<IdentityGroupKey, BusinessGroupMembershipImpl>();
for (BusinessGroupMembershipViewImpl membership : views) {
if (GroupRoles.coach.name().equals(membership.getRole())) {
Long groupKey = membership.getGroupKey();
IdentityGroupKey key = new IdentityGroupKey(membership.getIdentityKey(), groupKey);
if (!memberships.containsKey(key)) {
memberships.put(key, new BusinessGroupMembershipImpl(membership.getIdentityKey(), groupKey));
}
BusinessGroupMembershipImpl mb = memberships.get(key);
mb.setOwner(true);
mb.setCreationDate(membership.getCreationDate());
mb.setLastModified(membership.getLastModified());
}
if (GroupRoles.participant.name().equals(membership.getRole())) {
Long groupKey = membership.getGroupKey();
IdentityGroupKey key = new IdentityGroupKey(membership.getIdentityKey(), groupKey);
if (!memberships.containsKey(key)) {
memberships.put(key, new BusinessGroupMembershipImpl(membership.getIdentityKey(), groupKey));
}
BusinessGroupMembershipImpl mb = memberships.get(key);
mb.setParticipant(true);
mb.setCreationDate(membership.getCreationDate());
mb.setLastModified(membership.getLastModified());
}
if (GroupRoles.waiting.name().equals(membership.getRole())) {
Long groupKey = membership.getGroupKey();
IdentityGroupKey key = new IdentityGroupKey(membership.getIdentityKey(), groupKey);
if (!memberships.containsKey(key)) {
memberships.put(key, new BusinessGroupMembershipImpl(membership.getIdentityKey(), groupKey));
}
BusinessGroupMembershipImpl mb = memberships.get(key);
mb.setWaiting(true);
mb.setCreationDate(membership.getCreationDate());
mb.setLastModified(membership.getLastModified());
}
}
return new ArrayList<BusinessGroupMembership>(memberships.values());
}
use of org.olat.group.model.BusinessGroupMembershipImpl in project OpenOLAT by OpenOLAT.
the class BusinessGroupDAO method addMembershipToRow.
private void addMembershipToRow(BusinessGroupRow row, GroupMembershipImpl member) {
if (row != null && member != null) {
if (row.getMember() == null) {
row.setMember(new BusinessGroupMembershipImpl());
}
String role = member.getRole();
BusinessGroupMembershipImpl mb = row.getMember();
mb.setCreationDate(member.getCreationDate());
mb.setLastModified(member.getLastModified());
if (GroupRoles.coach.name().equals(role)) {
mb.setOwner(true);
} else if (GroupRoles.participant.name().equals(role)) {
mb.setParticipant(true);
} else if (GroupRoles.waiting.name().equals(role)) {
mb.setWaiting(true);
}
}
}
use of org.olat.group.model.BusinessGroupMembershipImpl in project openolat by klemens.
the class BusinessGroupDAO method getBusinessGroupsMembership.
public List<BusinessGroupMembership> getBusinessGroupsMembership(Collection<BusinessGroup> groups) {
List<Long> groupKeys = new ArrayList<>();
for (BusinessGroup group : groups) {
groupKeys.add(group.getKey());
}
Map<IdentityGroupKey, BusinessGroupMembershipImpl> memberships = new HashMap<IdentityGroupKey, BusinessGroupMembershipImpl>();
loadBusinessGroupsMembership(groupKeys, memberships);
return new ArrayList<BusinessGroupMembership>(memberships.values());
}
Aggregations