Exemplo n.º 1
0
 internal DataFlow(string type, string description, IList <object> annotations, DataFlowFolder folder)
 {
     Type        = type;
     Description = description;
     Annotations = annotations;
     Folder      = folder;
 }
Exemplo n.º 2
0
        internal static DataFlow DeserializeDataFlow(JsonElement element)
        {
            if (element.TryGetProperty("type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "Flowlet": return(Flowlet.DeserializeFlowlet(element));

                case "MappingDataFlow": return(MappingDataFlow.DeserializeMappingDataFlow(element));
                }
            }
            string                     type        = default;
            Optional <string>          description = default;
            Optional <IList <object> > annotations = default;
            Optional <DataFlowFolder>  folder      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <object> array = new List <object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetObject());
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("folder"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value);
                    continue;
                }
            }
            return(new DataFlow(type, description.Value, Optional.ToList(annotations), folder.Value));
        }
        internal static MappingDataFlow DeserializeMappingDataFlow(JsonElement element)
        {
            string                             type            = default;
            Optional <string>                  description     = default;
            Optional <IList <object> >         annotations     = default;
            Optional <DataFlowFolder>          folder          = default;
            Optional <IList <DataFlowSource> > sources         = default;
            Optional <IList <DataFlowSink> >   sinks           = default;
            Optional <IList <Transformation> > transformations = default;
            Optional <string>                  script          = default;
            Optional <IList <string> >         scriptLines     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <object> array = new List <object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetObject());
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("folder"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value);
                    continue;
                }
                if (property.NameEquals("typeProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("sources"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DataFlowSource> array = new List <DataFlowSource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DataFlowSource.DeserializeDataFlowSource(item));
                            }
                            sources = array;
                            continue;
                        }
                        if (property0.NameEquals("sinks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DataFlowSink> array = new List <DataFlowSink>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DataFlowSink.DeserializeDataFlowSink(item));
                            }
                            sinks = array;
                            continue;
                        }
                        if (property0.NameEquals("transformations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Transformation> array = new List <Transformation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Transformation.DeserializeTransformation(item));
                            }
                            transformations = array;
                            continue;
                        }
                        if (property0.NameEquals("script"))
                        {
                            script = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("scriptLines"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            scriptLines = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new MappingDataFlow(type, description.Value, Optional.ToList(annotations), folder.Value, Optional.ToList(sources), Optional.ToList(sinks), Optional.ToList(transformations), script.Value, Optional.ToList(scriptLines)));
        }
Exemplo n.º 4
0
 internal MappingDataFlow(string type, string description, IList <object> annotations, DataFlowFolder folder, IList <DataFlowSource> sources, IList <DataFlowSink> sinks, IList <Transformation> transformations, string script) : base(type, description, annotations, folder)
 {
     Sources         = sources;
     Sinks           = sinks;
     Transformations = transformations;
     Script          = script;
     Type            = type ?? "MappingDataFlow";
 }
        internal static DataFlow DeserializeDataFlow(JsonElement element)
        {
            if (element.TryGetProperty("type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "MappingDataFlow": return(MappingDataFlow.DeserializeMappingDataFlow(element));
                }
            }
            string         type        = default;
            string         description = default;
            IList <object> annotations = default;
            DataFlowFolder folder      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <object> array = new List <object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetObject());
                        }
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("folder"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value);
                    continue;
                }
            }
            return(new DataFlow(type, description, annotations, folder));
        }
Exemplo n.º 6
0
 internal Flowlet(string type, string description, IList <object> annotations, DataFlowFolder folder, IList <DataFlowSource> sources, IList <DataFlowSink> sinks, IList <Transformation> transformations, string script, IList <string> scriptLines) : base(type, description, annotations, folder)
 {
     Sources         = sources;
     Sinks           = sinks;
     Transformations = transformations;
     Script          = script;
     ScriptLines     = scriptLines;
     Type            = type ?? "Flowlet";
 }
        internal static MappingDataFlow DeserializeMappingDataFlow(JsonElement element)
        {
            string                 type            = default;
            string                 description     = default;
            IList <object>         annotations     = default;
            DataFlowFolder         folder          = default;
            IList <DataFlowSource> sources         = default;
            IList <DataFlowSink>   sinks           = default;
            IList <Transformation> transformations = default;
            string                 script          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("annotations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <object> array = new List <object>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetObject());
                        }
                    }
                    annotations = array;
                    continue;
                }
                if (property.NameEquals("folder"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    folder = DataFlowFolder.DeserializeDataFlowFolder(property.Value);
                    continue;
                }
                if (property.NameEquals("typeProperties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("sources"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <DataFlowSource> array = new List <DataFlowSource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(DataFlowSource.DeserializeDataFlowSource(item));
                                }
                            }
                            sources = array;
                            continue;
                        }
                        if (property0.NameEquals("sinks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <DataFlowSink> array = new List <DataFlowSink>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(DataFlowSink.DeserializeDataFlowSink(item));
                                }
                            }
                            sinks = array;
                            continue;
                        }
                        if (property0.NameEquals("transformations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <Transformation> array = new List <Transformation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(Transformation.DeserializeTransformation(item));
                                }
                            }
                            transformations = array;
                            continue;
                        }
                        if (property0.NameEquals("script"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            script = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new MappingDataFlow(type, description, annotations, folder, sources, sinks, transformations, script));
        }