Removed unused fields from AbstractModelElement 65/85665/1
authorp.borelowski <p.borelowski@partner.samsung.com>
Thu, 18 Apr 2019 07:28:01 +0000 (09:28 +0200)
committerp.borelowski <p.borelowski@partner.samsung.com>
Thu, 18 Apr 2019 08:49:18 +0000 (10:49 +0200)
Removed 3 unused private fields from the class
org.onap.clamp.clds.model.properties.AbstractModelElement
along with the following changes within 4 other classes and 1 test class

Change-Id: Id4cc30964ca5478add446601f642c6c0ed190ab7
Issue-ID: CLAMP-347
Signed-off-by: p.borelowski <p.borelowski@partner.samsung.com>
src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java
src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java
src/main/java/org/onap/clamp/clds/model/properties/Policy.java
src/main/java/org/onap/clamp/clds/model/properties/Tca.java
src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java

index 73f708c..9c15524 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -36,21 +38,15 @@ public abstract class AbstractModelElement {
 
     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractModelElement.class);
     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
-    private final String type;
-    private final ModelBpmn modelBpmn;
     private final String id;
     protected String topicPublishes;
     protected final JsonElement modelElementJsonNode;
-    private boolean isFound;
-    private final ModelProperties modelProp;
+    private final boolean isFound;
 
     /**
      * Perform base parsing of properties for a ModelElement (such as, VesCollector, Policy and Tca).
      */
