package net.sourceforge.fenixedu.domain.serviceRequests.documentRequests; import net.sourceforge.fenixedu.dataTransferObject.student.RegistrationConclusionBean; import net.sourceforge.fenixedu.domain.ExecutionYear; import net.sourceforge.fenixedu.domain.StudentCurricularPlan; import net.sourceforge.fenixedu.domain.accounting.EventType; import net.sourceforge.fenixedu.domain.degreeStructure.CycleType; import net.sourceforge.fenixedu.domain.student.Registration; import net.sourceforge.fenixedu.domain.studentCurriculum.CycleCurriculumGroup; /** * * @author rjmvo * */ public class ISCTEDiplomaSupplementRequest extends ISCTEDiplomaSupplementRequest_Base { public ISCTEDiplomaSupplementRequest(Registration registration, CycleType cycleType) { init(registration, null, Boolean.FALSE, Boolean.TRUE); setRequestedCycle(cycleType); } @Override public StudentCurricularPlan getStudentCurricularPlan() { Registration registration = getRegistration(); return registration.getLastStudentCurricularPlan(); } @Override public CycleType getRequestedCycle() { CycleType cycle = super.getRequestedCycle(); if (cycle == null) { cycle = getRegistration().getLastConcludedCycleType(); } return cycle == null ? getDegreeType().getCycleType() : cycle; } @Override public ExecutionYear getExecutionYear() { return ExecutionYear.readCurrentExecutionYear(); } public Integer getFinalAverage() { CycleCurriculumGroup group = getCycleCurriculumGroup(); RegistrationConclusionBean bean = new RegistrationConclusionBean(getRegistration(), group); return bean.getFinalAverage(); } private CycleCurriculumGroup getCycleCurriculumGroup() { CycleType cycle = super.getRequestedCycle(); StudentCurricularPlan scp = getStudentCurricularPlan(); return cycle == null ? scp.getLastCycleCurriculumGroup() : scp.getCycle(cycle); } @Override public DocumentRequestType getDocumentRequestType() { return DocumentRequestType.DIPLOMA_SUPPLEMENT_REQUEST; } @Override public String getDocumentTemplateKey() { return getClass().getName(); } @Override public boolean isToPrint() { return true; } @Override public boolean isPagedDocument() { return true; } @Override public EventType getEventType() { return null; } }