private void checkDate(YearMonthDay date, ExecutionPeriod period, Lesson lesson, boolean toCreate) { if (toCreate && lesson != null && lesson.getSummaryByDate(date) != null) { throw new DomainException("error.summary.already.exists"); } if (date.isAfter(new YearMonthDay()) || date.isBefore(period.getBeginDateYearMonthDay())) {
private void checkDate(YearMonthDay date, ExecutionPeriod period, Lesson lesson) { if (lesson != null) { Summary summaryByDate = lesson.getSummaryByDate(date); if (summaryByDate != null && !summaryByDate.equals(this)) { throw new DomainException("error.summary.already.exists"); } if (!lesson.isDateValidToInsertSummary(date)) { throw new DomainException("error.summary.no.valid.date.to.lesson"); } if (!lesson.isTimeValidToInsertSummary(new HourMinuteSecond())) { throw new DomainException("error.summary.no.valid.time.to.lesson"); } } else if (date.isAfter(new YearMonthDay()) || date.isBefore(period.getBeginDateYearMonthDay())) {
    private void checkDate(YearMonthDay date, ExecutionPeriod period, Lesson lesson, boolean toCreate) {	if (toCreate && lesson != null && lesson.getSummaryByDate(date) != null) {	    throw new DomainException("error.summary.already.exists");	}	if (date.isAfter(new YearMonthDay()) || date.isBefore(period.getBeginDateYearMonthDay())) {	    throw new DomainException("error.summary.no.valid.date");	}	if (lesson != null && !lesson.isDateValidToInsertSummary(date)) {	    throw new DomainException("error.summary.no.valid.date.to.lesson");	}    }