diff options
author | 2021-05-10 13:19:46 +0100 | |
---|---|---|
committer | 2021-05-26 12:50:08 +0000 | |
commit | db872f8f3613e855f60c14983335e54c1fc95c2e (patch) | |
tree | 9f8b82b8f091d5e61221d87c51a8ac8d28f20a57 /plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap | |
parent | 358f97566c36c738d85deb82818bf7278ac9cc6c (diff) |
Support ':' in Apex Event Avro schema fieldnames
Similar to '.' (_DoT_) and '-' (_Dash_), the ':' (_ColoN_) character
can now be used in Apex Event Field names specified using Avro Schema
Change-Id: I320058441a1a1a544b9f1619e45c96e71e5aa9e3
Signed-off-by: JohnKeeney <john.keeney@est.tech>
Issue-ID: POLICY-3301
Signed-off-by: JohnKeeney <john.keeney@est.tech>
(cherry picked from commit fe40844bba4a94e26efc0f1c57d62c97e35bfc79)
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap')
-rw-r--r-- | plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java index 965457206..6229c066e 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java @@ -38,6 +38,8 @@ public final class AvroSchemaKeyTranslationUtilities { private static final String DOT_STRING_REPLACEMENT = "_DoT_"; private static final String DASH_STRING = "-"; private static final String DASH_STRING_REPLACEMENT = "_DasH_"; + private static final String COLON_STRING = ":"; + private static final String COLON_STRING_REPLACEMENT = "_ColoN_"; /** * Default constructor to avoid subclassing. @@ -134,9 +136,13 @@ public final class AvroSchemaKeyTranslationUtilities { */ private static String translateIllegalKey(final String key, final boolean revert) { if (revert) { - return key.replace(DOT_STRING_REPLACEMENT, DOT_STRING).replace(DASH_STRING_REPLACEMENT, DASH_STRING); + return key.replace(DOT_STRING_REPLACEMENT, DOT_STRING) + .replace(DASH_STRING_REPLACEMENT, DASH_STRING) + .replace(COLON_STRING_REPLACEMENT, COLON_STRING); } else { - return key.replace(DOT_STRING, DOT_STRING_REPLACEMENT).replace(DASH_STRING, DASH_STRING_REPLACEMENT); + return key.replace(DOT_STRING, DOT_STRING_REPLACEMENT) + .replace(DASH_STRING, DASH_STRING_REPLACEMENT) + .replace(COLON_STRING, COLON_STRING_REPLACEMENT); } } } |