package net.sourceforge.fenixedu.domain; import net.sourceforge.fenixedu.domain.exceptions.DomainException; import com.linkare.commons.metainfo.Linkare; @Linkare(author = "Paulo Zenida") public class SpecialSituationCode extends SpecialSituationCode_Base { public SpecialSituationCode() { super(); setRootDomainObject(RootDomainObject.getInstance()); } public void delete() { if (canBeDeleted()) { setRootDomainObject(null); super.deleteDomainObject(); } else { throw new DomainException("error.cannot.delete.specialSituationCode"); } } private boolean canBeDeleted() { return !hasAnyYearStudentSpecialSituationCodes(); } }