diff options
author | Ravi Mantena <rx908f@att.com> | 2020-12-21 11:31:55 -0500 |
---|---|---|
committer | Ravi Mantena <rx908f@att.com> | 2020-12-21 11:32:34 -0500 |
commit | a520d00e005db1b232b9dae0c70d4dc5d73b33e1 (patch) | |
tree | 9c0e16ce5fab9bc12da138c4d8c613bcff54516b /mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java | |
parent | 2f551ba584dbb70568a69144b39e6da7c55c517f (diff) |
BpGen refactor Code Quality Issue-ID: DCAEGEN2-2502
Issue-ID: DCAEGEN2-2502
Change-Id: If6e08f0bb88c9039fb27898d50d2645f79175ba4
Signed-off-by: Ravi Mantena <rx908f@att.com>
Diffstat (limited to 'mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java')
-rw-r--r-- | mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java index 7f6c63d..43d819f 100644 --- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java +++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java @@ -41,31 +41,40 @@ import java.util.Map; /** * @author : Ravi Mantena - * @date 10/16/2020 - * Application: ONAP - Blueprint Generator - * Common ONAP Service used by ONAP and DMAAP Blueprint to add Policy Node + * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Policy Node */ - - @Service("onapPolicyNodeService") public class PolicyNodeService { @Autowired private BlueprintHelperService blueprintHelperService; - // Method to add Policy Nodes and Inputs - public void addPolicyNodesAndInputs(OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplate, Map<String, LinkedHashMap<String, Object>> inputs) { + /** + * Creates Policy Nodes and Inputs + * + * @param onapComponentSpec OnapComponentSpec + * @param nodeTemplate Node Template + * @param inputs Inputs + * @return + */ + public void addPolicyNodesAndInputs( + OnapComponentSpec onapComponentSpec, + Map<String, Node> nodeTemplate, + Map<String, LinkedHashMap<String, Object>> inputs) { List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList(); - for(TypePolicy policy: policyList){ + for (TypePolicy policy : policyList) { addPolicyNodesToNodeTemplate(policy, nodeTemplate); addPolicyInputs(policy, inputs); } } - private void addPolicyInputs(TypePolicy policy, Map<String, LinkedHashMap<String, Object>> inputs) { + private void addPolicyInputs( + TypePolicy policy, Map<String, LinkedHashMap<String, Object>> inputs) { String defaultValue = policy.getPolicy_id(); defaultValue = defaultValue != null ? defaultValue : ""; - inputs.put(policy.getNode_label() + "_policy_id", blueprintHelperService.createStringInput("policy_id", defaultValue)); + inputs.put( + policy.getNode_label() + "_policy_id", + blueprintHelperService.createStringInput("policy_id", defaultValue)); } private void addPolicyNodesToNodeTemplate(TypePolicy policy, Map<String, Node> nodeTemplate) { @@ -84,11 +93,16 @@ public class PolicyNodeService { return policyNodeProperties; } - // Method to add Policy Relationships + /** + * Creates Policy Relationships + * + * @param onapComponentSpec OnapComponentSpec + * @return + */ public List<Map<String, String>> getPolicyRelationships(OnapComponentSpec onapComponentSpec) { List<Map<String, String>> relationships = new ArrayList<>(); List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList(); - for(TypePolicy policy: policyList){ + for (TypePolicy policy : policyList) { Map<String, String> relationship = new LinkedHashMap<>(); relationship.put("type", Constants.POLICY_RELATIONSHIP_TYPE); relationship.put("target", policy.getNode_label()); |