diff options
author | NicolasLaplaud <nicolas.laplaud@orange.com> | 2018-09-07 16:19:49 +0200 |
---|---|---|
committer | MatthieuGeerebaert <matthieu.geerebaert@orange.com> | 2018-09-13 16:35:47 +0200 |
commit | 056728aca8d2d4ded0c3e8e425d7a6231260cc20 (patch) | |
tree | 3a8ab72a6c831cd0132fc6ad51dda72af5b37fb3 /src | |
parent | d04ad9a5abd23a93e948ebac2cbe5ae1925e2099 (diff) |
HUB Resource
- manage notification based on subscription
- manage event body based on subscriptionType
Change-Id: Ia3918da46b8279c852e720082fcfa1bf4e2e56f6
Issue-ID: EXTAPI-96
Signed-off-by: NicolasLaplaud <nicolas.laplaud@orange.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/main/java/org/onap/nbi/apis/hub/HubResource.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/org/onap/nbi/apis/hub/HubResource.java b/src/main/java/org/onap/nbi/apis/hub/HubResource.java index bd98820..9ef5235 100755 --- a/src/main/java/org/onap/nbi/apis/hub/HubResource.java +++ b/src/main/java/org/onap/nbi/apis/hub/HubResource.java @@ -44,6 +44,10 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import java.net.URI; +import java.util.List; +import java.util.stream.Collectors; + @RestController @RequestMapping("/hub") @EnableScheduling @@ -66,7 +70,10 @@ public class HubResource extends ResourceManagement { Subscriber subscriber = subscriptionService.createSubscription(subscription); - URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(subscriber.getId()) + URI location = ServletUriComponentsBuilder + .fromCurrentRequest() + .path("/{id}") + .buildAndExpand(subscriber.getId()) .toUri(); return ResponseEntity.created(location).build(); @@ -75,7 +82,7 @@ public class HubResource extends ResourceManagement { @GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) { - Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId); + Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId); if (subscriber == null) { return ResponseEntity.notFound().build(); } @@ -92,9 +99,9 @@ public class HubResource extends ResourceManagement { HttpHeaders headers = new HttpHeaders(); headers.add("X-Total-Count", String.valueOf(totalCount)); headers.add("X-Result-Count", String.valueOf(subscribers.size())); - - List<Subscription> subscriptions = - subscribers.stream().map(Subscription::createFromSubscriber).collect(Collectors.toList()); + List<Subscription> subscriptions = subscribers.stream() + .map(Subscription::createFromSubscriber) + .collect(Collectors.toList()); return this.findResponse(subscriptions, filter, headers); |