Source:
private EntitiesValidationReport buildValidationReport(RepositoryCollection source, MyEntitiesValidationReport report, Map<String, EntityType> metaDataMap) { CompositeValidationResult compositeValidationResult = new CompositeValidationResult(); metaDataMap.values().forEach(entityType -> { EntityTypeValidationResult validationResult = entityTypeValidator.validate(entityType); compositeValidationResult.addValidationResult(validationResult); }); metaDataMap.values().stream().map(EntityType::getAllAttributes).forEach(attributes -> attributes.forEach(attr -> { AttributeValidationResult validationResult = attributeValidator.validate(attr, ADD_SKIP_ENTITY_VALIDATION); compositeValidationResult.addValidationResult(validationResult); })); metaDataMap.values() .stream() .map(EntityType::getPackage) .filter(Objects::nonNull) .forEach(package_ -> package_.getTags().forEach(tag -> { TagValidationResult tagValidationResult = tagValidator.validate(tag); compositeValidationResult.addValidationResult(tagValidationResult); })); metaDataMap.values().forEach(entityType -> entityType.getTags().forEach(tag -> { TagValidationResult tagValidationResult = tagValidator.validate(tag); compositeValidationResult.addValidationResult(tagValidationResult); })); metaDataMap.values().stream().map(EntityType::getAllAttributes).forEach(attributes -> attributes.forEach(attr -> { attr.getTags().forEach(tag -> { TagValidationResult tagValidationResult = tagValidator.validate(tag); compositeValidationResult.addValidationResult(tagValidationResult); }); })); if (compositeValidationResult.hasConstraintViolations()) { throw new ValidationException(compositeValidationResult); } report = generateEntityValidationReport(source, report, metaDataMap); for (String entityTypeId : metaDataMap.keySet()) { if (!report.getSheetsImportable().containsKey(entityTypeId)) report.addEntity(entityTypeId, true); } return report; }

Target:
private EntitiesValidationReport buildValidationReport(RepositoryCollection source, MyEntitiesValidationReport report, Map<String, EntityType> metaDataMap) { CompositeValidationResult compositeValidationResult = new CompositeValidationResult(); metaDataMap.values().forEach(entityType -> { EntityTypeValidationResult validationResult = entityTypeValidator.validate(entityType); compositeValidationResult.addValidationResult(validationResult); }); metaDataMap.values().stream().map(EntityType::getAllAttributes).forEach(attributes -> attributes.forEach(attr -> { AttributeValidationResult validationResult = attributeValidator.validate(attr, ADD_SKIP_ENTITY_VALIDATION); compositeValidationResult.addValidationResult(validationResult); })); metaDataMap.values() .stream() .map(EntityType::getPackage) .filter(Objects::nonNull) .forEach(package_ -> validateTags(package_.getTags(), compositeValidationResult)); metaDataMap.values().forEach(entityType -> validateTags(entityType.getTags(), compositeValidationResult)); metaDataMap.values() .stream() .map(EntityType::getAllAttributes) .forEach(attributes -> attributes.forEach( attr -> validateTags(attr.getTags(), compositeValidationResult))); if (compositeValidationResult.hasConstraintViolations()) { throw new ValidationException(compositeValidationResult); } report = generateEntityValidationReport(source, report, metaDataMap); for (String entityTypeId : metaDataMap.keySet()) { if (!report.getSheetsImportable().containsKey(entityTypeId)) report.addEntity(entityTypeId, true); } return report; }