public class ReadExecutionCourseProjects {
@Atomic
public static InfoSiteProjects run(String executionCourseID, String userName) throws FenixServiceException {
InfoSiteProjects infoSiteProjects = null;
final ExecutionCourse executionCourse = FenixFramework.getDomainObject(executionCourseID);
final List<Grouping> executionCourseProjects = executionCourse.getGroupings();
if (executionCourseProjects.size() != 0) {
infoSiteProjects = new InfoSiteProjects();
List infoGroupPropertiesList = new ArrayList();
for (final Grouping grouping : executionCourseProjects) {
IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
IGroupEnrolmentStrategy strategy =
enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(grouping);
if (strategy.checkEnrolmentDate(grouping, Calendar.getInstance())
&& strategy.checkStudentInGrouping(grouping, userName)) {
InfoGrouping infoGroupProperties = InfoGroupingWithExportGrouping.newInfoFromDomain(grouping);
infoGroupPropertiesList.add(infoGroupProperties);
}
}
infoSiteProjects.setInfoGroupPropertiesList(infoGroupPropertiesList);
}
return infoSiteProjects;
}