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); } } }
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); } } }
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; }
private void validateParameter() { if (BeanUtils.isEmpty(this.getExamResultId())) { throw new CoreException(CoreExceptionMessage.PARAMETER_NOT_FOUND); } }