package net.sourceforge.fenixedu.applicationTier.Servico.commons; import java.util.ArrayList; import java.util.List; import net.sourceforge.fenixedu.applicationTier.FenixService; import net.sourceforge.fenixedu.applicationTier.Servico.exceptions.FenixServiceException; import net.sourceforge.fenixedu.dataTransferObject.InfoExecutionPeriod; import net.sourceforge.fenixedu.dataTransferObject.InfoExecutionYear; import net.sourceforge.fenixedu.domain.ExecutionSemester; import net.sourceforge.fenixedu.domain.ExecutionYear; import pt.ist.fenixWebFramework.services.Service; public class ReadNotClosedPublicExecutionPeriodsByExecutionYear extends FenixService { @Service public static List run(InfoExecutionYear infoExecutionYear) throws FenixServiceException { final ExecutionYear executionYear; if (infoExecutionYear == null) { executionYear = ExecutionYear.readCurrentExecutionYear(); } else { executionYear = rootDomainObject.readExecutionYearByOID(infoExecutionYear.getIdInternal()); } final List result = new ArrayList(); for (final ExecutionSemester executionSemester : executionYear.readNotClosedPublicExecutionPeriods()) { result.add(InfoExecutionPeriod.newInfoFromDomain(executionSemester)); } return result; } }