diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/AttributeBundleController.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/AttributeBundleController.java index a9ac9160a..1dbe5e026 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/AttributeBundleController.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/controller/AttributeBundleController.java @@ -50,6 +50,12 @@ public ResponseEntity getAll() { return ResponseEntity.ok(attributeBundleService.findAll()); } + @GetMapping("/{resourceId}") + @Transactional(readOnly = true) + public ResponseEntity getOne(@PathVariable String resourceId) throws EntityNotFoundException { + return ResponseEntity.ok(attributeBundleService.findByResourceId(resourceId)); + } + @Secured("ROLE_ADMIN") @PutMapping @Transactional diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/AttributeBundleService.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/AttributeBundleService.java index f246c7d1b..916ea99b2 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/AttributeBundleService.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/AttributeBundleService.java @@ -43,4 +43,12 @@ public AttributeBundle updateBundle(AttributeBundle bundle) throws EntityNotFoun bundleToUpdate.setAttributes(bundle.getAttributes()); return attributeBundleRepository.save(bundleToUpdate); } + + public AttributeBundle findByResourceId(String resourceId) throws EntityNotFoundException { + Optional result = attributeBundleRepository.findByResourceId(resourceId); + if (result.isEmpty()) { + throw new EntityNotFoundException(String.format("Unable to find attribute bundle with resource id: [%s] for deletion", resourceId)); + } + return result.get(); + } } \ No newline at end of file