private void checkIfCanCreateExternalEnrolment( final Registration registration, final ExternalCurricularCourse externalCurricularCourse) { for (final ExternalEnrolment externalEnrolment : registration.getExternalEnrolmentsSet()) { if (externalEnrolment.getExternalCurricularCourse() == externalCurricularCourse) { throw new DomainException( "error.studentCurriculum.ExternalEnrolment.already.exists.externalEnrolment.for.externalCurricularCourse", externalCurricularCourse.getName()); } } }
@Override public int compare(ExternalEnrolment o1, ExternalEnrolment o2) { int result = o1.getName().compareTo(o2.getName()); return (result != 0) ? result : o1.getExternalId().compareTo(o2.getExternalId()); }