* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
*/
package org.onap.clamp.clds.model.properties;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.camel.Exchange;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.exception.ModelBpmnException;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.CldsModel;
import org.onap.clamp.clds.service.CldsService;
+import org.onap.clamp.clds.util.JacksonUtils;
/**
* Parse model properties.
this.actionCd = actionCd;
this.testOnly = isATest;
modelBpmn = ModelBpmn.create(modelBpmnText);
- modelJson = new ObjectMapper().readTree(modelPropText);
+ modelJson = JacksonUtils.getObjectMapperInstance().readTree(modelPropText);
instantiateMissingModelElements();
} catch (IOException e) {
throw new ModelBpmnException("Exception occurred when trying to decode the BPMN Properties JSON", e);
public static String getVf(CldsModel model) {
List<String> vfs = null;
try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode modelJson = mapper.readTree(model.getPropText());
+ JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(model.getPropText());
Global global = new Global(modelJson);
vfs = global.getResourceVf();
} catch (IOException e) {
return normalizePolicyScopeName(controlName + "_" + currentModelElementId);
}
+ private String createScopeSeparator(String policyScope) {
+ return policyScope.contains(".") ? "" : ".";
+ }
+
/**
* @return the currentPolicyScopeAndPolicyName
*/
public String getCurrentPolicyScopeAndPolicyName() {
- return normalizePolicyScopeName(modelName + "." + getCurrentPolicyName());
+ return normalizePolicyScopeName(modelName + createScopeSeparator(modelName) + getCurrentPolicyName());
}
/**
- * @return the policyScopeAndNameWithUniqueId
+ * @return The policyName that wil be used in input parameters of DCAE
+ * deploy
*/
- public String getPolicyScopeAndNameWithUniqueId() {
- return normalizePolicyScopeName(modelName + "." + getCurrentPolicyName() + "_" + policyUniqueId);
+ public String getPolicyNameForDcaeDeploy(ClampProperties refProp) {
+ return normalizePolicyScopeName(modelName + createScopeSeparator(modelName)
+ + refProp.getStringValue(PolicyClient.POLICY_MS_NAME_PREFIX_PROPERTY_NAME) + getCurrentPolicyName());
}
/**
- * @return the currentPolicyScopeAndFullPolicyName
+ * @return the policyScopeAndNameWithUniqueId
*/
- public String getCurrentPolicyScopeAndFullPolicyName(String policyNamePrefix) {
- return normalizePolicyScopeName(modelName + "." + policyNamePrefix + getCurrentPolicyName());
+ public String getPolicyScopeAndNameWithUniqueId() {
+ return normalizePolicyScopeName(
+ modelName + createScopeSeparator(modelName) + getCurrentPolicyName() + "_" + policyUniqueId);
}
/**
- * @return the currentPolicyScopeAndFullPolicyNameWithVersion
+ * @return the currentPolicyScopeAndFullPolicyName
*/
- public String getCurrentPolicyScopeAndFullPolicyNameWithVersion(String policyNamePrefix, int version) {
+ public String getCurrentPolicyScopeAndFullPolicyName(String policyNamePrefix) {
return normalizePolicyScopeName(
- modelName + "." + policyNamePrefix + getCurrentPolicyName() + "." + version + ".xml");
+ modelName + createScopeSeparator(modelName) + policyNamePrefix + getCurrentPolicyName());
}
/**