summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2019-03-14 16:27:49 +0100
committersebdet <sebastien.determe@intl.att.com>2019-03-14 18:06:29 +0100
commitec7f47aacc6c124d8d2e01416e80e2278b427be8 (patch)
treef94a2ae5817095bfbadcac1c752696e97c4a2da4 /src/main/java
parent4549fd92024cdadf3277d7cc364f33109ca22b59 (diff)
Rework UI
Rework UI to cooperate with the new data model Issue-ID: CLAMP-318 Change-Id: I1266c350e7604d29ff86da7c7584c74ad1f8715a Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopController.java4
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopService.java7
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java23
3 files changed, 20 insertions, 14 deletions
diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java
index 2bcce1e37..8b64e9d70 100644
--- a/src/main/java/org/onap/clamp/loop/LoopController.java
+++ b/src/main/java/org/onap/clamp/loop/LoopController.java
@@ -75,6 +75,10 @@ public class LoopController {
return loopService.updateAndSaveGlobalPropertiesJson(loopName, globalProperties);
}
+ public MicroServicePolicy updateMicroservicePolicy(String loopName, MicroServicePolicy newMicroservicePolicy) {
+ return loopService.updateMicroservicePolicy(loopName, newMicroservicePolicy);
+ }
+
public String getSVGRepresentation(String loopName) {
return loopService.getClosedLoopModelSVG(loopName);
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java
index cf2f4c669..051ab6ed6 100644
--- a/src/main/java/org/onap/clamp/loop/LoopService.java
+++ b/src/main/java/org/onap/clamp/loop/LoopService.java
@@ -86,6 +86,13 @@ public class LoopService {
return loopsRepository.save(loop);
}
+ MicroServicePolicy updateMicroservicePolicy(String loopName, MicroServicePolicy newMicroservicePolicy) {
+ Loop loop = findClosedLoopByName(loopName);
+ MicroServicePolicy newPolicies = microservicePolicyService
+ .getAndUpdateMicroServicePolicy(loop, newMicroservicePolicy);
+ return newPolicies;
+ }
+
private Loop updateOperationalPolicies(Loop loop, List<OperationalPolicy> newOperationalPolicies) {
Set<OperationalPolicy> newPolicies = operationalPolicyService
.updatePolicies(loop, newOperationalPolicies);
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java b/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
index 91794b754..c316f1f5d 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
@@ -24,11 +24,13 @@
package org.onap.clamp.policy.microservice;
import com.google.common.collect.Sets;
+
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import org.onap.clamp.policy.PolicyService;
+
import org.onap.clamp.loop.Loop;
+import org.onap.clamp.policy.PolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -45,12 +47,8 @@ public class MicroservicePolicyService implements PolicyService<MicroServicePoli
@Override
@Transactional
- public Set<MicroServicePolicy> updatePolicies(Loop loop,
- List<MicroServicePolicy> newMicroservicePolicies) {
- return newMicroservicePolicies
- .stream()
- .map(policy ->
- getAndUpdateMicroServicePolicy(loop, policy))
+ public Set<MicroServicePolicy> updatePolicies(Loop loop, List<MicroServicePolicy> newMicroservicePolicies) {
+ return newMicroservicePolicies.stream().map(policy -> getAndUpdateMicroServicePolicy(loop, policy))
.collect(Collectors.toSet());
}
@@ -59,13 +57,10 @@ public class MicroservicePolicyService implements PolicyService<MicroServicePoli
return repository.existsById(policyName);
}
- private MicroServicePolicy getAndUpdateMicroServicePolicy(Loop loop, MicroServicePolicy policy) {
- return repository
- .findById(policy.getName())
- .map(p -> updateMicroservicePolicyProperties(p, policy, loop))
- .orElse(new MicroServicePolicy(policy.getName(), policy.getPolicyTosca(),
- policy.getShared(), policy.getJsonRepresentation(),
- Sets.newHashSet(loop)));
+ public MicroServicePolicy getAndUpdateMicroServicePolicy(Loop loop, MicroServicePolicy policy) {
+ return repository.findById(policy.getName()).map(p -> updateMicroservicePolicyProperties(p, policy, loop))
+ .orElse(new MicroServicePolicy(policy.getName(), policy.getPolicyTosca(), policy.getShared(),
+ policy.getJsonRepresentation(), Sets.newHashSet(loop)));
}
private MicroServicePolicy updateMicroservicePolicyProperties(MicroServicePolicy oldPolicy,