summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2021-08-27 15:07:43 +0100
committerMichael Morris <michael.morris@est.tech>2021-08-30 14:17:08 +0000
commita1cdcda28701f603cf95f591ba447bd723273622 (patch)
tree3d9d36dbbfa5aca12bdeb3cfcddae04ee2cd34a3 /catalog-model/src/main
parent37d9a984c45a2a3389b70fca38513fd4bd821e28 (diff)
Include custom data types from VSP in csar imports
When a model with custom data types is created, the data types are now being added as part of the default model imports files. When a CSAR is generated from a Service Template that is associated to a derived model, the default imports from the parent model are also included in the package. Change-Id: I027d25d7237989a40085edec7fdd399ac09c4db1 Issue-ID: SDC-3692 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
index d522e10d7c..87ab3fc79d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
@@ -177,6 +177,25 @@ public class ModelOperation {
}
/**
+ * Find all the model default imports, with the option to include the default imports from the parent model.
+ *
+ * @param modelId the model id
+ * @param includeParent a flag to include the parent model imports.
+ * @return the list of model default imports, or an empty list if no imports were found.
+ */
+ public List<ToscaImportByModel> findAllModelImports(final String modelId, final boolean includeParent) {
+ final List<ToscaImportByModel> toscaImportByModelList = toscaModelImportCassandraDao.findAllByModel(modelId);
+ if (includeParent) {
+ findModelByName(modelId).ifPresent(model -> {
+ if (model.getDerivedFrom() != null) {
+ toscaImportByModelList.addAll(toscaModelImportCassandraDao.findAllByModel(model.getDerivedFrom()));
+ }
+ });
+ }
+ return toscaImportByModelList;
+ }
+
+ /**
* Finds all the models.
*
* @return the list of models