Example #1
0
 private void validateDoExamExpired(ExamResult examResult) {
   if (BeanUtils.isNotEmpty(examResult.getExamExpireDate())) {
     Date nowToday = new Date();
     if (nowToday.after(examResult.getExamExpireDate())) {
       throw new CoreException(CoreExceptionMessage.EXAM_EXPIRED);
     }
   }
 }
Example #2
0
 private void validateSaveExamExpired(ExamResult examResult) {
   if (BeanUtils.isNotEmpty(examResult.getExamExpireDate())) {
     Calendar cal = Calendar.getInstance();
     cal.setTime(examResult.getExamExpireDate());
     cal.add(Calendar.MINUTE, 3);
     Date nowToday = new Date();
     if (nowToday.after(cal.getTime())) {
       throw new CoreException(CoreExceptionMessage.EXAM_EXPIRED);
     }
   }
 }
Example #3
0
 private List<ExamResultAnswer> convertExamData(String examResultAnswerData) {
   ObjectMapper mapper = new ObjectMapper();
   List<ExamResultAnswer> results = null;
   if (BeanUtils.isNotEmpty(examResultAnswerData)) {
     try {
       results =
           mapper.readValue(
               examResultAnswerData, new TypeReference<ArrayList<ExamResultAnswer>>() {});
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return results;
 }