}
private static InfoSiteGroupsByShift createInfoSiteGroupByShift(final Shift shift, final Grouping grouping) {
final InfoSiteGroupsByShift infoSiteGroupsByShift = new InfoSiteGroupsByShift();
final InfoSiteShift infoSiteShift = new InfoSiteShift();
infoSiteGroupsByShift.setInfoSiteShift(infoSiteShift);
infoSiteShift.setInfoShift(InfoShift.newInfoFromDomain(shift));
Collections.sort(infoSiteShift.getInfoShift().getInfoLessons());
final List<StudentGroup> studentGroups = grouping.readAllStudentGroupsBy(shift);
Integer capacity;
if (grouping.getDifferentiatedCapacity()) {
if (shift.getShiftGroupingProperties() == null) {
new ShiftGroupingProperties(shift, grouping, 0);
}
capacity = shift.getShiftGroupingProperties().getCapacity();
} else {
capacity = grouping.getGroupMaximumNumber();
}
infoSiteShift.setNrOfGroups(calculateVacancies(capacity, studentGroups.size()));
infoSiteGroupsByShift.setInfoSiteStudentGroupsList(createInfoStudentGroupsList(studentGroups));
return infoSiteGroupsByShift;
}