Source:
protected WorkflowVersion versionValidation(WorkflowVersion version, Workflow entry) { Set<SourceFile> sourceFiles = version.getSourceFiles(); SourceFile.FileType identifiedType = entry.getFileType(); String mainDescriptorPath = this.descriptorTypeToDefaultDescriptorPath.get(entry.getDescriptorType().toLowerCase()); Optional<SourceFile> mainDescriptor = sourceFiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), mainDescriptorPath))).findFirst(); ImmutablePair validDescriptorSet; Validation descriptorValidation; if (mainDescriptor.isPresent()) { validDescriptorSet = LanguageHandlerFactory.getInterface(identifiedType).validateWorkflowSet(sourceFiles, mainDescriptorPath); } else { validDescriptorSet = new ImmutablePair(false, "Missing the primary descriptor."); } descriptorValidation = new Validation(identifiedType, validDescriptorSet); version.addOrUpdateValidation(descriptorValidation); SourceFile.FileType testParameterType = SourceFile.FileType.CWL_TEST_JSON; if (Objects.equals(identifiedType, SourceFile.FileType.DOCKSTORE_WDL)) { testParameterType = SourceFile.FileType.WDL_TEST_JSON; } ImmutablePair validTestParameterSet = LanguageHandlerFactory.getInterface(identifiedType).validateTestParameterSet(sourceFiles); Validation testParameterValidation = new Validation(testParameterType, validTestParameterSet); version.addOrUpdateValidation(testParameterValidation); return version; }

Target:
protected WorkflowVersion versionValidation(WorkflowVersion version, Workflow entry) { Set<SourceFile> sourceFiles = version.getSourceFiles(); SourceFile.FileType identifiedType = entry.getFileType(); String mainDescriptorPath = this.descriptorTypeToDefaultDescriptorPath.get(entry.getDescriptorType().toLowerCase()); Optional<SourceFile> mainDescriptor = sourceFiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), mainDescriptorPath))).findFirst(); LanguageHandlerInterface.VersionTypeValidation validDescriptorSet; Validation descriptorValidation; if (mainDescriptor.isPresent()) { validDescriptorSet = LanguageHandlerFactory.getInterface(identifiedType).validateWorkflowSet(sourceFiles, mainDescriptorPath); } else { Map<String, String> validationMessage = new HashMap<>(); validationMessage.put("Unknown", "Missing the primary descriptor."); validDescriptorSet = new LanguageHandlerInterface.VersionTypeValidation(false, validationMessage); } descriptorValidation = new Validation(identifiedType, validDescriptorSet); version.addOrUpdateValidation(descriptorValidation); SourceFile.FileType testParameterType = null; switch (identifiedType) { case DOCKSTORE_CWL: testParameterType = SourceFile.FileType.CWL_TEST_JSON; break; case DOCKSTORE_WDL: testParameterType = SourceFile.FileType.WDL_TEST_JSON; break; case NEXTFLOW_CONFIG: break; default: throw new CustomWebApplicationException(identifiedType + " is not a valid workflow type.", HttpStatus.SC_BAD_REQUEST); } if (testParameterType != null) { LanguageHandlerInterface.VersionTypeValidation validTestParameterSet = LanguageHandlerFactory.getInterface(identifiedType).validateTestParameterSet(sourceFiles); Validation testParameterValidation = new Validation(testParameterType, validTestParameterSet); version.addOrUpdateValidation(testParameterValidation); } return version; }