summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-06-16 23:21:04 +0100
committerMichael Morris <michael.morris@est.tech>2021-07-15 13:22:37 +0000
commit53df976426f8845adf58e8ff9355764343a38549 (patch)
treeaa1653532eaf24722be2689f3d6addd0f15094eb /catalog-be/src/main/java/org
parentf94241f6b5f25ddda29e505306b16af7f5b82749 (diff)
Specify model at service creation
Allows a user to select a model when designing a service Issue-ID: SDC-3621 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I386e43ddeb649a4ba0805f153e4b47e8a528cff0
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java1
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java2
4 files changed, 7 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
index 6eb806d3d1..de79ec165d 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
@@ -50,7 +50,7 @@ public class ModelBusinessLogic {
}
public Model createModel(final Model model) {
- LOGGER.debug("createModel: creating model {}", model);
+ LOGGER.debug("creating model {}", model);
return modelOperation.createModel(model, false);
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
index 2956abfe1b..c0c68d6c47 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogic.java
@@ -2451,6 +2451,9 @@ public class ServiceImportBusinessLogic {
if (CollectionUtils.isEmpty(newResource.getProperties())) {
newResource.setProperties(oldResource.getProperties());
}
+ if (newResource.getModel() == null) {
+ newResource.setModel(oldResource.getModel());
+ }
}
protected Map<String, Resource> createResourcesFromYamlNodeTypesList(String yamlName, Service service, Map<String, Object> mappedToscaTemplate,
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
index 706f7a7304..32a63dcc46 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
@@ -445,6 +445,7 @@ public class UiComponentDataConverter {
dataTransfer.setMetadata(metadata);
dataTransfer.setDerivedFromGenericType(service.getDerivedFromGenericType());
dataTransfer.setDerivedFromGenericVersion(service.getDerivedFromGenericVersion());
+ dataTransfer.setModel(service.getModel());
break;
case NODE_FILTER:
if (service.getNodeFilterComponents() == null) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java
index bdc9ffce43..e7966e0d08 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java
@@ -123,6 +123,7 @@ public class ResourceUploadServlet extends AbstractValidationsServlet {
commonGeneralValidations(responseWrapper, userWrapper, uploadResourceInfoWrapper, resourceAuthorityEnum, userId, resourceInfoJsonString);
final String modelNameToBeAssociated = uploadResourceInfoWrapper.getInnerElement().getModel();
if (modelNameToBeAssociated != null) {
+ log.debug("Model Name to be validated {}", modelNameToBeAssociated);
validateModel(modelNameToBeAssociated);
}
fillPayload(responseWrapper, uploadResourceInfoWrapper, yamlStringWrapper, userWrapper.getInnerElement(), resourceInfoJsonString,
@@ -155,6 +156,7 @@ public class ResourceUploadServlet extends AbstractValidationsServlet {
*/
private void validateModel(final String modelName) {
if (modelBusinessLogic.findModel(modelName).isEmpty()) {
+ log.error("Could not find model name {}", modelName);
throw ModelOperationExceptionSupplier.invalidModel(modelName).get();
}
}