public class ReadShiftsByExecutionCourseID {
protected InfoExecutionCourseOccupancy run(String executionCourseID) {
final InfoExecutionCourseOccupancy infoExecutionCourseOccupancy = new InfoExecutionCourseOccupancy();
infoExecutionCourseOccupancy.setInfoShifts(new ArrayList());
final ExecutionCourse executionCourse = FenixFramework.getDomainObject(executionCourseID);
final Set<Shift> shifts = executionCourse.getAssociatedShifts();
infoExecutionCourseOccupancy.setInfoExecutionCourse(InfoExecutionCourse.newInfoFromDomain(executionCourse));
for (final Shift shift : shifts) {
Integer capacity = Integer.valueOf(1);
if (shift.getLotacao() != null && shift.getLotacao().intValue() != 0) {
capacity = shift.getLotacao();
}
final InfoShift infoShift = InfoShift.newInfoFromDomain(shift);
infoExecutionCourseOccupancy.getInfoShifts().add(infoShift);
}
return infoExecutionCourseOccupancy;
}