Skip to content

Commit

Permalink
🗃️ Handle empty folders during initialization of schema and mapping f…
Browse files Browse the repository at this point in the history
…older repositories.
  • Loading branch information
sinaci authored and YemreGurses committed Sep 2, 2024
1 parent 3e9e5da commit 21a7fbf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class JobFolderRepository(jobRepositoryFolderPath: String, projectFolderReposito
private def initMap(jobRepositoryFolderPath: String): mutable.Map[String, mutable.Map[String, FhirMappingJob]] = {
val map = mutable.Map.empty[String, mutable.Map[String, FhirMappingJob]]
val jobRepositoryFolder = FileUtils.getPath(jobRepositoryFolderPath).toFile
logger.info(s"Initializing the Mapping Repository from path ${jobRepositoryFolder.getAbsolutePath}.")
if (!jobRepositoryFolder.exists()) {
jobRepositoryFolder.mkdirs()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ class ProjectMappingFolderRepository(mappingRepositoryFolderPath: String, projec
System.exit(1)
}
}
map.put(projectDirectory.getName, fhirMappingMap)
if(fhirMappingMap.isEmpty) {
// No processable schema files under projectDirectory
logger.warn(s"There are no processable mapping files under ${projectDirectory.getAbsolutePath}. Skipping ${projectDirectory.getName}.")
} else {
map.put(projectDirectory.getName, fhirMappingMap)
}
}
map
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ class SchemaFolderRepository(schemaRepositoryFolderPath: String, projectFolderRe
System.exit(1)
}
}
schemaDefinitionMap.put(projectFolder.getName, projectSchemas)
if(projectSchemas.isEmpty) {
// No processable schema files under projectFolder
logger.warn(s"There are no processable schema files under ${projectFolder.getAbsolutePath}. Skipping ${projectFolder.getName}.")
} else {
schemaDefinitionMap.put(projectFolder.getName, projectSchemas)
}
})
schemaDefinitionMap
}
Expand Down

0 comments on commit 21a7fbf

Please sign in to comment.