Skip to content

Commit

Permalink
Merge branch 'feature/shibui-1744' of bitbucket.org:unicon/shib-idp-u…
Browse files Browse the repository at this point in the history
…i into feature/shibui-1744
  • Loading branch information
rmathis committed Sep 14, 2021
2 parents b70729a + 3c3890e commit d723459
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 @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AttributeBundle> 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();
}
}

0 comments on commit d723459

Please sign in to comment.