* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.rest.jpa.MicroServiceModels;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.rest.jpa.MicroServiceModels;
import org.onap.policy.rest.jpa.UserInfo;
-import org.onap.policy.rest.util.MSAttributeObject;
-import org.onap.policy.rest.util.MSModelUtils;
-import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE;
+import org.onap.policy.rest.util.MsAttributeObject;
+import org.onap.policy.rest.util.MsModelUtils;
+import org.onap.policy.rest.util.MsModelUtils.ModelType;
public class CreateNewMicroServiceModel {
private static final Logger logger = FlexLogger.getLogger(CreateNewMicroServiceModel.class);
private MicroServiceModels newModel = null;
public class CreateNewMicroServiceModel {
private static final Logger logger = FlexLogger.getLogger(CreateNewMicroServiceModel.class);
private MicroServiceModels newModel = null;
public CreateNewMicroServiceModel(String fileName, String serviceName, String string, String version) {
super();
public CreateNewMicroServiceModel(String fileName, String serviceName, String string, String version) {
super();
// Need to delete the file
if (importFile.contains(".zip")) {
extractFolder(randomID + ".zip");
// Need to delete the file
if (importFile.contains(".zip")) {
extractFolder(randomID + ".zip");
msAttributes.setClassName(modelName);
LinkedHashMap<String, String> returnAttributeList = new LinkedHashMap<>();
msAttributes.setClassName(modelName);
LinkedHashMap<String, String> returnAttributeList = new LinkedHashMap<>();
returnReferenceList.put(modelName, utils.getReferenceAttributes());
msAttributes.setRefAttribute(returnReferenceList);
returnReferenceList.put(modelName, utils.getReferenceAttributes());
msAttributes.setRefAttribute(returnReferenceList);
LinkedHashMap<String, String> enumList = new LinkedHashMap<>();
String[] listArray = utils.getListConstraints().split("#");
for (String str : listArray) {
LinkedHashMap<String, String> enumList = new LinkedHashMap<>();
String[] listArray = utils.getListConstraints().split("#");
for (String str : listArray) {
public Map<String, String> addValuesToNewModel(String type) {
Map<String, String> successMap = new HashMap<>();
public Map<String, String> addValuesToNewModel(String type) {
Map<String, String> successMap = new HashMap<>();
if (".yml".equalsIgnoreCase(type)) {
newModel.setDependency("[]");
if (mainClass.getSubClass() != null) {
String value = new Gson().toJson(mainClass.getSubClass());
if (".yml".equalsIgnoreCase(type)) {
newModel.setDependency("[]");
if (mainClass.getSubClass() != null) {
String value = new Gson().toJson(mainClass.getSubClass());
String refAttributes = mainClass.getRefAttribute().toString().replace("{", "").replace("}", "");
int equalsIndex = refAttributes.indexOf("=");
String refAttributesAfterFirstEquals = refAttributes.substring(equalsIndex + 1);
String refAttributes = mainClass.getRefAttribute().toString().replace("{", "").replace("}", "");
int equalsIndex = refAttributes.indexOf("=");
String refAttributesAfterFirstEquals = refAttributes.substring(equalsIndex + 1);
dependency = utils.getFullDependencyList(dependency, classMap);
if (!dependency.isEmpty()) {
for (String element : dependency) {
dependency = utils.getFullDependencyList(dependency, classMap);
if (!dependency.isEmpty()) {
for (String element : dependency) {
if (classMap.containsKey(element)) {
temp = classMap.get(element);
mainClass.addAllRefAttribute(temp.getRefAttribute());
if (classMap.containsKey(element)) {
temp = classMap.get(element);
mainClass.addAllRefAttribute(temp.getRefAttribute());
if (mainClass.getAttribute() != null && !mainClass.getAttribute().isEmpty()) {
this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
}
if (mainClass.getRefAttribute() != null && !mainClass.getRefAttribute().isEmpty()) {
this.newModel
if (mainClass.getAttribute() != null && !mainClass.getAttribute().isEmpty()) {
this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
}
if (mainClass.getRefAttribute() != null && !mainClass.getRefAttribute().isEmpty()) {
this.newModel
model.setDependency(this.newModel.getDependency());
model.setDescription(this.newModel.getDescription());
model.setEnumValues(this.newModel.getEnumValues());
model.setDependency(this.newModel.getDependency());
model.setDescription(this.newModel.getDescription());
model.setEnumValues(this.newModel.getEnumValues());
- model.setRef_attributes(this.newModel.getRef_attributes());
- model.setSub_attributes(this.newModel.getSub_attributes());
+ model.setRefAttributes(this.newModel.getRefAttributes());
+ model.setSubAttributes(this.newModel.getSubAttributes());
model.setDataOrderInfo(this.newModel.getDataOrderInfo());
model.setDecisionModel(this.newModel.isDecisionModel());
model.setRuleFormation(this.newModel.getRuleFormation());
model.setDataOrderInfo(this.newModel.getDataOrderInfo());
model.setDecisionModel(this.newModel.isDecisionModel());
model.setRuleFormation(this.newModel.getRuleFormation());