From 8dd87b274662f44c451490bf71278158fac07ffc Mon Sep 17 00:00:00 2001 From: Mark Chance <mark.chance@hitachivantara.com> Date: Tue, 1 Oct 2024 16:11:39 -0400 Subject: [PATCH] use existing Schema config object --- .../schema/converter/PropertiesProcessor.java | 20 +- .../Generated/file/File.1.0.0.json.FF.res | 49 +++ .../wks/slb_wke_wellbore.json.FF.res | 357 ++++++++++++++++++ .../src/main/resources/application.properties | 1 + .../src/main/resources/application.properties | 1 + .../src/main/resources/application.properties | 1 + .../src/main/resources/application.properties | 1 + 7 files changed, 419 insertions(+), 11 deletions(-) create mode 100644 indexer-core/src/test/resources/converter/R3-json-schema/Generated/file/File.1.0.0.json.FF.res create mode 100644 indexer-core/src/test/resources/converter/wks/slb_wke_wellbore.json.FF.res 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 45a13b37f..0a84da41d 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 @@ -14,6 +14,7 @@ package org.opengroup.osdu.indexer.schema.converter; +import lombok.Getter; import org.apache.http.HttpStatus; import org.opengroup.osdu.core.common.Constants; import org.opengroup.osdu.core.common.model.http.AppException; @@ -36,7 +37,7 @@ import java.util.stream.Stream; public class PropertiesProcessor { - private SchemaConverterConfig schemaConverterConfig; + private final SchemaConverterConfig schemaConverterConfig; private static final String TYPE_KEY = "type"; private static final String DEF_PREFIX = "#/definitions/"; @@ -47,6 +48,7 @@ public class PropertiesProcessor { private final String pathPrefix; private final String pathPrefixWithDot; + @Getter private final List<String> errors = new LinkedList<>(); public PropertiesProcessor(Definitions definitions, SchemaConverterConfig schemaConverterConfig) { @@ -124,10 +126,6 @@ public class PropertiesProcessor { return properties.entrySet().stream().flatMap(this::processPropertyEntry); } - public List<String> getErrors() { - return errors; - } - private String getDefinitionIdentity(String definitionSubRef) { String[] components = definitionSubRef.split(":"); switch (components.length) { @@ -208,7 +206,7 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getProperties())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , new SchemaConverterPropertiesConfig()); + , schemaConverterConfig); Stream<Map<String, Object>> result = entry.getValue().getProperties().entrySet().stream().flatMap(propertiesProcessor::processPropertyEntry); errors.addAll(propertiesProcessor.getErrors()); return result; @@ -216,7 +214,7 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getRef())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions - , pathPrefixWithDot + entry.getKey(), new SchemaConverterPropertiesConfig()); + , pathPrefixWithDot + entry.getKey(), schemaConverterConfig); Stream<Map<String, Object>> refResult = propertiesProcessor.processRef(entry.getValue().getRef()); errors.addAll(propertiesProcessor.getErrors()); return refResult; @@ -238,7 +236,7 @@ public class PropertiesProcessor { indexHint.getOrDefault(TYPE_KEY, schemaConverterConfig.getDefaultObjectArraysType()); if (schemaConverterConfig.getProcessedArraysTypes().contains(indexingType)) { - PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, new SchemaConverterPropertiesConfig()); + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, schemaConverterConfig); Stream<Map<String, Object>> propertiesStream = Stream.empty(); @@ -265,7 +263,7 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getAllOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , new SchemaConverterPropertiesConfig()); + , schemaConverterConfig); ofItems = entry.getValue().getAllOf().stream().flatMap(propertiesProcessor::processItem); errors.addAll(propertiesProcessor.getErrors()); @@ -273,7 +271,7 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getAnyOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , new SchemaConverterPropertiesConfig()); + , schemaConverterConfig); ofItems = Stream.concat(Optional.ofNullable(ofItems).orElseGet(Stream::empty), entry.getValue().getAnyOf().stream().flatMap(propertiesProcessor::processItem)); @@ -282,7 +280,7 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getOneOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , new SchemaConverterPropertiesConfig()); + , schemaConverterConfig); ofItems = Stream.concat(Optional.ofNullable(ofItems).orElseGet(Stream::empty), entry.getValue().getOneOf().stream().flatMap(propertiesProcessor::processItem)); diff --git a/indexer-core/src/test/resources/converter/R3-json-schema/Generated/file/File.1.0.0.json.FF.res b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/file/File.1.0.0.json.FF.res new file mode 100644 index 000000000..c354504c3 --- /dev/null +++ b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/file/File.1.0.0.json.FF.res @@ -0,0 +1,49 @@ +{ + "kind": "osdu:osdu:Wellbore:1.0.0", + "schema": [ + { + "kind": "link", + "path": "SchemaFormatTypeID" + }, + { + "kind": "string", + "path": "PreloadFilePath" + }, + { + "kind": "string", + "path": "FileSource" + }, + { + "kind": "int", + "path": "FileSize" + }, + { + "kind": "link", + "path": "EncodingFormatTypeID" + }, + { + "kind": "string", + "path": "Endian" + }, + { + "kind": "boolean", + "path": "LossyCompressionIndicator" + }, + { + "kind": "link", + "path": "CompressionMethodTypeID" + }, + { + "kind": "double", + "path": "CompressionLevel" + }, + { + "kind": "string", + "path": "Checksum" + }, + { + "kind": "[]object", + "path": "VectorHeaderMapping" + } + ] +} diff --git a/indexer-core/src/test/resources/converter/wks/slb_wke_wellbore.json.FF.res b/indexer-core/src/test/resources/converter/wks/slb_wke_wellbore.json.FF.res new file mode 100644 index 000000000..37d499f5d --- /dev/null +++ b/indexer-core/src/test/resources/converter/wks/slb_wke_wellbore.json.FF.res @@ -0,0 +1,357 @@ +{ + "kind": "slb:wks:wellbore:1.0.6", + "schema": [ + { + "kind": "string", + "path": "airGap.unitKey" + }, + { + "kind": "double", + "path": "airGap.value" + }, + { + "kind": "string", + "path": "block" + }, + { + "kind": "string", + "path": "country" + }, + { + "kind": "string", + "path": "county" + }, + { + "kind": "datetime", + "path": "dateCreated" + }, + { + "kind": "datetime", + "path": "dateModified" + }, + { + "kind": "string", + "path": "drillingDaysTarget.unitKey" + }, + { + "kind": "double", + "path": "drillingDaysTarget.value" + }, + { + "kind": "string", + "path": "elevationReference.elevationFromMsl.unitKey" + }, + { + "kind": "double", + "path": "elevationReference.elevationFromMsl.value" + }, + { + "kind": "string", + "path": "elevationReference.name" + }, + { + "kind": "[]link", + "path": "externalIds" + }, + { + "kind": "string", + "path": "field" + }, + { + "kind": "string", + "path": "formationAtTd" + }, + { + "kind": "string", + "path": "formationProjected" + }, + { + "kind": "boolean", + "path": "hasAchievedTotalDepth" + }, + { + "kind": "boolean", + "path": "isActive" + }, + { + "kind": "string", + "path": "kickOffMd.unitKey" + }, + { + "kind": "double", + "path": "kickOffMd.value" + }, + { + "kind": "string", + "path": "kickOffTvd.unitKey" + }, + { + "kind": "double", + "path": "kickOffTvd.value" + }, + { + "kind": "core:dl:geoshape:1.0.0", + "path": "locationWGS84" + }, + { + "kind": "string", + "path": "name" + }, + { + "kind": "string", + "path": "operator" + }, + { + "kind": "datetime", + "path": "permitDate" + }, + { + "kind": "string", + "path": "permitNumber" + }, + { + "kind": "string", + "path": "plssLocation.aliquotPart" + }, + { + "kind": "string", + "path": "plssLocation.range" + }, + { + "kind": "int", + "path": "plssLocation.section" + }, + { + "kind": "string", + "path": "plssLocation.township" + }, + { + "kind": "string", + "path": "propertyDictionary" + }, + { + "kind": "double", + "path": "relationships.definitiveTimeDepthRelation.confidence" + }, + { + "kind": "link", + "path": "relationships.definitiveTimeDepthRelation.id" + }, + { + "kind": "string", + "path": "relationships.definitiveTimeDepthRelation.name" + }, + { + "kind": "long", + "path": "relationships.definitiveTimeDepthRelation.version" + }, + { + "kind": "double", + "path": "relationships.definitiveTrajectory.confidence" + }, + { + "kind": "link", + "path": "relationships.definitiveTrajectory.id" + }, + { + "kind": "string", + "path": "relationships.definitiveTrajectory.name" + }, + { + "kind": "long", + "path": "relationships.definitiveTrajectory.version" + }, + { + "kind": "double", + "path": "relationships.tieInWellbore.confidence" + }, + { + "kind": "link", + "path": "relationships.tieInWellbore.id" + }, + { + "kind": "string", + "path": "relationships.tieInWellbore.name" + }, + { + "kind": "long", + "path": "relationships.tieInWellbore.version" + }, + { + "kind": "double", + "path": "relationships.well.confidence" + }, + { + "kind": "link", + "path": "relationships.well.id" + }, + { + "kind": "string", + "path": "relationships.well.name" + }, + { + "kind": "long", + "path": "relationships.well.version" + }, + { + "kind": "string", + "path": "shape" + }, + { + "kind": "datetime", + "path": "spudDate" + }, + { + "kind": "string", + "path": "state" + }, + { + "kind": "string", + "path": "totalDepthMd.unitKey" + }, + { + "kind": "double", + "path": "totalDepthMd.value" + }, + { + "kind": "string", + "path": "totalDepthMdDriller.unitKey" + }, + { + "kind": "double", + "path": "totalDepthMdDriller.value" + }, + { + "kind": "string", + "path": "totalDepthMdPlanned.unitKey" + }, + { + "kind": "double", + "path": "totalDepthMdPlanned.value" + }, + { + "kind": "string", + "path": "totalDepthMdSubSeaPlanned.unitKey" + }, + { + "kind": "double", + "path": "totalDepthMdSubSeaPlanned.value" + }, + { + "kind": "string", + "path": "totalDepthProjectedMd.unitKey" + }, + { + "kind": "double", + "path": "totalDepthProjectedMd.value" + }, + { + "kind": "string", + "path": "totalDepthTvd.unitKey" + }, + { + "kind": "double", + "path": "totalDepthTvd.value" + }, + { + "kind": "string", + "path": "totalDepthTvdDriller.unitKey" + }, + { + "kind": "double", + "path": "totalDepthTvdDriller.value" + }, + { + "kind": "string", + "path": "totalDepthTvdPlanned.unitKey" + }, + { + "kind": "double", + "path": "totalDepthTvdPlanned.value" + }, + { + "kind": "string", + "path": "totalDepthTvdSubSeaPlanned.unitKey" + }, + { + "kind": "double", + "path": "totalDepthTvdSubSeaPlanned.value" + }, + { + "kind": "string", + "path": "uwi" + }, + { + "kind": "string", + "path": "wellHeadElevation.unitKey" + }, + { + "kind": "double", + "path": "wellHeadElevation.value" + }, + { + "kind": "string", + "path": "wellHeadGeographic.crsKey" + }, + { + "kind": "string", + "path": "wellHeadGeographic.elevationFromMsl.unitKey" + }, + { + "kind": "double", + "path": "wellHeadGeographic.elevationFromMsl.value" + }, + { + "kind": "double", + "path": "wellHeadGeographic.latitude" + }, + { + "kind": "double", + "path": "wellHeadGeographic.longitude" + }, + { + "kind": "string", + "path": "wellHeadProjected.crsKey" + }, + { + "kind": "string", + "path": "wellHeadProjected.elevationFromMsl.unitKey" + }, + { + "kind": "double", + "path": "wellHeadProjected.elevationFromMsl.value" + }, + { + "kind": "double", + "path": "wellHeadProjected.x" + }, + { + "kind": "double", + "path": "wellHeadProjected.y" + }, + { + "kind": "core:dl:geopoint:1.0.0", + "path": "wellHeadWgs84" + }, + { + "kind": "string", + "path": "wellboreNumberGovernment" + }, + { + "kind": "string", + "path": "wellboreNumberOperator" + }, + { + "kind": "string", + "path": "wellborePurpose" + }, + { + "kind": "string", + "path": "wellboreStatus" + }, + { + "kind": "string", + "path": "wellboreType" + } + ] +} \ No newline at end of file diff --git a/provider/indexer-aws/src/main/resources/application.properties b/provider/indexer-aws/src/main/resources/application.properties index d6180a3d8..10ea1892a 100644 --- a/provider/indexer-aws/src/main/resources/application.properties +++ b/provider/indexer-aws/src/main/resources/application.properties @@ -85,6 +85,7 @@ spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.Sec # Feature flag settings featureFlag.strategy=appProperty +featureFlag.mapBooleanToString.enabled=false featureFlag.asIngestedCoordinates.enabled=true featureFlag.keywordLower.enabled=true featureFlag.bagOfWords.enabled=true diff --git a/provider/indexer-azure/src/main/resources/application.properties b/provider/indexer-azure/src/main/resources/application.properties index 08b7c659d..5a84c72c3 100644 --- a/provider/indexer-azure/src/main/resources/application.properties +++ b/provider/indexer-azure/src/main/resources/application.properties @@ -105,6 +105,7 @@ redis.database=${REDIS_DATABASE} # Feature flag settings featureFlag.strategy=${featureFlag_appProperty:appProperty} +featureFlag.mapBooleanToString.enabled=${featureFlag_mapBooleanToString_enabled:false} featureFlag.asIngestedCoordinates.enabled=${featureFlag_asIngestedCoordinates_enabled:true} featureFlag.keywordLower.enabled=${featureFlag_keywordLower_enabled:true} featureFlag.bagOfWords.enabled=${featureFlag_bagOfWords_enabled:true} diff --git a/provider/indexer-gc/src/main/resources/application.properties b/provider/indexer-gc/src/main/resources/application.properties index f25237671..b4ad62851 100644 --- a/provider/indexer-gc/src/main/resources/application.properties +++ b/provider/indexer-gc/src/main/resources/application.properties @@ -66,6 +66,7 @@ reindex-topic-name=reindex # Feature flag settings featureFlag.strategy=dataPartition featureFlag.xCollaboration.enabled=false +featureFlag.mapBooleanToString.enabled=false featureFlag.asIngestedCoordinates.enabled=true featureFlag.keywordLower.enabled=true featureFlag.bagOfWords.enabled=true diff --git a/provider/indexer-ibm/src/main/resources/application.properties b/provider/indexer-ibm/src/main/resources/application.properties index d0e2d06b3..6c205933b 100644 --- a/provider/indexer-ibm/src/main/resources/application.properties +++ b/provider/indexer-ibm/src/main/resources/application.properties @@ -71,6 +71,7 @@ ELASTIC_USER_PASSWORD=REPLACE_ME:REPLACE_ME # Feature flag settings featureFlag.strategy=appProperty +featureFlag.mapBooleanToString.enabled=false featureFlag.asIngestedCoordinates.enabled=false featureFlag.keywordLower.enabled=false featureFlag.bagOfWords.enabled=false -- GitLab