diff options
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java | 6 | ||||
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java index 60fdc0b3d5..943edb1b95 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java @@ -113,7 +113,7 @@ public class DataTypeImportManager { dataTypes.forEach(dataType -> { int highestDependencyIndex = -1; - for (final String dependencyName : getDependencyTypes(dataType)) { + for (final String dependencyName : getDependencyTypes(dataType, dataTypes)) { final DataTypeDefinition dependency = dataTypeDefinitionsMap.get(dependencyName); final int indexOfDependency = sortedDataTypeDefinitions.lastIndexOf(dependency); highestDependencyIndex = indexOfDependency > highestDependencyIndex ? indexOfDependency : highestDependencyIndex; @@ -126,7 +126,7 @@ public class DataTypeImportManager { return sortedDataTypeDefinitions; } - private Collection<String> getDependencyTypes(final DataTypeDefinition dataType) { + private Collection<String> getDependencyTypes(final DataTypeDefinition dataType, final List<DataTypeDefinition> dataTypes) { final Set<String> dependencies = new HashSet<>(); if (dataType.getDerivedFromName() != null) { dependencies.add(dataType.getDerivedFromName()); @@ -134,6 +134,8 @@ public class DataTypeImportManager { if (dataType.getProperties() != null) { dataType.getProperties().stream().forEach(property -> dependencies.add(property.getType())); } + dataTypes.stream().filter(dependencyCandidate -> dependencies.contains(dependencyCandidate.getName())) + .forEach(dependencyDataType -> dependencies.addAll(getDependencyTypes(dependencyDataType, dataTypes))); return dependencies; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java index 7a229c88aa..f461378637 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java @@ -132,6 +132,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet { if (responseWrapper.isEmpty()) { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {} - modifier id is {}", url, userId); + resourceBusinessLogic.getApplicationDataTypeCache().refreshDataTypesCacheIfStale(); final Map<String, DataTypeDefinition> dataTypes = resourceBusinessLogic.getComponentsUtils() .getAllDataTypes(resourceBusinessLogic.getApplicationDataTypeCache(), modelName); String dataTypeJson = gson.toJson(dataTypes); |