if (unit.isDepartmentUnit()) { if (sonGrouping != null) { sonGrouping.setParent(rootGrouping); } return;
if (unit.isDepartmentUnit()) { if (sonGrouping != null) { sonGrouping.setParent(rootGrouping); } return; }  ValuationGrouping newGrouping = unitNewGrouping.get(unit);  if (newGrouping == null) { List<ValuationTeacher> teachersList = new ArrayList<ValuationTeacher>(); teachersList.add(valuationTeacher); List<ValuationCompetenceCourse> emptyValuationCompetenceCourseList = new ArrayList<ValuationCompetenceCourse>();  newGrouping = new ValuationGrouping(this, unit.getName(), null, teachersList, emptyValuationCompetenceCourseList, null, null); unitNewGrouping.put(unit, newGrouping);  if (sonGrouping != null) { sonGrouping.setParent(newGrouping); }  for (Unit parentUnit : unit.getParentByOrganizationalStructureAccountabilityType()) { for (Unit grandParentUnit : parentUnit .getParentByOrganizationalStructureAccountabilityType()) { if (!grandParentUnit.getParentByOrganizationalStructureAccountabilityType() .isEmpty()) { createChildUnitsGroupingsForTeachers(valuationTeacher, parentUnit, newGrouping, rootGrouping, unitNewGrouping); }
	private void createChildUnitsGroupingsForTeachers(			ValuationTeacher valuationTeacher,			Unit unit,			ValuationGrouping sonGrouping,			ValuationGrouping rootGrouping,			HashMap<Unit, ValuationGrouping> unitNewGrouping) {		if (unit.isDepartmentUnit()) {			if (sonGrouping != null) {				sonGrouping.setParent(rootGrouping);			}			return;		}		ValuationGrouping newGrouping = unitNewGrouping.get(unit);		if (newGrouping == null) {			List<ValuationTeacher> teachersList = new ArrayList<ValuationTeacher>();			teachersList.add(valuationTeacher);			List<ValuationCompetenceCourse> emptyValuationCompetenceCourseList = new ArrayList<ValuationCompetenceCourse>();			newGrouping = new ValuationGrouping(					this,					unit.getName(),					null,					teachersList,					emptyValuationCompetenceCourseList,					null,					null);			unitNewGrouping.put(unit, newGrouping);			if (sonGrouping != null) {				sonGrouping.setParent(newGrouping);			}			for (Unit parentUnit : unit.getParentByOrganizationalStructureAccountabilityType()) {				for (Unit grandParentUnit : parentUnit.getParentByOrganizationalStructureAccountabilityType()) {					if (!grandParentUnit.getParentByOrganizationalStructureAccountabilityType().isEmpty()) {						createChildUnitsGroupingsForTeachers(								valuationTeacher,								parentUnit,								newGrouping,								rootGrouping,								unitNewGrouping);					}				}			}		} else {			newGrouping.addValuationTeachers(valuationTeacher);			for (ValuationGrouping parentGrouping = newGrouping.getParent(); parentGrouping != null					&& parentGrouping != rootGrouping; parentGrouping = parentGrouping.getParent()) {				parentGrouping.addValuationTeachers(valuationTeacher);			}		}	}