package net.sourceforge.fenixedu.domain.studentCurriculum; import java.util.Collection; import net.sourceforge.fenixedu.dataTransferObject.administrativeOffice.dismissal.ISCTEDismissalBean.DismissalType; import net.sourceforge.fenixedu.dataTransferObject.administrativeOffice.dismissal.ISCTEDismissalBean.SelectedDismissalEntry; import net.sourceforge.fenixedu.dataTransferObject.administrativeOffice.dismissal.ISCTEDismissalBean.SelectedCurriculumEntry; import net.sourceforge.fenixedu.domain.ExecutionPeriod; import net.sourceforge.fenixedu.domain.StudentCurricularPlan; import net.sourceforge.fenixedu.domain.degreeStructure.CourseGroup; import net.sourceforge.fenixedu.domain.exceptions.DomainException; import pt.iscte.ci.metadata.ISCTE; /** * * @author rjmvo * */ public class ISCTEExemptionCredits extends ISCTEExemptionCredits_Base { public ISCTEExemptionCredits() { super(); } public ISCTEExemptionCredits(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, Collection dismissals) { this(); init(scp, executionPeriod, enrolments, dismissals); } public ISCTEExemptionCredits(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, CurriculumGroup curriculumGroup, Double givenCredits) { this(); init(scp, executionPeriod, enrolments, curriculumGroup, givenCredits); } public ISCTEExemptionCredits(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, Collection dismissals, CourseGroup courseGroup, Double givenCredits) { this(); init(scp, executionPeriod, enrolments, dismissals, courseGroup, givenCredits); } private void init(StudentCurricularPlan scp, ExecutionPeriod executionPeriod) { initExecutionPeriod(executionPeriod); if (scp == null) { throw new DomainException("error.substitution.wrong.arguments"); } setStudentCurricularPlan(scp); } protected void init(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, Collection dismissals) { initExecutionPeriod(executionPeriod); if (scp == null) { throw new DomainException("error.substitution.wrong.arguments"); } if (dismissals == null || dismissals.isEmpty()) { throw new DomainException("error.substitution.wrong.arguments"); } setStudentCurricularPlan(scp); ISCTEDismissalsUtils.addCurriculumEntries(this, enrolments); ISCTEDismissalsUtils.addDismissalsEntries(this, dismissals); } protected void init(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, CurriculumGroup curriculumGroup, Double givenCredits) { init(scp, executionPeriod); if (curriculumGroup == null || givenCredits == null) { throw new DomainException("error.substitution.wrong.arguments"); } setGivenCredits(givenCredits); ISCTEDismissalsUtils.addCurriculumEntries(this, enrolments); Dismissal.createNewDismissal(this, scp, curriculumGroup, ISCTEDismissalsUtils.getEmptyCurricularCourses()); } protected void init(StudentCurricularPlan scp, ExecutionPeriod executionPeriod, Collection enrolments, Collection dismissals, CourseGroup courseGroup, Double givenCredits) { init(scp, executionPeriod); if (courseGroup == null || givenCredits == null) { throw new DomainException("error.substitution.wrong.arguments"); } setGivenCredits(givenCredits); ISCTEDismissalsUtils.addCurriculumEntries(this, enrolments); Dismissal.createNewDismissal(this, scp, courseGroup, ISCTEDismissalsUtils.getCurricularCourses(dismissals)); } public static Credits createDismissal(StudentCurricularPlan scp, CourseGroup courseGroup, CurriculumGroup curriculumGroup, Collection enrolments, Collection dismissals, ExecutionPeriod executionPeriod, Double givenCredits, DismissalType type) { switch (type) { case CURRICULAR_COURSE_CREDITS: return new ISCTEExemptionCredits(scp, executionPeriod, enrolments, dismissals); case CURRICULUM_GROUP_CREDITS: return new ISCTEExemptionCredits(scp, executionPeriod, enrolments, dismissals, courseGroup, givenCredits); case NO_COURSE_GROUP_CURRICULUM_GROUP_CREDITS: return new ISCTEExemptionCredits(scp, executionPeriod, enrolments, curriculumGroup, givenCredits); } return null; } @ISCTE(author = "Nadir Amin") @Override public String getShortTypeDescription() { return "EC"; } }