From f365b5eb5cc0c466edd21af9526ede8d472c8132 Mon Sep 17 00:00:00 2001 From: Brian Lagunas <835562+brianlagunas@users.noreply.github.com> Date: Fri, 7 Jun 2024 14:37:52 -0600 Subject: [PATCH] added converter for xmla filter rule --- .../XmlaDimensionElementConverter.cs | 11 ++++++----- .../Converters/XmlaFilterRuleConverter.cs | 19 +++++++++++++++++++ src/Reveal.Sdk.Dom/Filters/XmlaFilterRule.cs | 6 ++++-- 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaFilterRuleConverter.cs diff --git a/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaDimensionElementConverter.cs b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaDimensionElementConverter.cs index 225024f..d4df60e 100644 --- a/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaDimensionElementConverter.cs +++ b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaDimensionElementConverter.cs @@ -1,4 +1,5 @@ -using Reveal.Sdk.Dom.Visualizations; +using Reveal.Sdk.Dom.Core.Constants; +using Reveal.Sdk.Dom.Visualizations; using System; using System.Collections.Generic; @@ -10,10 +11,10 @@ public XmlaDimensionElementConverter() { TypeMap = new Dictionary() { - { "XmlaDimensionType", typeof(XmlaDimension) }, - { "XmlaHierarchyLevelType", typeof(XmlaHierarchyLevel) }, - { "XmlaHierarchyType", typeof(XmlaHierarchy) }, - { "XmlaSetType", typeof(XmlaSet) }, + { SchemaTypeNames.XmlaDimensionType, typeof(XmlaDimension) }, + { SchemaTypeNames.XmlaHierarchyLevelType, typeof(XmlaHierarchyLevel) }, + { SchemaTypeNames.XmlaHierarchyType, typeof(XmlaHierarchy) }, + { SchemaTypeNames.XmlaSetType, typeof(XmlaSet) }, }; } } diff --git a/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaFilterRuleConverter.cs b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaFilterRuleConverter.cs new file mode 100644 index 0000000..b2fe950 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/XmlaFilterRuleConverter.cs @@ -0,0 +1,19 @@ +using Reveal.Sdk.Dom.Core.Constants; +using Reveal.Sdk.Dom.Filters; +using System; +using System.Collections.Generic; + +namespace Reveal.Sdk.Dom.Core.Serialization.Converters +{ + internal class XmlaFilterRuleConverter : TypeMapConverter + { + public XmlaFilterRuleConverter() + { + TypeMap = new Dictionary() + { + { SchemaTypeNames.XmlaNumberFilterRuleType, typeof(XmlaNumberFilterRule) }, + { SchemaTypeNames.XmlaStringFilterRuleType, typeof(XmlaStringFilterRule) }, + }; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Filters/XmlaFilterRule.cs b/src/Reveal.Sdk.Dom/Filters/XmlaFilterRule.cs index 51058b7..625a608 100644 --- a/src/Reveal.Sdk.Dom/Filters/XmlaFilterRule.cs +++ b/src/Reveal.Sdk.Dom/Filters/XmlaFilterRule.cs @@ -1,8 +1,10 @@ -using Reveal.Sdk.Dom.Core; +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core; +using Reveal.Sdk.Dom.Core.Serialization.Converters; namespace Reveal.Sdk.Dom.Filters { - //todo: need converter XmlaNumberFilterRuleType XmlaStringFilterRuleType + [JsonConverter(typeof(XmlaFilterRuleConverter))] public abstract class XmlaFilterRule : SchemaType {