aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DataTypeOperation.java16
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java2
2 files changed, 17 insertions, 1 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DataTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DataTypeOperation.java
index 36dcaf44ba..7d01f3f273 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DataTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DataTypeOperation.java
@@ -29,6 +29,7 @@ import java.util.Optional;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraph;
@@ -37,6 +38,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.QueryType;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
@@ -124,6 +126,20 @@ public class DataTypeOperation extends AbstractOperation {
return dataTypesFound;
}
+ public List<String> getAllDataTypeModels(final String dataTypeName) {
+ final List<String> models = new ArrayList<>();
+ ImmutableTriple<QueryType, String, Object> criteria =
+ new ImmutableTriple<>(QueryType.HAS, GraphPropertiesDictionary.NAME.getProperty(), dataTypeName);
+
+ final Either<List<DataTypeData>, JanusGraphOperationStatus> getAllDataTypesForModel =
+ janusGraphGenericDao.getByCriteria(NodeTypeEnum.DataType, DataTypeData.class, List.of(criteria));
+ final var dataTypesValidated = validateDataType(getAllDataTypesForModel, null);
+ for (DataTypeData dataType : dataTypesValidated) {
+ models.add(dataType.getDataTypeDataDefinition().getModel());
+ }
+ return models;
+ }
+
private List<DataTypeData> getAllDataTypesWithModel(final String modelName) {
final Either<List<DataTypeData>, JanusGraphOperationStatus> getAllDataTypesByModel = janusGraphGenericDao
.getByCriteriaForModel(NodeTypeEnum.DataType, null, modelName, DataTypeData.class);
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 0d462c9874..8baa9a73c0 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
@@ -296,7 +296,7 @@ public class ModelOperation {
rebuiltModelImportList = new ArrayList<>(modelImportList);
}
- final Map<String, Object> typesYamlMap = new Yaml().load(typesYaml);
+ final Map<String, Object> typesYamlMap = new Yaml().loadAs(typesYaml, Map.class);
removeExistingTypesFromDefaultImports(elementTypeEnum, typesYamlMap, rebuiltModelImportList);
final Map<String, Object> originalContent = new Yaml().load(additionalTypeDefinitionsImport.getContent());