diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java index 830ba9d33b2208367f17f9abbcd9ca635b127a47..04a3211fda1a6a91a71fc7cea639951b41b90642 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java @@ -15,6 +15,7 @@ package org.opengroup.osdu.indexer.schema.converter; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -25,7 +26,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.http.HttpStatus; import org.opengroup.osdu.core.common.Constants; -import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.search.Preconditions; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterConfig; @@ -185,19 +185,15 @@ public class PropertiesProcessor { } if ("array".equals(entry.getValue().getType())) { - if (schemaConverterConfig.getSupportedArrayTypes().contains(entry.getValue().getItems().getType())) { - return storageSchemaEntry("[]" + getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); - } - if ("array".equals(entry.getValue().getType())) { - Items items = entry.getValue().getItems(); - if(Objects.nonNull(items) && items.isComplexTypeItems()){ - return processComplexTypeItems(entry, items); - } + Items items = entry.getValue().getItems(); + if(Objects.nonNull(items) && items.isComplexTypeItems()){ + return processComplexTypeItems(entry, items); + } - if (schemaConverterConfig.getSupportedArrayTypes().contains(items.getType()) && !items.isComplexTypeItems()) { - return storageSchemaEntry("[]" + getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); - } + if (schemaConverterConfig.getSupportedArrayTypes().contains(entry.getValue().getItems().getType()) && !items.isComplexTypeItems()) { + return storageSchemaEntry("[]" + getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); + } return Stream.empty(); } @@ -240,7 +236,7 @@ public class PropertiesProcessor { indexHint.getOrDefault(TYPE_KEY,schemaConverterConfig.getDefaultObjectArraysType()); if(schemaConverterConfig.getProcessedArraysTypes().contains(indexingType)){ - PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, log, new SchemaConverterPropertiesConfig()); + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, new SchemaConverterPropertiesConfig()); Stream<Map<String, Object>> propertiesStream = Stream.empty(); diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java index 0075a77ca3aab58188549459d443c12dde7eedd1..fdcfeba5de48702c853597f8dcd5dbc5d642c821 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java @@ -128,7 +128,7 @@ public class PropertiesProcessorTest { AllOfItem allOfItem = new AllOfItem(); allOfItem.setProperties(allOfItemProperties); - String res = new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()) .processItem(allOfItem).map(Object::toString).reduce("", String::concat); assertEquals("{path="+ PATH + ", kind=nested, properties=[{path="+ PATH + ", kind=int}]}",res); } @@ -156,7 +156,7 @@ public class PropertiesProcessorTest { AllOfItem allOfItem = new AllOfItem(); allOfItem.setProperties(allOfItemProperties); - String res = new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()) .processItem(allOfItem).map(Object::toString).reduce("", String::concat); assertEquals("{path="+ PATH + ", kind=flattened}",res); } @@ -183,7 +183,7 @@ public class PropertiesProcessorTest { AllOfItem allOfItem = new AllOfItem(); allOfItem.setProperties(allOfItemProperties); - String res = new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()) .processItem(allOfItem).map(Object::toString).reduce("", String::concat); assertEquals("{path="+ PATH + ", kind=[]object}",res); } @@ -205,7 +205,7 @@ public class PropertiesProcessorTest { AllOfItem allOfItem = new AllOfItem(); allOfItem.setProperties(allOfItemProperties); - String res = new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()) .processItem(allOfItem).map(Object::toString).reduce("", String::concat); assertEquals("{path="+ PATH + ", kind=[]int}",res); }