Source:
WorkflowVersion versionValidation(WorkflowVersion version, Workflow entry, String mainDescriptorPath) { Set<SourceFile> sourceFiles = version.getSourceFiles(); SourceFile.FileType identifiedType = entry.getFileType(); Optional<SourceFile> mainDescriptor = sourceFiles.stream().filter((sourceFile -> Objects .equals(sourceFile.getPath(), mainDescriptorPath))).findFirst(); if (mainDescriptor.isPresent()) { MutablePair<Boolean, String> validDescriptorSet = LanguageHandlerFactory.getInterface(identifiedType).validateWorkflowSet(sourceFiles, mainDescriptorPath); VersionValidation descriptorValidation = new VersionValidation(identifiedType, validDescriptorSet); version.addOrUpdateVersionValidation(descriptorValidation); } else { MutablePair<Boolean, String> noPrimaryDescriptor = new MutablePair<>(false, "Missing the primary descriptor."); VersionValidation noPrimaryDescriptorValidation = new VersionValidation(identifiedType, noPrimaryDescriptor); version.addOrUpdateVersionValidation(noPrimaryDescriptorValidation); } SourceFile.FileType testParameterType = SourceFile.FileType.CWL_TEST_JSON; if (Objects.equals(identifiedType, SourceFile.FileType.DOCKSTORE_WDL)) { testParameterType = SourceFile.FileType.WDL_TEST_JSON; } MutablePair<Boolean, String> validTestParameterSet = LanguageHandlerFactory.getInterface(identifiedType).validateTestParameterSet(sourceFiles); VersionValidation testParameterValidation = new VersionValidation(testParameterType, validTestParameterSet); version.addOrUpdateVersionValidation(testParameterValidation); version.setValid(isValidVersion(version)); return version; }

Target:
public WorkflowVersion versionValidation(WorkflowVersion version, Workflow entry, String mainDescriptorPath) { Set<SourceFile> sourceFiles = version.getSourceFiles(); SourceFile.FileType identifiedType = entry.getFileType(); Optional<SourceFile> mainDescriptor = sourceFiles.stream().filter((sourceFile -> Objects .equals(sourceFile.getPath(), mainDescriptorPath))).findFirst(); if (mainDescriptor.isPresent()) { LanguageHandlerInterface.VersionTypeValidation validDescriptorSet = LanguageHandlerFactory.getInterface(identifiedType).validateWorkflowSet(sourceFiles, mainDescriptorPath); Validation descriptorValidation = new Validation(identifiedType, validDescriptorSet); version.addOrUpdateValidation(descriptorValidation); } else { Map<String, String> validationMessage = new HashMap<>(); validationMessage.put(mainDescriptorPath, "Missing the primary descriptor."); LanguageHandlerInterface.VersionTypeValidation noPrimaryDescriptor = new LanguageHandlerInterface.VersionTypeValidation(false, validationMessage); Validation noPrimaryDescriptorValidation = new Validation(identifiedType, noPrimaryDescriptor); version.addOrUpdateValidation(noPrimaryDescriptorValidation); } 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); } version.setValid(isValidVersion(version)); return version; }