public List<ExecutionSemester> getAvailableExecutionSemesters() { List<ExecutionSemester> result = new ArrayList<ExecutionSemester>(); ExecutionSemester readActualExecutionSemester = ExecutionSemester.readActualExecutionSemester(); result.add(readActualExecutionSemester); result.add(readActualExecutionSemester.getPreviousExecutionPeriod()); return result; }
public ActionForward showExecutionDegrees( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm personExecutionCourseForm = (DynaValidatorForm) form; String personId = (String) personExecutionCourseForm.get("teacherId"); Person person = Person.readPersonByUsername(personId); setChoosedExecutionPeriod( request, ReadNotClosedExecutionPeriods.run(), personExecutionCourseForm); InfoExecutionPeriod infoExecutionPeriod = (InfoExecutionPeriod) request.getAttribute("infoExecutionPeriod"); final ExecutionSemester executionPeriod = infoExecutionPeriod.getExecutionPeriod(); if (executionPeriod.getSemester().intValue() == 2 && executionPeriod.getExecutionYear().getYear().equals("2010/2011")) { } else { if (person.getTeacher() == null || (person.getTeacher().getTeacherAuthorization(executionPeriod) == null && !person.hasRole(RoleType.TEACHER))) { request.setAttribute("notAuth", true); return showExecutionYearExecutionPeriods( mapping, personExecutionCourseForm, request, response); } } prepareSecondStep(personExecutionCourseForm, request); personExecutionCourseForm.set("page", new Integer(2)); return mapping.findForward("second-step"); }
public List<InfoExecutionCourse> run( InfoExecutionPeriod infoExecutionPeriod, InfoExecutionDegree infoExecutionDegree, InfoCurricularYear infoCurricularYear, String executionCourseName) { List<InfoExecutionCourse> result = null; final ExecutionSemester executionSemester = FenixFramework.getDomainObject(infoExecutionPeriod.getExternalId()); ExecutionDegree executionDegree = null; if (infoExecutionDegree != null) { executionDegree = FenixFramework.getDomainObject(infoExecutionDegree.getExternalId()); } CurricularYear curricularYear = null; if (infoCurricularYear != null) { curricularYear = FenixFramework.getDomainObject(infoCurricularYear.getExternalId()); } List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>(); if (executionSemester != null) { executionCourses = executionSemester .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName( executionDegree.getDegreeCurricularPlan(), curricularYear, executionCourseName); } return fillInfoExecutionCourses(executionSemester.getAcademicInterval(), executionCourses); }
@Atomic public static List run( String executionDegreeId, String executionPeriodId, Integer curricularYearInt) throws FenixServiceException { if (executionPeriodId == null) { throw new FenixServiceException("nullExecutionPeriodId"); } final ExecutionSemester executionSemester = FenixFramework.getDomainObject(executionPeriodId); final List<ExecutionCourse> executionCourseList; if (executionDegreeId == null && curricularYearInt == null) { executionCourseList = executionSemester.getExecutionCoursesWithNoCurricularCourses(); } else { final ExecutionDegree executionDegree = findExecutionDegreeByID(executionSemester, executionDegreeId); final DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan(); final CurricularYear curricularYear = CurricularYear.readByYear(curricularYearInt); executionCourseList = executionSemester .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName( degreeCurricularPlan, curricularYear, "%"); } final List infoExecutionCourseList = new ArrayList(executionCourseList.size()); for (final ExecutionCourse executionCourse : executionCourseList) { infoExecutionCourseList.add(InfoExecutionCourse.newInfoFromDomain(executionCourse)); } return infoExecutionCourseList; }
private double getEnrolmentsEctsCredits( final Registration registration, final ExecutionYear executionYear) { double result = 0.0; double annualCredits = 0.0; for (final ExecutionSemester executionSemester : executionYear.getExecutionPeriodsSet()) { for (final Enrolment enrolment : registration.getLastStudentCurricularPlan().getEnrolmentsSet()) { if (enrolment.isValid(executionSemester)) { if (enrolment.isAnual()) { this.enrolledInAnualCoursesLastYear = true; if (executionSemester.getSemester() == 1) { annualCredits += enrolment.getEctsCredits(); } continue; } result += enrolment.getEctsCredits(); } } } return result + annualCredits; }
private static ExecutionSemester getBeginExecutionPeriod(final Integer beginExecutionPeriodID) { if (beginExecutionPeriodID == null) { return ExecutionSemester.readActualExecutionSemester(); } else { return RootDomainObject.getInstance().readExecutionSemesterByOID(beginExecutionPeriodID); } }
public CurricularCourseManagementBackingBean() { if (getCurricularCourse() != null && getExecutionYear() != null) { curricularCourseSemesterBean = new CurricularCourseByExecutionSemesterBean( getCurricularCourse(), ExecutionSemester.readBySemesterAndExecutionYear(2, getExecutionYear().getYear())); } }
@Override protected RuleResult executeEnrolmentWithRulesAndTemporaryEnrolment( final ICurricularRule curricularRule, final IDegreeModuleToEvaluate sourceDegreeModuleToEvaluate, final EnrolmentContext enrolmentContext) { final RestrictionDoneDegreeModule rule = (RestrictionDoneDegreeModule) curricularRule; final ExecutionSemester executionSemester = enrolmentContext.getExecutionPeriod(); if (!canApplyRule(enrolmentContext, rule)) { return RuleResult.createNA(sourceDegreeModuleToEvaluate.getDegreeModule()); } final CurricularCourse curricularCourse = rule.getPrecedenceDegreeModule(); if (isEnrolling(enrolmentContext, curricularCourse) || isEnroled(enrolmentContext, curricularCourse, executionSemester)) { return RuleResult.createFalse( sourceDegreeModuleToEvaluate.getDegreeModule(), "curricularRules.ruleExecutors.RestrictionDoneDegreeModuleExecutor.cannot.enrol.simultaneously.to.degreeModule.and.precedenceDegreeModule", rule.getDegreeModuleToApplyRule().getName(), rule.getPrecedenceDegreeModule().getName()); } if (isApproved(enrolmentContext, curricularCourse)) { return RuleResult.createTrue(sourceDegreeModuleToEvaluate.getDegreeModule()); } if (hasEnrolmentWithEnroledState( enrolmentContext, curricularCourse, executionSemester.getPreviousExecutionPeriod())) { return RuleResult.createTrue( EnrolmentResultType.TEMPORARY, sourceDegreeModuleToEvaluate.getDegreeModule()); } /* * CurricularCourse is not approved and is not enroled in previous * semester If DegreeModule is Enroled in current semester then * Enrolment must be impossible */ if (isEnroled(enrolmentContext, rule.getDegreeModuleToApplyRule(), executionSemester)) { return createImpossibleRuleResult(rule, sourceDegreeModuleToEvaluate); } return createFalseRuleResult(rule, sourceDegreeModuleToEvaluate); }
private static ExecutionDegree findExecutionDegreeByID( final ExecutionSemester executionSemester, final String executionDegreeId) { final ExecutionYear executionYear = executionSemester.getExecutionYear(); for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) { if (executionDegree.getExternalId().equals(executionDegreeId)) { return executionDegree; } } return null; }
private static boolean hasActiveProfessorship() { final ExecutionSemester executionSemester = ExecutionSemester.readActualExecutionSemester(); final Person person = AccessControl.getPerson(); for (final Professorship professorship : person.getProfessorshipsSet()) { if (professorship.getExecutionCourse().getExecutionPeriod() == executionSemester) { return true; } } return false; }
@EntryPoint public ActionForward prepare( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ContextSelectionBean contextSelectionBean = (ContextSelectionBean) request.getAttribute(PresentationConstants.CONTEXT_SELECTION_BEAN); final StudentContextSelectionBean studentContextSelectionBean = new StudentContextSelectionBean(contextSelectionBean.getAcademicInterval()); request.setAttribute("studentContextSelectionBean", studentContextSelectionBean); final List<ExecutionDegree> executionDegrees = new ArrayList<ExecutionDegree>( ExecutionDegree.filterByAcademicInterval(contextSelectionBean.getAcademicInterval())); Collections.sort(executionDegrees, executionDegreeComparator); request.setAttribute("executionDegrees", executionDegrees); ExecutionSemester executionSemester = (ExecutionSemester) ExecutionInterval.getExecutionInterval(contextSelectionBean.getAcademicInterval()); request.setAttribute("executionSemester", executionSemester); AcademicCalendarEntry academicCalendarEntry = contextSelectionBean.getAcademicInterval().getAcademicCalendarEntry(); while (!(academicCalendarEntry instanceof AcademicCalendarRootEntry)) { if (academicCalendarEntry instanceof AcademicYearCE) { ExecutionYear year = ExecutionYear.getExecutionYear((AcademicYearCE) academicCalendarEntry); request.setAttribute("executionYear", year); break; } else { academicCalendarEntry = academicCalendarEntry.getParentEntry(); } } if (!executionSemester.isCurrent()) { request.setAttribute("noEditionAllowed", true); } return mapping.findForward("showForm"); }
private VirtualPath getVirtualPath(Site site, Container container) { List<Content> contents = site.getPathTo(container); final VirtualPath filePath = new VirtualPath(); for (Content content : contents.subList(1, contents.size())) { filePath.addNode( 0, new VirtualPathNode( content.getClass().getSimpleName().substring(0, 1) + content.getExternalId(), content.getName().getContent())); } String authorName = site.getAuthorName(); filePath.addNode( 0, new VirtualPathNode( "Site" + site.getExternalId(), authorName == null ? "Site" + site.getExternalId() : authorName)); ExecutionSemester executionSemester = site.getExecutionPeriod(); if (executionSemester == null) { filePath.addNode(0, new VirtualPathNode("Intemporal", "Intemporal")); } else { filePath.addNode( 0, new VirtualPathNode( "EP" + executionSemester.getExternalId(), executionSemester.getName())); ExecutionYear executionYear = executionSemester.getExecutionYear(); filePath.addNode( 0, new VirtualPathNode("EY" + executionYear.getExternalId(), executionYear.getYear())); } filePath.addNode(0, new VirtualPathNode("Courses", "Courses")); return filePath; }
private static void createEnrolments( User userView, MasterDegreeCandidate masterDegreeCandidate, StudentCurricularPlan studentCurricularPlan) { Collection<CandidateEnrolment> candidateEnrolments = masterDegreeCandidate.getCandidateEnrolments(); ExecutionSemester executionSemester = ExecutionSemester.readActualExecutionSemester(); for (CandidateEnrolment candidateEnrolment : candidateEnrolments) { new Enrolment( studentCurricularPlan, candidateEnrolment.getCurricularCourse(), executionSemester, EnrollmentCondition.FINAL, userView.getUsername()); } }
protected List<SelectItem> readExecutionPeriodItems() { final ExecutionSemester minimumExecutionPeriod = getMinimumExecutionPeriod(); final List<ExecutionSemester> notClosedExecutionPeriods = ExecutionSemester.readNotClosedExecutionPeriods(); Collections.sort(notClosedExecutionPeriods); final List<SelectItem> result = new ArrayList<SelectItem>(); for (final ExecutionSemester notClosedExecutionPeriod : notClosedExecutionPeriods) { if (minimumExecutionPeriod == null || notClosedExecutionPeriod.isAfterOrEquals(minimumExecutionPeriod)) { result.add( new SelectItem( notClosedExecutionPeriod.getExternalId(), notClosedExecutionPeriod.getName() + " " + notClosedExecutionPeriod.getExecutionYear().getYear())); } } return result; }
public A3ESDegreeProcess() { super(); this.executionSemester = ExecutionSemester.readActualExecutionSemester(); }
private String getTeachersAndTeachingHours(CurricularCourse course, boolean responsibleTeacher) { Map<Teacher, Double> responsiblesMap = new HashMap<Teacher, Double>(); List<ExecutionSemester> executionSemesters = getSelectedExecutionSemesters(); for (final ExecutionCourse executionCourse : course.getAssociatedExecutionCourses()) { if (executionSemesters.contains(executionCourse.getExecutionPeriod())) { for (Professorship professorhip : executionCourse.getProfessorshipsSet()) { if (professorhip.isResponsibleFor() == responsibleTeacher && professorhip .getPerson() .getTeacher() .isActiveOrHasAuthorizationForSemester(executionCourse.getExecutionPeriod())) { Double hours = responsiblesMap.get(professorhip.getTeacher()); if (hours == null) { hours = 0.0; } hours = hours + getHours(professorhip); responsiblesMap.put(professorhip.getTeacher(), hours); } } } } int counter = 1000; List<String> responsibles = new ArrayList<String>(); for (Teacher teacher : responsiblesMap.keySet()) { String responsible = teacher.getPerson().getName() + " (" + responsiblesMap.get(teacher) + ")"; counter -= JSONObject.escape(responsible + ", ").getBytes().length; responsibles.add(responsible); } if (!responsibleTeacher && course.isDissertation()) { Set<Teacher> teachers = new HashSet<Teacher>(); for (ExecutionCourse executionCourse : course.getAssociatedExecutionCoursesSet()) { if (executionCourse .getExecutionPeriod() .getExecutionYear() .equals(executionSemester.getExecutionYear().getPreviousExecutionYear())) { for (Attends attends : executionCourse.getAttends()) { if (attends.hasEnrolment() && attends.getEnrolment().getThesis() != null) { for (ThesisEvaluationParticipant thesisEvaluationParticipant : attends.getEnrolment().getThesis().getOrientation()) { if (thesisEvaluationParticipant.getPerson().getTeacher() != null && thesisEvaluationParticipant .getPerson() .getTeacher() .isActiveOrHasAuthorizationForSemester( executionCourse.getExecutionPeriod())) { teachers.add(thesisEvaluationParticipant.getPerson().getTeacher()); } } } } } } for (Teacher teacher : teachers) { String responsible = teacher.getPerson().getName() + " (0.0)"; if (counter - JSONObject.escape(responsible).getBytes().length < 0) { break; } if (!responsiblesMap.containsKey(teacher)) { counter -= JSONObject.escape(responsible + ", ").getBytes().length; responsibles.add(responsible); } } } return StringUtils.join(responsibles, ", "); }
@Override public void renderReport(final Spreadsheet spreadsheet) throws Exception { spreadsheet.setHeader("Número"); spreadsheet.setHeader("Sexo"); spreadsheet.setHeader("Média"); spreadsheet.setHeader("Média Anual"); spreadsheet.setHeader("Número Inscrições"); spreadsheet.setHeader("Número Aprovações"); spreadsheet.setHeader("Nota de Seriação"); spreadsheet.setHeader("Local de Origem"); final ExecutionYear executionYear = getExecutionYear(); for (final Degree degree : Degree.readNotEmptyDegrees()) { if (checkDegreeType(getDegreeType(), degree)) { if (isActive(degree)) { for (final Registration registration : degree.getRegistrationsSet()) { if (registration.isRegistered(getExecutionYear())) { int enrolmentCounter = 0; int aprovalCounter = 0; BigDecimal bigDecimal = null; double totalCredits = 0; for (final Registration otherRegistration : registration.getStudent().getRegistrationsSet()) { if (otherRegistration.getDegree() == registration.getDegree()) { for (final StudentCurricularPlan studentCurricularPlan : otherRegistration.getStudentCurricularPlansSet()) { for (final Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { final ExecutionSemester executionSemester = enrolment.getExecutionPeriod(); if (executionSemester.getExecutionYear() == executionYear) { enrolmentCounter++; if (enrolment.isApproved()) { aprovalCounter++; final Grade grade = enrolment.getGrade(); if (grade.isNumeric()) { final double credits = enrolment.getEctsCreditsForCurriculum().doubleValue(); totalCredits += credits; bigDecimal = bigDecimal == null ? grade.getNumericValue().multiply(new BigDecimal(credits)) : bigDecimal.add( grade.getNumericValue().multiply(new BigDecimal(credits))); } } } } } } } final Row row = spreadsheet.addRow(); row.setCell(registration.getNumber().toString()); row.setCell(registration.getPerson().getGender().toLocalizedString()); row.setCell(registration.getAverage(executionYear)); if (bigDecimal == null) { row.setCell(""); } else { row.setCell( bigDecimal.divide(new BigDecimal(totalCredits), 5, RoundingMode.HALF_UP)); } row.setCell(Integer.toString(enrolmentCounter)); row.setCell(Integer.toString(aprovalCounter)); row.setCell( registration.getEntryGrade() != null ? registration.getEntryGrade().toString() : StringUtils.EMPTY); Boolean dislocated = null; if (registration.hasStudentCandidacy()) { dislocated = registration.getStudentCandidacy().getDislocatedFromPermanentResidence(); } final String dislocatedString = dislocated == null ? "" : (dislocated.booleanValue() ? "Deslocado" : "Não Deslocado"); row.setCell(dislocatedString); } } } } } }
protected Set<Teacher> getTeachers(List<ExecutionSemester> executionSemesters) { Set<Teacher> teachers = new HashSet<Teacher>(); ExecutionYear previousExecutionYear = executionSemester.getExecutionYear().getPreviousExecutionYear(); for (final DegreeCurricularPlan degreeCurricularPlan : degree.getDegreeCurricularPlansSet()) { for (final CurricularCourse course : degreeCurricularPlan.getCurricularCourses()) { for (final ExecutionCourse executionCourse : course.getAssociatedExecutionCourses()) { if (executionSemesters.contains(executionCourse.getExecutionPeriod())) { for (Professorship professorhip : executionCourse.getProfessorshipsSet()) { if (professorhip .getPerson() .getTeacher() .isActiveOrHasAuthorizationForSemester(executionCourse.getExecutionPeriod())) { teachers.add(professorhip.getPerson().getTeacher()); } } } if (previousExecutionYear.equals( executionCourse.getExecutionPeriod().getExecutionYear())) { if (executionCourse.isDissertation()) { for (Attends attends : executionCourse.getAttends()) { if (attends.hasEnrolment() && attends.getEnrolment().getThesis() != null) { for (ThesisEvaluationParticipant thesisEvaluationParticipant : attends.getEnrolment().getThesis().getOrientation()) { if (thesisEvaluationParticipant.getPerson().getTeacher() != null && thesisEvaluationParticipant .getPerson() .getTeacher() .isActiveOrHasAuthorizationForSemester( executionCourse.getExecutionPeriod())) { teachers.add(thesisEvaluationParticipant.getPerson().getTeacher()); } } } } } } } } } PhdProgram phdProgram = degree.getPhdProgram(); if (phdProgram != null) { for (PhdIndividualProgramProcess phdIndividualProgramProcess : phdProgram.getIndividualProgramProcesses()) { for (ExecutionSemester executionSemester : executionSemesters) { if (phdIndividualProgramProcess.isActive( executionSemester.getAcademicInterval().toInterval())) { for (PhdParticipant phdParticipant : phdIndividualProgramProcess.getParticipants()) { if (phdParticipant instanceof InternalPhdParticipant) { InternalPhdParticipant internalPhdParticipant = (InternalPhdParticipant) phdParticipant; if (internalPhdParticipant.isGuidingOrAssistantGuiding() && internalPhdParticipant.getPerson().getTeacher() != null && internalPhdParticipant .getPerson() .getTeacher() .isActiveOrHasAuthorizationForSemester(executionSemester)) { teachers.add(internalPhdParticipant.getPerson().getTeacher()); } } } } } } } return teachers; }
@Atomic private Map<ExecutionDegree, Integer> setFirstYearShiftsCapacity( Boolean toBlock, ExecutionYear executionYear) { final ExecutionSemester executionSemester = executionYear.getFirstExecutionPeriod(); final Map<Shift, Set<ExecutionDegree>> shiftsDegrees = new HashMap<Shift, Set<ExecutionDegree>>(); final Set<Shift> shifts = new HashSet<Shift>(); final Map<ExecutionDegree, Integer> modified = new HashMap<ExecutionDegree, Integer>(); for (final Degree degree : Degree.readAllByDegreeType( DegreeType.BOLONHA_DEGREE, DegreeType.BOLONHA_INTEGRATED_MASTER_DEGREE)) { for (final DegreeCurricularPlan degreeCurricularPlan : degree.getActiveDegreeCurricularPlans()) { final ExecutionDegree executionDegree = degreeCurricularPlan.getExecutionDegreeByAcademicInterval( executionSemester.getExecutionYear().getAcademicInterval()); if (executionDegree != null) { for (final SchoolClass schoolClass : executionDegree.getSchoolClassesSet()) { if (schoolClass.getAnoCurricular().equals(FIRST_CURRICULAR_YEAR) && schoolClass.getExecutionPeriod() == executionSemester) { for (final Shift shift : schoolClass.getAssociatedShiftsSet()) { Set<ExecutionDegree> executionDegrees = shiftsDegrees.get(shift); if (executionDegrees == null) { executionDegrees = new HashSet<ExecutionDegree>(); } executionDegrees.add(executionDegree); shiftsDegrees.put(shift, executionDegrees); shifts.add(shift); } } } } } } for (final Shift shift : shifts) { int capacity = shift.getLotacao().intValue(); if (toBlock && capacity > 0) { shift.setLotacao(capacity * -1); } else if (!toBlock && capacity < 0) { shift.setLotacao(capacity * -1); } else { continue; } for (ExecutionDegree executionDegree : shiftsDegrees.get(shift)) { if (modified.containsKey(executionDegree)) { modified.put(executionDegree, modified.get(executionDegree) + 1); } else { modified.put(executionDegree, 1); } } } if (modified.size() > 0) { new FirstYearShiftsCapacityToggleLog( executionYear.getFirstExecutionPeriod(), Authenticate.getUser().getPerson().getUser()); } return modified; }