if (newNumberOfPeriods == 2 && courseLoads.size() == 1) { courseLoads.add(new CourseLoad());
if (newNumberOfPeriods > getNumberOfPeriods().intValue()) { courseLoads.add(new CourseLoad(2));
    private void calculateCourseLoad(String regime, int newNumberOfPeriods) throws FenixFilterException, FenixServiceException {        final List<CourseLoad> courseLoads = getCourseLoads();        if (regime.equals("ANUAL")) {            if (newNumberOfPeriods == 2 && courseLoads.size() == 1) {                courseLoads.add(new CourseLoad());                            } else if (courseLoads.size() > 1) {                courseLoads.remove(0);            }            setCourseLoads(courseLoads);        } else if (regime.equals("SEMESTER")) {            if (courseLoads.size() > 1) {                courseLoads.remove(0);                setCourseLoads(courseLoads);            }                        setNumberOfPeriods(Integer.valueOf(1));            setNumberOfPeriods = false; // prevent jsf to reset the value        }    }