/* * Created on Mar 18, 2005 * */ package net.sourceforge.fenixedu.domain.inquiries; import net.sourceforge.fenixedu.domain.ExecutionPeriod; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.student.Registration; import org.apache.commons.lang.NullArgumentException; import pt.iscte.ci.metadata.ISCTE; /** * @author José Pedro Pereira - DSI - ISCTE - Linkare TI * */ public class InquiriesRegistry3 extends InquiriesRegistry3_Base { public InquiriesRegistry3() { super(); setRootDomainObject(RootDomainObject.getInstance()); setEligibleForPrize(false); setFinishedAnswering(Boolean.FALSE); setWhyNotAnswer(null); setWillAnswer(null); setIsToUnlock(false); } public InquiriesRegistry3(ExecutionPeriod executionPeriod, Registration registration) { this(); if ((executionPeriod == null) || (registration == null)) { throw new NullArgumentException("The executionCourse, executionPeriod and student should not be null!"); } this.setExecutionPeriod(executionPeriod); this.setStudent(registration); } @ISCTE(author = "ajsco", comment = "Required for inquiries sanction") public boolean isLocked() { if (getFinishedAnswering() || !getWillAnswer() && hasJustified()) { return false; } return !getIsToUnlock(); } @ISCTE(author = "ajsco", comment = "Required for inquiries sanction") public boolean wasRegistryCreatedForSanction() { return "pt.iscte.ci.scripts.once.CreateInquiryRegistryForNonCompletedInquiries3".equals(getUpdateEntity()); } @ISCTE(author = "ajsco", comment = "Required for inquiries sanction") public boolean hasJustified() { return getWhyNotAnswer() != null && getWhyNotAnswer().trim().length() > 0; } @ISCTE(author = "Nadir Amin") public void delete() { removeStudentSchoolClass(); removeUnlockResponsible(); removeExecutionPeriod(); removeStudent(); removeRootDomainObject(); super.deleteDomainObject(); } }