コード例 #1
0
ファイル: WriteMarks.java プロジェクト: Kayvlim/fenix
 private static Attends findAttend(final ExecutionCourse executionCourse, final String attendId) {
   for (final Attends attend : executionCourse.getAttends()) {
     if (attend.getExternalId().equals(attendId)) {
       return attend;
     }
   }
   return null;
 }
コード例 #2
0
ファイル: WriteMarks.java プロジェクト: afesteves/fenix
 private static void addMark(
     List<AttendsMark> result,
     StudentMark studentMark,
     Attends attend,
     List<DomainException> exceptionList) {
   if (studentMark.mark.length() - studentMark.mark.indexOf('.') - 1 > 2) {
     exceptionList.add(
         new DomainException("error.mark.more.than.two.decimals", studentMark.studentNumber));
   } else {
     result.add(new AttendsMark(attend.getExternalId(), studentMark.mark));
   }
 }
コード例 #3
0
ファイル: WriteMarks.java プロジェクト: Kayvlim/fenix
  private static List<AttendsMark> convertMarks(
      final ExecutionCourse executionCourse, final List<StudentMark> marks)
      throws FenixServiceMultipleException {

    final List<DomainException> exceptionList = new ArrayList<DomainException>();
    final List<AttendsMark> result = new ArrayList<AttendsMark>();

    for (final StudentMark studentMark : marks) {
      final Attends attend = findAttend(executionCourse, studentMark.studentNumber, exceptionList);
      if (attend != null) {
        result.add(new AttendsMark(attend.getExternalId(), studentMark.mark));
      }
    }

    if (!exceptionList.isEmpty()) {
      throw new FenixServiceMultipleException(exceptionList);
    }

    return result;
  }