diff options
author | kris.jinka <kris.jinka@samsung.com> | 2018-11-13 09:10:52 +0900 |
---|---|---|
committer | kris.jinka <kris.jinka@samsung.com> | 2018-11-13 09:11:41 +0900 |
commit | 2b82696ea09c21cf5b47cedf08fe294622a6c4e6 (patch) | |
tree | 44fa6e6f299e9eb91254c84a7a37e49f11663fd4 /controlloop/common/policy-yaml/src/main | |
parent | 918d8aa79654111a7254571adf0f84c89dddb36c (diff) |
Use parameter obj for policy results
Policy result method uses more params than allowed
Use parameter object for setting params instead
Issue-ID: POLICY-1251
Change-Id: I6bf1f20896dc5176811bc363a390c682faa06ca4
Signed-off-by: kris.jinka <kris.jinka@samsung.com>
Diffstat (limited to 'controlloop/common/policy-yaml/src/main')
2 files changed, 13 insertions, 23 deletions
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java index 123fe2fa1..3c43756c3 100644 --- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java +++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java @@ -177,20 +177,12 @@ public interface ControlLoopPolicyBuilder { /** * Creates a policy that is chained to the result of another Policy. * - * @param name name - * @param description description - * @param actor actor - * @param target target - * @param recipe recipe - * @param retries retries - * @param timeout timeout - * @param policyId id + * @param policyParam policy parameters object * @param results results * @return Policy that was set * @throws BuilderException builder exception */ - public Policy setPolicyForPolicyResult(String name, String description, String actor, Target target, String recipe, - Map<String, String> payload, Integer retries, Integer timeout, String policyId, PolicyResult... results) + public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results) throws BuilderException; diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java index 6950523cb..bd3939886 100644 --- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java +++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java @@ -228,30 +228,28 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder { } @Override - public Policy setPolicyForPolicyResult(String name, String description, String actor, Target target, String recipe, - Map<String, String> payload, Integer retries, Integer timeout, - String policyId, PolicyResult... results) + public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results) throws BuilderException { // // Find the existing policy // - Policy existingPolicy = this.findPolicy(policyId); + Policy existingPolicy = this.findPolicy(policyParam.getId()); if (existingPolicy == null) { - throw new BuilderException(UNKNOWN_POLICY + policyId); + throw new BuilderException(UNKNOWN_POLICY + policyParam.getId()); } // // Create the new Policy // Policy newPolicy = new Policy( PolicyParam.builder().id(UUID.randomUUID().toString()) - .name(name) - .description(description) - .actor(actor) - .payload(payload) - .target(target) - .recipe(recipe) - .retries(retries) - .timeout(timeout) + .name(policyParam.getName()) + .description(policyParam.getDescription()) + .actor(policyParam.getActor()) + .payload(policyParam.getPayload()) + .target(policyParam.getTarget()) + .recipe(policyParam.getRecipe()) + .retries(policyParam.getRetries()) + .timeout(policyParam.getTimeout()) .build()); // // Connect the results |