Skip to content

Commit

Permalink
Update projects json (#252)
Browse files Browse the repository at this point in the history
* ✨ feat: Delete project json before reload projects.

* ♻️ create a method to remove project json file in FolderDBInitializer

---------

Co-authored-by: okanmercan <[email protected]>
  • Loading branch information
YemreGurses and Okanmercan99 authored Nov 19, 2024
1 parent 364d2a0 commit b947287
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import io.tofhir.server.repository.mappingContext.MappingContextFolderRepository
import io.tofhir.server.repository.schema.SchemaFolderRepository
import io.tofhir.server.repository.terminology.TerminologySystemFolderRepository
import io.tofhir.engine.Execution.actorSystem.dispatcher
import io.tofhir.engine.util.FileUtils
import io.tofhir.server.repository.project.ProjectFolderRepository
import io.tofhir.server.service.db.FolderDBInitializer

import scala.concurrent.Future
Expand All @@ -31,6 +33,8 @@ class ReloadService(mappingRepository: ProjectMappingFolderRepository,
mappingJobRepository.reloadJobDefinitions()
mappingContextRepository.reloadMappingContextDefinitions()
terminologySystemFolderRepository.reloadTerminologySystems()
// Delete projects.json before reload projects
folderDBInitializer.removeProjectsJsonFile()
folderDBInitializer.init()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,14 @@ class FolderDBInitializer(schemaFolderRepository: SchemaFolderRepository,
projects
}

/**
* Removes the projects.json file.
*/
def removeProjectsJsonFile(): Unit = {
val file = FileUtils.getPath(ProjectFolderRepository.PROJECTS_JSON).toFile
if (file.exists()) {
file.delete()
}
}

}

0 comments on commit b947287

Please sign in to comment.