From c7eba53861981bdc3ff1e7e1c5f45602f6662ea6 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Sat, 23 Dec 2023 19:34:55 +0100 Subject: [PATCH] [Update] Add summaries api methods --- .../analysis/controller/FailureModesTableController.java | 5 +++++ .../cvut/kbss/analysis/controller/FaultTreeController.java | 5 +++++ .../cz/cvut/kbss/analysis/controller/SystemController.java | 5 +++++ .../analysis/service/FailureModesTableRepositoryService.java | 4 ++++ .../kbss/analysis/service/FaultTreeRepositoryService.java | 5 +++++ .../cvut/kbss/analysis/service/SystemRepositoryService.java | 4 ++++ 6 files changed, 28 insertions(+) diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java index d76ba5a2..d03c4b63 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java @@ -32,6 +32,11 @@ public List findAll() { return repositoryService.findAll(); } + @GetMapping("/summaries") + public List summaries() { + return repositoryService.findAllSummaries(); + } + @PutMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FailureModesTable update(@RequestBody FailureModesTableUpdateDTO tableUpdateDTO) { log.info("> update - {}", tableUpdateDTO); diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java index 3f734cdf..da443006 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java @@ -30,6 +30,11 @@ public List findAll() { return repositoryService.findAll(); } + @GetMapping("/summaries") + public List summaries() { + return repositoryService.findAllSummaries(); + } + @GetMapping(value = "/{faultTreeFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public FaultTree find(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> find - {}", faultTreeFragment); diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java b/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java index 1d753a5b..5add8839 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java @@ -34,6 +34,11 @@ public List findAll() { return repositoryService.findAll(); } + @GetMapping("/summaries") + public List summaries() { + return repositoryService.findAllSummaries(); + } + @GetMapping(value = "/{systemFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public System find(@PathVariable(name = "systemFragment") String systemFragment) { log.info("> find - {}", systemFragment); diff --git a/src/main/java/cz/cvut/kbss/analysis/service/FailureModesTableRepositoryService.java b/src/main/java/cz/cvut/kbss/analysis/service/FailureModesTableRepositoryService.java index 3a7e8741..5f12a041 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/FailureModesTableRepositoryService.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/FailureModesTableRepositoryService.java @@ -299,4 +299,8 @@ public String export(URI tableUri) { return stringWriter.toString(); } + @Transactional(readOnly = true) + public List findAllSummaries(){ + return ((FailureModesTableDao)getPrimaryDao()).findAllSummaries(); + } } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java b/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java index ed6d4fbf..e332735d 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java @@ -391,4 +391,9 @@ private void setFaultEventTypes(boolean isBasic, FaultEvent fEvent){ fEvent.setGateType(GateType.OR); } } + + @Transactional(readOnly = true) + public List findAllSummaries(){ + return ((FaultTreeDao)getPrimaryDao()).findAllSummaries(); + } } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/SystemRepositoryService.java b/src/main/java/cz/cvut/kbss/analysis/service/SystemRepositoryService.java index 139ec095..e31e3c61 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/SystemRepositoryService.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/SystemRepositoryService.java @@ -95,4 +95,8 @@ public void importDocument(URI systemURI, URI contextIRI) { components.forEach(system::addComponent); } + @Transactional(readOnly = true) + public List findAllSummaries(){ + return ((SystemDao)getPrimaryDao()).findAllSummaries(); + } }