diff options
6 files changed, 51 insertions, 53 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java index 73f708c29..9c15524d6 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java @@ -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() { diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java index 63c677d9a..a93b09cfa 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java @@ -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; } - } diff --git a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java index 5160e10a3..a880893ee 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java @@ -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); + } + }); } } diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Policy.java b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java index 9cb3635f0..9537cb9ed 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/Policy.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java @@ -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; } - } diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Tca.java b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java index 0d17b9542..efa0188e9 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/Tca.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java @@ -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; } - } diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java index 871d0a651..31d0be880 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java @@ -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
@@ -26,7 +28,6 @@ package org.onap.clamp.clds.model.prop; import com.google.gson.JsonObject;
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.model.properties.ModelBpmn;
-import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.JsonUtils;
/**
@@ -40,8 +41,8 @@ public class CustomModelElement extends AbstractModelElement { /**
* Main Constructor.
*/
- public CustomModelElement(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- super(CUSTOM_TYPE, modelProp, modelBpmn, modelJson);
+ public CustomModelElement(ModelBpmn modelBpmn, JsonObject modelJson) {
+ super(CUSTOM_TYPE, modelBpmn, modelJson);
topicPublishes = JsonUtils.getStringValueByName(modelElementJsonNode, "topicPublishes");
test = JsonUtils.getStringValueByName(modelElementJsonNode, "test");
}
|