Skip to content

Commit

Permalink
SHIBUI-2063
Browse files Browse the repository at this point in the history
intermediate commit
  • Loading branch information
chasegawa committed Sep 13, 2021
1 parent 8047d03 commit 3c3890e
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 3c3890e

Please sign in to comment.