aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.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/CreateOptimizationController.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/CreateOptimizationController.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java38
1 files changed, 10 insertions, 28 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
index 74a1ed016..afe2ce193 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateOptimizationController.java
@@ -34,7 +34,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -144,6 +143,13 @@ public class CreateOptimizationController extends RestrictedBaseController {
private Map<String, LinkedList<String>> arrayTextList = new HashMap<>();
CreateDcaeMicroServiceController msController = new CreateDcaeMicroServiceController();
+ /**
+ * setDataToPolicyRestAdapter.
+ *
+ * @param policyData PolicyRestAdapter
+ * @param root JsonNode
+ * @return PolicyRestAdapter
+ */
public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData, JsonNode root) {
String jsonContent = null;
try {
@@ -559,30 +565,9 @@ public class CreateOptimizationController extends RestrictedBaseController {
if (target == null) {
return;
}
- // Under target we have AnyOFType
- List<AnyOfType> anyOfList = target.getAnyOf();
- if (anyOfList == null) {
- return;
- }
- Iterator<AnyOfType> iterAnyOf = anyOfList.iterator();
- while (iterAnyOf.hasNext()) {
- AnyOfType anyOf = iterAnyOf.next();
- // Under AnyOFType we have AllOFType
- List<AllOfType> allOfList = anyOf.getAllOf();
- if (allOfList == null) {
- continue;
- }
- Iterator<AllOfType> iterAllOf = allOfList.iterator();
- while (iterAllOf.hasNext()) {
- AllOfType allOf = iterAllOf.next();
- // Under AllOFType we have Match
- List<MatchType> matchList = allOf.getMatch();
- if (matchList == null) {
- continue;
- }
- Iterator<MatchType> iterMatch = matchList.iterator();
- while (matchList.size() > 1 && iterMatch.hasNext()) {
- MatchType match = iterMatch.next();
+ for (AnyOfType anyOf : target.getAnyOf()) {
+ for (AllOfType allOf : anyOf.getAllOf()) {
+ for (MatchType match : allOf.getMatch()) {
//
// Under the match we have attribute value and
// attributeDesignator. So,finally down to the actual attribute.
@@ -843,9 +828,6 @@ public class CreateOptimizationController extends RestrictedBaseController {
classMap.putAll(tempMap);
LOGGER.info(tempMap);
-
- return;
-
}
private List<File> listModelFiles(String directoryName) {