aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-14 11:39:45 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-14 21:14:27 -0400
commit0950d79047d3404c15b4dd30cffeb81346565f64 (patch)
treee5c9534b7f3349684dad00cab74c4b14b9dfe733 /POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java
parent4e6615528e03f1a6f7808e28481bd55fe39ed572 (diff)
Sonar cleanup in controllers etc
Variable renaming of consecutive capital letters. Adding Javadoc Missing curly braces Re-writing some methods to reduce cyclomatic complexity Combining while's into a simple for statement. Addressing previous review comments No real effort on code coverage in this one. Issue-ID: POLICY-2133 Change-Id: I4afb3030203e1dbc743507e037ca3d57faf41f1d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java49
1 files changed, 25 insertions, 24 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java
index 081b33cc0..214cb3244 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSRawController.java
@@ -55,36 +55,37 @@ public class CreateBRMSRawController {
public void prePopulateBRMSRawPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- if (policyAdapter.getPolicyData() instanceof PolicyType) {
- PolicyType policy = (PolicyType) policyAdapter.getPolicyData();
- policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
-
- // Set PolicyAdapter name value
- setPolicyAdapterNameValue(policyAdapter);
+ if (! (policyAdapter.getPolicyData() instanceof PolicyType)) {
+ return;
+ }
+ PolicyType policy = (PolicyType) policyAdapter.getPolicyData();
+ policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
- // Set PolicyAdapter description.
- setPolicyAdapterDescription(policyAdapter, policy);
+ // Set PolicyAdapter name value
+ setPolicyAdapterNameValue(policyAdapter);
- // Set PolicyAdapter attributes.
- setPolicyAdapterAttributes(policyAdapter, policy);
+ // Set PolicyAdapter description.
+ setPolicyAdapterDescription(policyAdapter, policy);
- // Set PolicyAdapter configBodyData
- policyAdapter.setConfigBodyData(entity.getConfigurationData().getConfigBody());
+ // Set PolicyAdapter attributes.
+ setPolicyAdapterAttributes(policyAdapter, policy);
- // Get the target data under policy.
- TargetType target = policy.getTarget();
- if (target == null) {
- return;
- }
- // Under target we have AnyOFType
- List<AnyOfType> anyOfList = target.getAnyOf();
- if (anyOfList == null) {
- return;
- }
+ // Set PolicyAdapter configBodyData
+ policyAdapter.setConfigBodyData(entity.getConfigurationData().getConfigBody());
- // Set PolicyAdapter riskType, riskLevel, guard, ttlDate from match attributes
- setPolicyAdapterMatchAttributes(policyAdapter, policy.getTarget().getAnyOf());
+ // Get the target data under policy.
+ TargetType target = policy.getTarget();
+ if (target == null) {
+ return;
+ }
+ // Under target we have AnyOFType
+ List<AnyOfType> anyOfList = target.getAnyOf();
+ if (anyOfList == null) {
+ return;
}
+
+ // Set PolicyAdapter riskType, riskLevel, guard, ttlDate from match attributes
+ setPolicyAdapterMatchAttributes(policyAdapter, policy.getTarget().getAnyOf());
}
private void setPolicyAdapterMatchAttributes(PolicyRestAdapter policyAdapter, List<AnyOfType> anyOfList) {