Source:
<code>private ValidationResult checkForOutOfSyncNetworks() { for (NetworkAttachment networkAttachment : getParameters().getNetworkAttachments()) { boolean newNetworkAttachment = networkAttachment.getId() == null; if (newNetworkAttachment) { continue; } boolean doNotCheckForOutOfSync = networkAttachment.isOverrideConfiguration(); if (doNotCheckForOutOfSync) { continue; } Map<Guid, NetworkAttachment> existingNetworkAttachmentMap = Entities.businessEntitiesById(getExistingAttachments()); NetworkAttachment existingNetworkAttachment = existingNetworkAttachmentMap.get(networkAttachment.getId()); VdsNetworkInterface nic = NetworkUtils.hostInterfacesByNetworkName(getExistingNics()) .get(existingNetworkAttachment.getNetworkName()); NetworkImplementationDetails networkImplementationDetails = nic.getNetworkImplementationDetails(); boolean networkIsNotInSync = networkImplementationDetails != null && !networkImplementationDetails.isInSync(); reportedConfigurationsFiller.fillReportedConfiguration(existingNetworkAttachment, getVdsId()); if (networkIsNotInSync) { List<String> errors = new ArrayList<>(); List<ReportedConfiguration> reportedConfigurations = existingNetworkAttachment.getReportedConfigurations().getReportedConfigurationList(); List<ReportedConfiguration> outOfSyncReportedConfigurations = reportedConfigurations.stream().filter(config -> !config.isInSync()).collect( Collectors.toList()); Collections.sort(outOfSyncReportedConfigurations, Comparator.comparing(r -> r.getType().getName())); outOfSyncReportedConfigurations.stream().forEach(reportedConfiguration -> { errors.add(String.format("${%s} ${HOST_OUT_OF_SYNC} - %s, ${DC_OUT_OF_SYNC} - %s", reportedConfiguration.getType().getName().toUpperCase(), reportedConfiguration.getActualValue(), reportedConfiguration.getExpectedValue())); addValidationMessage(reportedConfiguration.getType().getName().toUpperCase()); }); addValidationMessage(EngineMessage.HOST_OUT_OF_SYNC); addValidationMessage(EngineMessage.DC_OUT_OF_SYNC); addValidationMessageVariable("OUT_OF_SYNC_VALUES", StringUtils.join(errors, <START> ", ")); <END> return new ValidationResult(EngineMessage.NETWORK_NOT_IN_SYNC, ReplacementUtils.createSetVariableString("NETWORK_NOT_IN_SYNC", existingNetworkAttachment.getNetworkName())); } } return ValidationResult.VALID; }</code><technical_language>;</technical_language>

Target:
private ValidationResult checkForOutOfSyncNetworks() { for (NetworkAttachment networkAttachment : getParameters().getNetworkAttachments()) { boolean newNetworkAttachment = networkAttachment.getId() == null; if (newNetworkAttachment) { continue; } boolean doNotCheckForOutOfSync = networkAttachment.isOverrideConfiguration(); if (doNotCheckForOutOfSync) { continue; } Map<Guid, NetworkAttachment> existingNetworkAttachmentMap = Entities.businessEntitiesById(getExistingAttachments()); NetworkAttachment existingNetworkAttachment = existingNetworkAttachmentMap.get(networkAttachment.getId()); VdsNetworkInterface nic = NetworkUtils.hostInterfacesByNetworkName(getExistingNics()) .get(existingNetworkAttachment.getNetworkName()); NetworkImplementationDetails networkImplementationDetails = nic.getNetworkImplementationDetails(); boolean networkIsNotInSync = networkImplementationDetails != null && !networkImplementationDetails.isInSync(); reportedConfigurationsFiller.fillReportedConfiguration(existingNetworkAttachment, getVdsId()); if (networkIsNotInSync) { List<String> errors = new ArrayList<>(); List<ReportedConfiguration> reportedConfigurations = existingNetworkAttachment.getReportedConfigurations().getReportedConfigurationList(); List<ReportedConfiguration> outOfSyncReportedConfigurations = reportedConfigurations.stream().filter(config -> !config.isInSync()).collect( Collectors.toList()); Collections.sort(outOfSyncReportedConfigurations, Comparator.comparing(r -> r.getType().getName())); outOfSyncReportedConfigurations.stream().forEach(reportedConfiguration -> { errors.add(String.format("${%s} ${HOST_OUT_OF_SYNC} - %s, ${DC_OUT_OF_SYNC} - %s", reportedConfiguration.getType().getName().toUpperCase(), reportedConfiguration.getActualValue(), reportedConfiguration.getExpectedValue())); addValidationMessage(reportedConfiguration.getType().getName().toUpperCase()); }); addValidationMessage(EngineMessage.HOST_OUT_OF_SYNC); addValidationMessage(EngineMessage.DC_OUT_OF_SYNC); addValidationMessageVariable("OUT_OF_SYNC_VALUES", StringUtils.join(errors, "; ")); return new ValidationResult(EngineMessage.NETWORK_NOT_IN_SYNC, ReplacementUtils.createSetVariableString("NETWORK_NOT_IN_SYNC", existingNetworkAttachment.getNetworkName())); } } return ValidationResult.VALID; }