public void setDegree(Degree degree) {
this.degree = degree;
}
public MobilityQuota determineMobilityQuota() {
MobilityApplicationPeriod period = (MobilityApplicationPeriod) getCandidacyProcess().getCandidacyPeriod();
MobilityAgreement agreement = getMobilityStudentDataBean().getMobilityAgreement();
Degree selectedDegree = null;
if (getDegree() == null) {
if (getSelectedCurricularCourses() != null && !getSelectedCurricularCourses().isEmpty()) {
selectedDegree = getMostDominantDegreeFromCourses();
} else {
selectedDegree = null;
}
} else {
if ((getSelectedCurricularCourses() == null || getSelectedCurricularCourses().isEmpty())
|| (!getSelectedCurricularCourses().isEmpty() && getDegree() == getMostDominantDegreeFromCourses())
|| getMobilityStudentDataBean().getSelectedMobilityProgram().getRegistrationProtocol()
.isOnlyAllowedDegreeEnrolment()) {
selectedDegree = getDegree();
} else {
throw new DomainException("error.mobility.application.process.courses.and.degree.selection.dont.match");
}
}
MobilityQuota quota = period.getAssociatedOpening(selectedDegree, agreement);
if (quota == null) {
throw new DomainException("error.mobility.application.process.no.courses.from.one.degree.selected");
}