Source:
<code>public void merge(BuildPlan source) { Assert.isNotNull(source); @SuppressWarnings("serial") EcoreUtil.Copier copier = new EcoreUtil.Copier() { @Override protected EObject createCopy(EObject source) { return BuildPlan.this; }; @Override protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { super.copyAttribute(eAttribute, eObject, copyEObject); } @Override protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { } }; copier.copy(source); getParameterDefinitions().clear(); getParameterDefinitions().addAll(EcoreUtil.copyAll(source.getParameterDefinitions())); getFlags().clear(); getFlags().addAll(source.getFlags()); getHealthReports().clear(); getHealthReports().addAll(EcoreUtil.copyAll(source.getHealthReports())); getAttributes().clear(); getAttributes().putAll(source.getAttributes()); List<IBuildPlan> childrenCopy = new ArrayList<>(); source.getChildren().forEach(sourceChild -> { Optional<IBuildPlan> maybeChild = getChildren().stream() .filter(ch -> ch.getId().equals(sourceChild.getId())) .findAny(); if (maybeChild.isPresent()) { BuildPlan child = (BuildPlan) maybeChild.get(); child.merge((BuildPlan) sourceChild); } childrenCopy.add(maybeChild.orElse(sourceChild)); }); childrenCopy.forEach(child -> { child.setParent(this); child.setSelected(isSelected()); if (child.getServer() == null) { child.setServer(getServer()); child.setRefreshDate(refreshDate); } }); getChildren().clear(); getChildren().addAll(childrenCopy); <START> if (getParent() != null) { <END> if (server == null && getParent().getServer() != null) { setServer(getParent().getServer()); } } }</code><technical_language>this required longer I think</technical_language>

Target:
public void merge(BuildPlan source) { Assert.isNotNull(source); @SuppressWarnings("serial") EcoreUtil.Copier copier = new EcoreUtil.Copier() { @Override protected EObject createCopy(EObject source) { return BuildPlan.this; }; @Override protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { super.copyAttribute(eAttribute, eObject, copyEObject); } @Override protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { } }; copier.copy(source); getParameterDefinitions().clear(); getParameterDefinitions().addAll(EcoreUtil.copyAll(source.getParameterDefinitions())); getFlags().clear(); getFlags().addAll(source.getFlags()); getHealthReports().clear(); getHealthReports().addAll(EcoreUtil.copyAll(source.getHealthReports())); getAttributes().clear(); getAttributes().putAll(source.getAttributes()); List<IBuildPlan> childrenCopy = new ArrayList<>(); source.getChildren().forEach(sourceChild -> { Optional<IBuildPlan> maybeChild = getChildren().stream() .filter(ch -> ch.getId().equals(sourceChild.getId())) .findAny(); if (maybeChild.isPresent()) { BuildPlan child = (BuildPlan) maybeChild.get(); child.merge((BuildPlan) sourceChild); } childrenCopy.add(maybeChild.orElse(sourceChild)); }); childrenCopy.forEach(child -> { child.setParent(this); child.setSelected(isSelected()); if (child.getServer() == null) { child.setServer(getServer()); child.setRefreshDate(refreshDate); } }); getChildren().clear(); getChildren().addAll(childrenCopy); }