fun merge(factory: FactoryDto, computedProjectConfig: ProjectConfigDto): FactoryDto? { val projects: List<ProjectConfigDto> = factory.getWorkspace().getProjects() if (projects == null || projects.isEmpty()) { factory.getWorkspace().setProjects(listOf(computedProjectConfig)) return factory } if (projects.size == 1) { val projectConfig: ProjectConfigDto = projects[0] if (projectConfig.getSource() == null) projectConfig.setSource(computedProjectConfig.getSource()) } return factory }
Apply the merging of project config dto including source storage dto into the existing factory < p > here are the following rules < ul > < li > no projects -- > add whole project < /li > < li > if projects < ul > < li > : if there is only one project : add source if missing < /li > < li > if many projects : do nothing < /li > < /ul > < /li > < /ul >