diff options
author | MichaelMorris <michael.morris@est.tech> | 2022-08-13 09:06:08 +0100 |
---|---|---|
committer | MichaelMorris <michael.morris@est.tech> | 2022-08-15 10:25:17 +0100 |
commit | cc764ab040ec1c278d8619d2d92be638d8f585e8 (patch) | |
tree | 23af29059bcc8f1e38ded05d02cf11cf8d99f5f0 /catalog-be/src | |
parent | 6bbf79ac50acb21e7e4ceb8c613eb4ecc872aa3d (diff) |
Fix new data types not found in UI
Also, fixed issue with data type sorting when there are mutliple layers in dependency hierarchy
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-4129
Change-Id: I4d535420953237efd610a3fb1dd6b9d40883e514
Diffstat (limited to 'catalog-be/src')
-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); |