private void modifyExistingOUs(List<OrganizationalUnit> newOUs, List<OrganizationalUnit> oldOUs) {
logger.debug("IN");
Iterator<OrganizationalUnit> it = oldOUs.iterator();
while (it.hasNext()) {
OrganizationalUnit ou = it.next();
int index = newOUs.indexOf(ou);
if (index >= 0) {
OrganizationalUnit newOU = newOUs.get(index);
if (!newOU.deepEquals(ou)) {
logger.debug("OU " + ou + " has been changed. Updating it ...");
ou.setName(newOU.getName());
ou.setDescription(newOU.getDescription());
DAOFactory.getOrganizationalUnitDAO().modifyOrganizationalUnit(ou);
logger.debug("OU updated: " + ou);
}
newOU.setId(ou.getId()); // setting the current OU id
logger.debug("OU id updated: " + newOU);
}
}
logger.debug("OUT");
}