aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-08-16 17:28:10 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2021-08-25 11:02:32 +0000
commitf7776389f137cb881033d77d89cc3f1eb4974077 (patch)
tree2f084f62801873351bcbd851aa382fee96393110 /catalog-model/src/main/java/org
parent35841a655443834474b48d94ae8b124d6f0896ff (diff)
Import VSP with non-standard data types
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3673 Change-Id: I0fd16410788da3a82c74b1d38ffa4458e85e6ccc
Diffstat (limited to 'catalog-model/src/main/java/org')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java4
6 files changed, 7 insertions, 9 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
index 934a43bc38..4cf78adfca 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/DerivedNodeTypeResolver.java
@@ -26,5 +26,5 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
public interface DerivedNodeTypeResolver {
- Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource);
+ Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource, String modelName);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
index 070ebf72e3..954df91552 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ApplicationDataTypeCache.java
@@ -168,7 +168,7 @@ public class ApplicationDataTypeCache implements ApplicationCache<DataTypeDefini
public Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> getAll(final String model) {
try {
readWriteLock.readLock().lock();
- if (MapUtils.isEmpty(dataTypesByModelCacheMap)) {
+ if (MapUtils.isEmpty(dataTypesByModelCacheMap) || !dataTypesByModelCacheMap.containsKey(model)) {
final var dataTypesFound = getAllDataTypesFromGraph();
if (dataTypesFound.isRight()) {
return Either.right(dataTypesFound.right().value());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
index 743fcdec44..4b6c084a89 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java
@@ -41,10 +41,10 @@ public class ByToscaNameDerivedNodeTypeResolver implements DerivedNodeTypeResolv
private JanusGraphDao janusGraphDao;
@Override
- public Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource) {
+ public Either<List<GraphVertex>, JanusGraphOperationStatus> findDerivedResources(String parentResource, final String modelName) {
Map<GraphPropertyEnum, Object> propertiesToMatch = new HashMap<>();
propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name());
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource);
- return janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata);
+ return janusGraphDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, null, JsonParseFlagEnum.ParseMetadata, modelName);
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
index 76d8e71c69..2025a103a6 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
@@ -576,7 +576,7 @@ public class NodeTypeOperation extends ToscaElementOperation {
if (derivedFromResources != null && !derivedFromResources.isEmpty()) {
for (String parentResource : derivedFromResources) {
Either<List<GraphVertex>, JanusGraphOperationStatus> getParentResources = derivedResourceResolver
- .findDerivedResources(parentResource);
+ .findDerivedResources(parentResource, nodeType.getModel());
List<GraphVertex> resources = null;
if (getParentResources.isRight()) {
log.error("Cannot find parent resource by tosca resource name {} in the graph.", parentResource);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index d0f1c3a9dd..a288953a71 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -279,7 +279,7 @@ public abstract class ToscaElementOperation extends BaseOperation {
.getParentVertex(previousToscaElement, EdgeLabelEnum.MODEL, JsonParseFlagEnum.NoParse);
if (modelElementVertexResponse.isLeft()) {
final JanusGraphOperationStatus status = janusGraphDao
- .createEdge(nextToscaElement.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.MODEL, new HashMap<>());
+ .createEdge(modelElementVertexResponse.left().value().getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.MODEL, new HashMap<>());
if (JanusGraphOperationStatus.OK != status) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, EdgeLabelEnum.MODEL,
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index 6466683db6..2f11fa9e8f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -2191,9 +2191,7 @@ public class ToscaOperationFacade {
hasNotProps.put(GraphPropertyEnum.IS_DELETED, true);
hasNotProps.put(GraphPropertyEnum.IS_ARCHIVED, true);
hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- if (modelName != null) {
- hasProps.put(GraphPropertyEnum.MODEL, modelName);
- }
+
if (VertexTypeEnum.NODE_TYPE == internalVertexType) {
hasProps.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract);
if (internalComponentType != null) {