OccupationPeriod occupationPeriod = getLessonsPeriod(executionPeriod);
OccupationPeriod occupationPeriod = executionPeriod.getLessonsPeriod();
    public int getMandatoryLessonHours(ExecutionPeriod executionPeriod) {        OccupationPeriod occupationPeriod = getLessonsPeriod(executionPeriod);        if (occupationPeriod == null) {            return 0;        }        List<TeacherLegalRegimen> legalRegimens = getAllLegalRegimensWithoutEndSituations(occupationPeriod                .getStartYearMonthDay(), occupationPeriod.getEndYearMonthDay());        if (!legalRegimens.isEmpty()) {            List<TeacherServiceExemption> exemptions = getServiceExemptionsWithoutMedicalSituations(                    occupationPeriod.getStartYearMonthDay(), occupationPeriod.getEndYearMonthDay());            TeacherServiceExemption teacherServiceExemption = chooseOneServiceExemption(exemptions,                    occupationPeriod);            if (teacherServiceExemption != null                    && teacherServiceExemption.isServiceExemptionToCountZeroInCredits()) {                return 0;            }            Collections.sort(legalRegimens, new BeanComparator("beginDate"));            final Integer hours = legalRegimens.get(legalRegimens.size() - 1).getLessonHours();            return (hours == null) ? 0 : hours.intValue();        }        return 0;    }