Integer daysBetween = CalendarUtil.getNumberOfDaysBetweenDates( teacherServiceExemption.getStart(), teacherServiceExemption .getEnd()); if (occupationPeriod .containsDay(teacherServiceExemption.getStart())) { if (teacherServiceExemption.getType().equals( ServiceExemptionType.SABBATICAL)) { return 6; } else if (daysBetween > 90) {  return getHoursByCategory(executionPeriod); } } else { occupationPeriod = getLessonsPeriod(executionPeriod .getPreviousExecutionPeriod()); if (occupationPeriod != null && occupationPeriod.containsDay(teacherServiceExemption .getStart()) && daysBetween > 185 ) { if (teacherServiceExemption.getType().equals( ServiceExemptionType.SABBATICAL)) { return 6; } else { return getHoursByCategory(executionPeriod); } } else if (executionPeriod.containsDay(teacherServiceExemption .getStart())) { if (teacherServiceExemption.getType().equals( ServiceExemptionType.SABBATICAL)) { return 6; } else { return getHoursByCategory(executionPeriod); } } } } return 0; }
Integer daysBetween = CalendarUtil.getNumberOfDaysBetweenDates(teacherServiceExemption .getStart(), teacherServiceExemption.getEnd()); if (occupationPeriod.containsDay(teacherServiceExemption.getStart())) { if (teacherServiceExemption.getType().equals(ServiceExemptionType.SABBATICAL)) { return 6; } else if (daysBetween > 90) {  return getHoursByCategory(executionPeriod); } } else { occupationPeriod = getLessonsPeriod(executionPeriod.getPreviousExecutionPeriod()); if (occupationPeriod != null && occupationPeriod.containsDay(teacherServiceExemption.getStart()) && daysBetween > 185) { if (teacherServiceExemption.getType().equals(ServiceExemptionType.SABBATICAL)) { return 6; } else { return getHoursByCategory(executionPeriod); } } else { if (executionPeriod.containsDay(teacherServiceExemption.getStart())) { if (teacherServiceExemption.getType().equals(ServiceExemptionType.SABBATICAL)) { return 6; } else { return getHoursByCategory(executionPeriod); } } else if (executionPeriod.getPreviousExecutionPeriod().containsDay( teacherServiceExemption.getStart()) && daysBetween > 185) { if (teacherServiceExemption.getType().equals(ServiceExemptionType.SABBATICAL)) { return 6; } else { return getHoursByCategory(executionPeriod); } } } } } return 0; }
	private int calculateServiceExemptionsCredits(			List<TeacherServiceExemption> list, ExecutionPeriod executionPeriod) {		OccupationPeriod occupationPeriod = getLessonsPeriod(executionPeriod);		if (occupationPeriod == null) {			return 0;		}		TeacherServiceExemption teacherServiceExemption = getTeacherServiceExemption(				list, occupationPeriod);		if (teacherServiceExemption != null				&& (teacherServiceExemption.getType().equals(						ServiceExemptionType.SABBATICAL)						|| teacherServiceExemption								.getType()								.equals(										ServiceExemptionType.GRANT_OWNER_EQUIVALENCE_WITHOUT_SALARY)						|| teacherServiceExemption								.getType()								.equals(										ServiceExemptionType.GRANT_OWNER_EQUIVALENCE_WITH_SALARY)						|| teacherServiceExemption								.getType()								.equals(										ServiceExemptionType.GRANT_OWNER_EQUIVALENCE_WITH_SALARY_SABBATICAL) || teacherServiceExemption						.getType()						.equals(								ServiceExemptionType.GRANT_OWNER_EQUIVALENCE_WITH_SALARY_WITH_DEBITS))) {			Integer daysBetween = CalendarUtil.getNumberOfDaysBetweenDates(					teacherServiceExemption.getStart(), teacherServiceExemption							.getEnd());			if (occupationPeriod					.containsDay(teacherServiceExemption.getStart())) {				if (teacherServiceExemption.getType().equals(						ServiceExemptionType.SABBATICAL)) {					return 6;				} else if (daysBetween > 90) { // to be considered long term					// grant owner					return getHoursByCategory(executionPeriod);				}			} else {				occupationPeriod = getLessonsPeriod(executionPeriod						.getPreviousExecutionPeriod());				if (occupationPeriod != null						&& occupationPeriod.containsDay(teacherServiceExemption								.getStart()) && daysBetween > 185 /*																	 * more than																	 * 6 months																	 */) {					if (teacherServiceExemption.getType().equals(							ServiceExemptionType.SABBATICAL)) {						return 6;					} else {						return getHoursByCategory(executionPeriod);					}				} else if (executionPeriod.containsDay(teacherServiceExemption						.getStart())) {					if (teacherServiceExemption.getType().equals(							ServiceExemptionType.SABBATICAL)) {						return 6;					} else {						return getHoursByCategory(executionPeriod);					}				}			}		}		return 0;	}