/* * Created on Mar 18, 2005 * */ package net.sourceforge.fenixedu.domain.inquiries; import net.sourceforge.fenixedu.dataTransferObject.inquiries.InfoInquiriesCourse3; import net.sourceforge.fenixedu.dataTransferObject.inquiries.InfoInquiriesTeacher3; import net.sourceforge.fenixedu.dataTransferObject.inquiries.InfoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes; import net.sourceforge.fenixedu.domain.ExecutionCourse; import net.sourceforge.fenixedu.domain.ExecutionDegree; import net.sourceforge.fenixedu.domain.ExecutionPeriod; import net.sourceforge.fenixedu.domain.NonAffiliatedTeacher; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.ShiftType; import net.sourceforge.fenixedu.domain.Teacher; import net.sourceforge.fenixedu.domain.exceptions.DomainException; /** * @author Joćo Fialho & Rita Ferreira * */ public class InquiriesCourse3 extends InquiriesCourse3_Base { public InquiriesCourse3() { super(); setRootDomainObject(RootDomainObject.getInstance()); this.setAnswered(false); } /** * * @param inquiriesDemographicalAndAcademical3 * @param executionCourse * @param executionDegreeCourse * @param executionDegreeStudent * @param executionPeriod * @param schoolClass * @param infoInquiriesCourse3 * * Preconditions: - executionCourse != null - executionDegreeCourse != * null - executionDegreeStudent != null - executionPeriod != null * Postcondition: - A new inquiriesCourse is created, referencing * correctly the other domainObjects and its basic properties are * initialized Invariants: - None */ public InquiriesCourse3(InquiriesDemographicalAndAcademical3 inquiriesDemographicalAndAcademical3, ExecutionCourse executionCourse, ExecutionDegree executionDegreeCourse, ExecutionDegree executionDegreeStudent, ExecutionPeriod executionPeriod, InfoInquiriesCourse3 infoInquiriesCourse3, Character entryGradeClassification, Character approvationRatioClassification, Character arithmeticMeanClassification) { this(); this.setInquiriesDemographicalAndAcademical3(inquiriesDemographicalAndAcademical3); if ((executionCourse == null) || (executionDegreeCourse == null) || (executionDegreeStudent == null) || (executionPeriod == null)) { throw new DomainException( "Neither the executionCourse, executionDegreeCourse, executionDegreeStudent nor executionPeriod should not be null!"); } this.setExecutionCourse(executionCourse); this.setExecutionDegree(executionDegreeCourse); this.setEntryGradeClassification(entryGradeClassification); this.setApprovationRatioClassification(approvationRatioClassification); this.setArithmeticMeanClassification(arithmeticMeanClassification); this.setBasicProperties(infoInquiriesCourse3); for (InfoInquiriesTeacher3 infoInquiryTeacher3 : infoInquiriesCourse3.getInfoInquiriesTeachers3()) { for (ShiftType shiftType : infoInquiryTeacher3.getClassTypes()) { InfoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes infoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes = infoInquiryTeacher3 .getTeacherOrNonAffiliatedTeacher(); if (infoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes.getTeacher() != null) { Teacher teacher = getRootDomainObject().readTeacherByOID( infoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes.getIdInternal()); createInquiriesTeacher3(teacher, shiftType, infoInquiryTeacher3); } else if (infoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes .getNonAffiliatedTeacher() != null) { NonAffiliatedTeacher nonAffiliatedTeacher = getRootDomainObject() .readNonAffiliatedTeacherByOID( infoTeacherOrNonAffiliatedTeacherWithRemainingClassTypes .getIdInternal()); createInquiriesTeacher3(nonAffiliatedTeacher, shiftType, infoInquiryTeacher3); } } } } public void createInquiriesTeacher3(Teacher teacher, ShiftType shiftType, InfoInquiriesTeacher3 infoInquiriesTeacher3) { new InquiriesTeacher3(this, teacher, shiftType, infoInquiriesTeacher3); } public void createInquiriesTeacher3(NonAffiliatedTeacher nonAffiliatedTeacher, ShiftType shiftType, InfoInquiriesTeacher3 infoInquiriesTeacher3) { new InquiriesTeacher3(this, nonAffiliatedTeacher, shiftType, infoInquiriesTeacher3); } private void setBasicProperties(InfoInquiriesCourse3 infoInquiriesCourse3) { this.setStudentFirstEnrollment(infoInquiriesCourse3.getStudentFirstEnrollment()); this.setOnlineInfo(infoInquiriesCourse3.getOnlineInfo()); this.setClassCoordination(infoInquiriesCourse3.getClassCoordination()); this.setStudyElementsContribution(infoInquiriesCourse3.getStudyElementsContribution()); this.setPreviousKnowledgeArticulation(infoInquiriesCourse3.getPreviousKnowledgeArticulation()); this.setContributionForGraduation(infoInquiriesCourse3.getContributionForGraduation()); this.setEvaluationMethodAdequation(infoInquiriesCourse3.getEvaluationMethodAdequation()); this.setWeeklySpentHours(infoInquiriesCourse3.getWeeklySpentHours()); this.setGlobalAppreciation(infoInquiriesCourse3.getGlobalAppreciation()!=null?infoInquiriesCourse3.getGlobalAppreciation().doubleValue():null); this.setCourseWareStructuring(infoInquiriesCourse3.getCourseWareStructuring()); this.setOtherCoursesArticulation(infoInquiriesCourse3.getOtherCoursesArticulation()); this.setProgramLoadVsClassTimeAdequation(infoInquiriesCourse3 .getProgramLoadVsClassTimeAdequation()); this.setFieldWorkKnowledgeApplication(infoInquiriesCourse3.getFieldWorkKnowledgeApplication()); this.setNumEnrollments(infoInquiriesCourse3.getNumEnrollments()); this.setOwnAssiduity(infoInquiriesCourse3.getOwnAssiduity()); this.setOwnDiscussionParticipation(infoInquiriesCourse3.getOwnDiscussionParticipation()); this.setOwnRecommendedReading(infoInquiriesCourse3.getOwnRecommendedReading()); this.setOwnBibliographySearching(infoInquiriesCourse3.getOwnBibliographySearching()); this.setOwnSchemasAndReportsCreation(infoInquiriesCourse3.getOwnSchemasAndReportsCreation()); this.setOwnSubjectIdentificationForFurtherExploration(infoInquiriesCourse3 .getOwnSubjectIdentificationForFurtherExploration()); this.setOwnTeachersDoubtEnlightnment(infoInquiriesCourse3.getOwnTeachersDoubtEnlightnment()); this.setPositivePointOne(infoInquiriesCourse3.getPositivePointOne()); this.setPositivePointTwo(infoInquiriesCourse3.getPositivePointTwo()); this.setPositivePointThree(infoInquiriesCourse3.getPositivePointThree()); this.setImprovmentPointOne(infoInquiriesCourse3.getImprovmentPointOne()); this.setImprovmentPointTwo(infoInquiriesCourse3.getImprovmentPointTwo()); this.setImprovmentPointThree(infoInquiriesCourse3.getImprovmentPointThree()); this.setKnowledgeIncrease(infoInquiriesCourse3.getKnowledgeIncrease()); this.setGlobalInterestLevel(infoInquiriesCourse3.getGlobalInterestLevel()); this.setAnswered(infoInquiriesCourse3.isAnswered()); } public boolean containsInquiryTeacher(Teacher teacher) { for (InquiriesTeacher3 inquiryTeacher3 : getAssociatedInquiriesTeachers3()) { if (inquiryTeacher3.getTeacher() == teacher) return true; } return false; } public void copyFromInfo(InfoInquiriesCourse3 infoInquiryCourse3) { this.setBasicProperties(infoInquiryCourse3); for (InfoInquiriesTeacher3 infoInquiryTeacher3 : infoInquiryCourse3.getInfoInquiriesTeachers3()) { Teacher teacher = infoInquiryTeacher3.getTeacher().getTeacher(); InquiriesTeacher3 inquiryTeacher3 = getAssociatedInquiriesTeacher3ByTeacher(teacher); inquiryTeacher3.copyFromInfo(infoInquiryTeacher3); } } public InquiriesTeacher3 getAssociatedInquiriesTeacher3ByTeacher(Teacher teacher) { for (InquiriesTeacher3 inquiryTeacher3 : getAssociatedInquiriesTeachers3()) if (inquiryTeacher3.getTeacher() == teacher) return inquiryTeacher3; return null; } public void delete() { removeInquiriesDemographicalAndAcademical3(); removeExecutionCourse(); removeExecutionDegree(); while(!getAssociatedInquiriesTeachers3().isEmpty()) getAssociatedInquiriesTeachers3().get(0).delete(); removeRootDomainObject(); super.deleteDomainObject(); } }