package net.sourceforge.fenixedu.domain.accounting.events; import net.sourceforge.fenixedu.domain.Employee; import net.sourceforge.fenixedu.domain.accounting.Event; import net.sourceforge.fenixedu.domain.accounting.Exemption; import net.sourceforge.fenixedu.domain.exceptions.DomainException; import org.joda.time.YearMonthDay; import com.linkare.commons.metainfo.Linkare; import dml.runtime.RelationAdapter; @Linkare(author = "Paulo Zenida") public class EnrolmentInAppealSeasonPenaltyExemption extends EnrolmentInAppealSeasonPenaltyExemption_Base { static { ExemptionEvent.addListener(new RelationAdapter() { @Override public void beforeAdd(Exemption exemption, Event event) { if (exemption != null && event != null) { if (exemption instanceof EnrolmentInAppealSeasonPenaltyExemption) { final EnrolmentInAppealSeasonEvent enrolmentInAppealSeasonEvent = ((EnrolmentInAppealSeasonEvent) event); if (enrolmentInAppealSeasonEvent.hasEnrolmentInAppealSeasonPenaltyExemption()) { throw new DomainException( "error.accounting.events.EnrolmentInAppealSeasonPenaltyExemption.event.already.has.exemption"); } } } } }); } protected EnrolmentInAppealSeasonPenaltyExemption() { super(); } public EnrolmentInAppealSeasonPenaltyExemption(final PenaltyExemptionJustificationType penaltyExemptionType, final EnrolmentInAppealSeasonEvent enrolmentInAppealSeasonEvent, final Employee employee, final String comments, final YearMonthDay directiveCouncilDispatchDate) { this(); super.init(penaltyExemptionType, enrolmentInAppealSeasonEvent, employee, comments, directiveCouncilDispatchDate); } }