summaryrefslogtreecommitdiffstats
path: root/controlloop/common/policy-yaml/src/main/java
diff options
context:
space:
mode:
authorkrishnajinka <kris.jinka@samsung.com>2018-11-12 23:40:08 +0900
committerkrishnajinka <kris.jinka@samsung.com>2018-11-12 23:40:29 +0900
commit9dffa5430faa920a5f02b54b93531cc2cb41b02e (patch)
treee2b4577e0b26fc56ad17978e1edff25a54a2c12b /controlloop/common/policy-yaml/src/main/java
parent69aba39cbd866a1b611613a7b14db50d86944b94 (diff)
Use builder for trigger policy
Fix an issue reported by sonar for using more than 7 parameters in the method. Issue-ID: POLICY-1251 Change-Id: I07d668b706a27dcc03e862d08262f2c0269ad4b7 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'controlloop/common/policy-yaml/src/main/java')
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java14
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java17
2 files changed, 7 insertions, 24 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 8ea33d5f0..123fe2fa1 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
@@ -26,6 +26,7 @@ import org.onap.policy.aai.Pnf;
import org.onap.policy.controlloop.policy.ControlLoop;
import org.onap.policy.controlloop.policy.OperationsAccumulateParams;
import org.onap.policy.controlloop.policy.Policy;
+import org.onap.policy.controlloop.policy.PolicyParam;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.policy.Target;
import org.onap.policy.controlloop.policy.builder.impl.ControlLoopPolicyBuilderImpl;
@@ -135,18 +136,11 @@ public interface ControlLoopPolicyBuilder {
* Platform.
*
*
- * @param name name
- * @param description description
- * @param actor actor
- * @param target target
- * @param recipe recipe
- * @param retries retries
- * @param timeout timeout
+ * @param policy Policy parameters object
* @return Policy object
* @throws BuilderException builder exception
*/
- public Policy setTriggerPolicy(String name, String description, String actor, Target target, String recipe,
- Map<String, String> payload, Integer retries, Integer timeout) throws BuilderException;
+ public Policy setTriggerPolicy(PolicyParam policy) throws BuilderException;
/**
* Changes the trigger policy to point to another existing Policy.
@@ -155,7 +149,7 @@ public interface ControlLoopPolicyBuilder {
* @return ControlLoop object
* @throws BuilderException build exception
*/
- public ControlLoop setTriggerPolicy(String id) throws BuilderException;
+ public ControlLoop setExistingTriggerPolicy(String id) throws BuilderException;
/**
* Is an open loop.
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 48f929149..6950523cb 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
@@ -199,21 +199,10 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
@Override
- public Policy setTriggerPolicy(String name, String description, String actor, Target target,
- String recipe, Map<String, String> payload, Integer retries, Integer timeout)
+ public Policy setTriggerPolicy(PolicyParam policyParam)
throws BuilderException {
- Policy trigger = new Policy(PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(name)
- .description(description)
- .actor(actor)
- .payload(payload)
- .target(target)
- .recipe(recipe)
- .retries(retries)
- .timeout(timeout)
- .build());
+ Policy trigger = new Policy(policyParam);
controlLoopPolicy.getControlLoop().setTrigger_policy(trigger.getId());
@@ -225,7 +214,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
@Override
- public ControlLoop setTriggerPolicy(String id) throws BuilderException {
+ public ControlLoop setExistingTriggerPolicy(String id) throws BuilderException {
if (id == null) {
throw new BuilderException("Id must not be null");
}