-    protected AbstractModelElement(String type, ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
-        this.type = type;
-        this.modelProp = modelProp;
-        this.modelBpmn = modelBpmn;
+    protected AbstractModelElement(String type, ModelBpmn modelBpmn, JsonObject modelJson) {
         this.id = modelBpmn.getId(type);
         this.modelElementJsonNode = modelJson.get(id);
         this.isFound = modelBpmn.isModelElementTypeInList(type);
@@ -58,15 +54,16 @@ public abstract class AbstractModelElement {
 
     /**
      * Get the topic publishes.
+     *
      * @return the topicPublishes
      */
     public String getTopicPublishes() {
         return topicPublishes;
     }
 
-
     /**
      * Get the id.
+     *
      * @return the id
      */
     public String getId() {
@@ -75,6 +72,7 @@ public abstract class AbstractModelElement {
 
     /**
      * Get the isFound flag.
+     *
      * @return the isFound
      */
     public boolean isFound() {
index 63c677d..a93b09c 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -18,7 +20,7 @@
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
- * 
+ *
  */
 
 package org.onap.clamp.clds.model.properties;
@@ -30,27 +32,22 @@ import org.onap.clamp.clds.util.JsonUtils;
  * Parse Holmes bpmn parameters json properties.
  * Example json:
  * [{"name":"correlationalLogic","value":"vcwx"},{"name":"configPolicyName","value":"cccc"}]
- *
  */
 public class Holmes extends AbstractModelElement {
 
     private static final String TYPE_HOLMES = "holmes";
 
-    private String              correlationLogic;
-
-    private String              configPolicyName;
+    private String correlationLogic;
+    private String configPolicyName;
 
     /**
      * Default constructor for Holmes Element.
      *
-     * @param modelProp
-     *            The ModelProperties containing the all the info, like bpmn,
-     *            bpmn params, etc ...
      * @param modelBpmn The model bpmn
      * @param modelJson The model json
      */
-    public Holmes(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
-        super(TYPE_HOLMES, modelProp, modelBpmn, modelJson);
+    public Holmes(ModelBpmn modelBpmn, JsonObject modelJson) {
+        super(TYPE_HOLMES, modelBpmn, modelJson);
 
         correlationLogic = JsonUtils.getStringValueByName(modelElementJsonNode, "correlationalLogic");
         configPolicyName = JsonUtils.getStringValueByName(modelElementJsonNode, "configPolicyName");
@@ -67,5 +64,4 @@ public class Holmes extends AbstractModelElement {
     public String getConfigPolicyName() {
         return configPolicyName;
     }
-
 }
index 5160e10..a880893 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -118,19 +120,19 @@ public class ModelProperties {
             // Parse the list of base Model Elements and build up the
             // ModelElements
             modelElementClasses.entrySet().stream().parallel()
-                .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
-                    && missingTypes.contains(entry.getValue())))
-                .forEach(entry -> {
-                    try {
-                        modelElements.put(entry.getValue(),
-                            (entry.getKey().getConstructor(ModelProperties.class, ModelBpmn.class, JsonObject.class)
-                                .newInstance(this, modelBpmn, modelJson)));
-                    } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
-                        | InvocationTargetException e) {
-                        logger.warn("Unable to instantiate a ModelElement " + entry.getValue()
-                            + ", exception follows: ", e);
-                    }
-                });
+                    .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey())
+                            && missingTypes.contains(entry.getValue())))
+                    .forEach(entry -> {
+                        try {
+                            modelElements.put(entry.getValue(),
+                                    (entry.getKey().getConstructor(ModelBpmn.class, JsonObject.class)
+                                            .newInstance(modelBpmn, modelJson)));
+                        } catch (InstantiationException | NoSuchMethodException | IllegalAccessException
+                                | InvocationTargetException e) {
+                            logger.warn("Unable to instantiate a ModelElement " + entry.getValue()
+                                    + ", exception follows: ", e);
+                        }
+                    });
         }
     }
 
index 9cb3635..9537cb9 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -25,9 +27,9 @@ package org.onap.clamp.clds.model.properties;
 
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -51,23 +53,22 @@ import java.util.Map.Entry;
  * "vf3RtPi"]}]]}]
  */
 public class Policy extends AbstractModelElement {
-    protected static final EELFLogger logger      = EELFManager.getInstance().getLogger(Policy.class);
+    protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
 
-    private List<PolicyChain>         policyChains;
+    private List<PolicyChain> policyChains;
 
-    private static final String       TYPE_POLICY = "policy";
+    private static final String TYPE_POLICY = "policy";
 
     /**
      * Parse Policy given json node.
      *
-     * @param modelProp The model properties.
      * @param modelBpmn The model bpmn
      * @param modelJson The model json
      * @throws IOException The IO Exception
      */
-    public Policy(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) throws IOException {
-        super(TYPE_POLICY, modelProp, modelBpmn, modelJson);
+    public Policy(ModelBpmn modelBpmn, JsonObject modelJson) throws IOException {
+        super(TYPE_POLICY, modelBpmn, modelJson);
 
         // process policies
         if (modelElementJsonNode != null) {
@@ -81,6 +82,7 @@ public class Policy extends AbstractModelElement {
 
     /**
      * Get the policy chains.
+     *
      * @return the policyChains
      */
     public List<PolicyChain> getPolicyChains() {
@@ -90,5 +92,4 @@ public class Policy extends AbstractModelElement {
     public static final String getType() {
         return TYPE_POLICY;
     }
-
 }
index 0d17b95..efa0188 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -18,7 +20,7 @@
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
- * 
+ *
  */
 
 package org.onap.clamp.clds.model.properties;
@@ -27,31 +29,30 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
+
 import java.util.Map.Entry;
 import java.util.Set;
 
 /**
  * Parse ONAP Tca json properties.
- *
  */
 public class Tca extends AbstractModelElement {
 
-    protected static final EELFLogger logger      = EELFManager.getInstance().getLogger(Tca.class);
+    protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Tca.class);
     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
 
-    private TcaItem                   tcaItem;
+    private TcaItem tcaItem;
 
-    private static final String       TYPE_TCA    = "tca";
+    private static final String TYPE_TCA = "tca";
 
     /**
      * Parse Tca given json node.
      *
-     * @param modelProp The model properties
      * @param modelBpmn The model bpmn
      * @param modelJson The model json
      */
-    public Tca(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
-        super(TYPE_TCA, modelProp, modelBpmn, modelJson);
+    public Tca(ModelBpmn modelBpmn, JsonObject modelJson) {
+        super(TYPE_TCA, modelBpmn, modelJson);
 
         // process Server_Configurations
         if (modelElementJsonNode != null) {
@@ -68,5 +69,4 @@ public class Tca extends AbstractModelElement {
     public static final String getType() {
         return TYPE_TCA;
     }
-
 }
index 871d0a6..31d0be8 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights\r
  *                             reserved.\r
  * ================================================================================\r
+ * Modifications Copyright (c) 2019 Samsung\r
+ * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
@@ -26,7 +28,6 @@ package org.onap.clamp.clds.model.prop;
 import com.google.gson.JsonObject;\r
 import org.onap.clamp.clds.model.properties.AbstractModelElement;\r
 import org.onap.clamp.clds.model.properties.ModelBpmn;\r
-import org.onap.clamp.clds.model.properties.ModelProperties;\r
 import org.onap.clamp.clds.util.JsonUtils;\r
 \r
 /**\r
@@ -40,8 +41,8 @@ public class CustomModelElement extends AbstractModelElement {
     /**\r
      * Main Constructor.\r
      */\r
-    public CustomModelElement(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {\r
-        super(CUSTOM_TYPE, modelProp, modelBpmn, modelJson);\r
+    public CustomModelElement(ModelBpmn modelBpmn, JsonObject modelJson) {\r
+        super(CUSTOM_TYPE, modelBpmn, modelJson);\r
         topicPublishes = JsonUtils.getStringValueByName(modelElementJsonNode, "topicPublishes");\r
         test = JsonUtils.getStringValueByName(modelElementJsonNode, "test");\r
     }\r