package net.sourceforge.fenixedu.domain.student; import net.sourceforge.fenixedu.dataTransferObject.IdInternalBean; import net.sourceforge.fenixedu.dataTransferObject.student.StudentAdditionalInformationBean; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.util.FactoryExecutor; /** * * @author rjmvo * */ public class StudentAdditionalInformation extends StudentAdditionalInformation_Base { public StudentAdditionalInformation() { super(); setRootDomainObject(RootDomainObject.getInstance()); } public void delete() { removeStudent(); removeRootDomainObject(); super.deleteDomainObject(); } public static class StudentAdditionalInformationCreator extends StudentAdditionalInformationBean implements FactoryExecutor { public StudentAdditionalInformationCreator(Student student) { super(student); } public Object execute() { StudentAdditionalInformation info = new StudentAdditionalInformation(); info.setStudent(getStudent()); info.setStartDate(getStartDate()); info.setEndDate(getEndDate()); info.setDescription(getDescription()); return info; } } public static class StudentAdditionalInformationEditor extends StudentAdditionalInformationBean implements FactoryExecutor { private DomainReference info; public StudentAdditionalInformationEditor(StudentAdditionalInformation info) { super(info.getStudent()); setStartDate(info.getStartDate()); setEndDate(info.getEndDate()); setDescription(info.getDescription()); setStudentAdditionalInformation(info); } public StudentAdditionalInformation getStudentAdditionalInformation() { return info == null ? null : info.getObject(); } public void setStudentAdditionalInformation(StudentAdditionalInformation info) { this.info = info == null ? null : new DomainReference(info); } public Object execute() { StudentAdditionalInformation info = getStudentAdditionalInformation(); info.setStartDate(getStartDate()); info.setEndDate(getEndDate()); info.setDescription(getDescription()); return info; } } public static class StudentAdditionalInformationDeleter extends IdInternalBean implements FactoryExecutor { public StudentAdditionalInformationDeleter(Integer idInternal) { super(idInternal); } public Object execute() { RootDomainObject root = RootDomainObject.getInstance(); root.readStudentAdditionalInformationByOID(getIdInternal()).delete(); return null; } } }