aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-03-09 19:59:34 -0500
committerMunir Ahmad <munir.ahmad@bell.ca>2018-03-09 19:59:34 -0500
commit295c0dfc73ce9cd29916fba2c03004a5b919c646 (patch)
tree8b4fe7a9484ac8fbd3df70c61ec7c19bd52d7e00 /bpmn/MSOCommonBPMN/src
parent332b16345989aa98f3c0e3169d91af1db34e1986 (diff)
Swap Optional.isPresent with functional expression
Change-Id: Id4b724b189f98c89e3e038b154990a95733e0624 Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java
index 74b1c3f802..1436d83a94 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java
@@ -157,14 +157,9 @@ public abstract class RestClient {
}
client.register(this.getMapper());
Optional<ClientResponseFilter> responseFilter = this.addResponseFilter();
- if (responseFilter.isPresent()) {
- client.register(responseFilter.get());
- }
- if (!path.isPresent()) {
- webTarget = client.target(host.toString());
- } else {
- webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
- }
+ responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter));
+ webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString())))
+ .orElseGet(() -> client.target(host.toString()));
this.accept = MediaType.APPLICATION_JSON;
this.contentType = MediaType.APPLICATION_JSON;
}