aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-12 08:04:55 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-12 08:04:55 +0000
commita7aee05afbde5c504e3a16a1e58cbeb5642abe17 (patch)
treea38757a12048f7f3ea9056e60cae584671b40e5f /bpmn/MSOCommonBPMN/src/main/java/org/openecomp
parent6da95ff2af94c84cc7754068b5b5ee7cec21b70d (diff)
parent295c0dfc73ce9cd29916fba2c03004a5b919c646 (diff)
Merge "Swap Optional.isPresent with functional expression"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/openecomp')
-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;
}