public ActionForward listClasses( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { AcademicInterval academicInterval = AcademicInterval.getAcademicIntervalFromResumedString( (String) request.getAttribute(PresentationConstants.ACADEMIC_INTERVAL)); InfoCurricularYear infoCurricularYear = (InfoCurricularYear) request.getAttribute(PresentationConstants.CURRICULAR_YEAR); InfoExecutionDegree infoExecutionDegree = (InfoExecutionDegree) request.getAttribute(PresentationConstants.EXECUTION_DEGREE); final ExecutionDegree executionDegree = FenixFramework.getDomainObject(infoExecutionDegree.getExternalId()); final Set<SchoolClass> classes; Integer curricularYear = infoCurricularYear.getYear(); if (curricularYear != null) { classes = executionDegree.findSchoolClassesByAcademicIntervalAndCurricularYear( academicInterval, curricularYear); } else { classes = executionDegree.findSchoolClassesByAcademicInterval(academicInterval); } final List<InfoClass> infoClassesList = new ArrayList<InfoClass>(); for (final SchoolClass schoolClass : classes) { InfoClass infoClass = InfoClass.newInfoFromDomain(schoolClass); infoClassesList.add(infoClass); } if (infoClassesList != null && !infoClassesList.isEmpty()) { BeanComparator nameComparator = new BeanComparator("nome"); Collections.sort(infoClassesList, nameComparator); request.setAttribute(PresentationConstants.CLASSES, infoClassesList); } request.setAttribute("executionDegreeD", executionDegree); return mapping.findForward("ShowClassList"); }
@Atomic public static Object run( final String className, final Integer curricularYear, final InfoExecutionDegree infoExecutionDegree, final AcademicInterval academicInterval) throws ExistingServiceException { final ExecutionDegree executionDegree = FenixFramework.getDomainObject(infoExecutionDegree.getExternalId()); final SchoolClass schoolClass = new SchoolClass(executionDegree, academicInterval, className, curricularYear); return InfoClass.newInfoFromDomain(schoolClass); }