package net.sourceforge.fenixedu.domain.studentCurriculum; import java.math.BigDecimal; import net.sourceforge.fenixedu.domain.Enrolment; import net.sourceforge.fenixedu.domain.exceptions.DomainException; /** * * @author rjmvo * */ public class ISCTEInternalEnrolmentWrapper extends ISCTEInternalEnrolmentWrapper_Base implements ISCTECurriculumEntryWrapper { public ISCTEInternalEnrolmentWrapper() { super(); } public ISCTEInternalEnrolmentWrapper(Certification certification, Enrolment enrolment) { this(); if (certification == null) { throw new DomainException("error.EnrolmentWrapper.certification.cannot.be.null"); } setCertification(certification); super.init(enrolment); } public ISCTEInternalEnrolmentWrapper(Credits credits, Enrolment enrolment, Double creditsWeight, Double creditsEcts) { this(); init(credits, enrolment, creditsWeight, creditsEcts); } protected void init(Credits credits, Enrolment enrolment, Double creditsWeight, Double creditsEcts) { init(credits); super.init(enrolment); if (creditsEcts == null) { throw new DomainException("error.EnrolmentWrapper.givenCredits.cannot.be.null"); } setCreditsWeight(creditsWeight); setCreditsEcts(creditsEcts); } public boolean isInternal() { return true; } public final BigDecimal getWeight() { return getCreditsWeight() != null ? new BigDecimal(getCreditsWeight()) : getIEnrolment().getWeigthForCurriculum(); } public final BigDecimal getEctsCredits() { return getCreditsEcts() != null ? new BigDecimal(getCreditsEcts()) : getIEnrolment().getEctsCreditsForCurriculum(); } @Override public void delete() { removeCertification(); super.delete(); } public void setWeight(BigDecimal weight) { super.setCreditsWeight(weight.doubleValue()); } }