From 1a4497261798ec2cc8b1e894af1b2ff1b5f434d5 Mon Sep 17 00:00:00 2001 From: Brian Lagunas <835562+brianlagunas@users.noreply.github.com> Date: Fri, 17 May 2024 14:30:54 -0600 Subject: [PATCH] added new data source objects --- e2e/Sandbox/MainWindow.xaml.cs | 21 +++++++- e2e/Sandbox/Sandbox.csproj | 15 ++++++ src/Reveal.Sdk.Dom/Data/DataSource.cs | 7 +++ .../MicrosoftSqlServerDataSourceItem.cs | 1 + .../RestDataSourceItem.cs | 5 +- .../DataSources/AmazonAthenaDataSource.cs | 24 +++++++++ .../DataSources/AmazonRedshiftDataSource.cs | 20 +++++++ .../Data/DataSources/AmazonS3DataSource.cs | 18 +++++++ .../Data/DataSources/BoxDataSource.cs | 10 ++++ .../Data/DataSources/DropboxDataSource.cs | 10 ++++ .../DataSources/GoogleAnalytics4DataSource.cs | 10 ++++ .../DataSources/GoogleBigQueryDataSource.cs | 15 ++++++ .../Data/DataSources/GoogleDriveDataSource.cs | 10 ++++ .../DataSources/GoogleSheetsDataSource.cs | 10 ++++ .../MicrosoftAnalysisServicesDataSource.cs | 21 ++++++++ ...icrosoftAzureAnalysisServicesDataSource.cs | 15 ++++++ .../MicrosoftAzureSqlServerDataSource.cs | 15 ++++++ ...icrosoftAzureSynapseAnalyticsDataSource.cs | 10 ++++ .../MicrosoftOneDriveDataSource.cs | 10 ++++ .../MicrosoftSharePointDataSource.cs | 10 ++++ .../MicrosoftSqlServerDataSource.cs | 30 +++++++++++ .../Data/DataSources/MongoDBDataSource.cs | 30 +++++++++++ .../Data/DataSources/MySQLDataSource.cs | 10 ++++ .../Data/DataSources/ODataDataSource.cs | 15 ++++++ .../Data/DataSources/OracleDataSource.cs | 18 +++++++ .../Data/DataSources/PostgreSQLDataSource.cs | 10 ++++ .../Data/DataSources/RestDataSource.cs | 28 ++++++++++ .../Data/DataSources/SnowflakeDataSource.cs | 21 ++++++++ .../Data/DataSources/WebServiceDataSource.cs | 18 +++++++ src/Reveal.Sdk.Dom/Data/DatabaseSource.cs | 15 ++++++ .../Data/Enums/DataSourceProvider.cs | 15 +++--- src/Reveal.Sdk.Dom/Data/HostDatabaseSource.cs | 22 ++++++++ .../Data/MicrosoftSqlServerDataSource.cs | 53 ------------------- .../Data/ProcessDataDatabaseSource.cs | 28 ++++++++++ .../Data/SchemaDatabaseSource.cs | 15 ++++++ 35 files changed, 523 insertions(+), 62 deletions(-) rename src/Reveal.Sdk.Dom/Data/{ => DataSourceItems}/MicrosoftSqlServerDataSourceItem.cs (96%) rename src/Reveal.Sdk.Dom/Data/{ => DataSourceItems}/RestDataSourceItem.cs (98%) create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/AmazonAthenaDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/AmazonRedshiftDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/AmazonS3DataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/BoxDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/DropboxDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/GoogleAnalytics4DataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/GoogleBigQueryDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/GoogleDriveDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/GoogleSheetsDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAnalysisServicesDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureAnalysisServicesDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSqlServerDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSynapseAnalyticsDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftOneDriveDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSharePointDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSqlServerDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MongoDBDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/MySQLDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/ODataDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/OracleDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/PostgreSQLDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/RestDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/SnowflakeDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DataSources/WebServiceDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/DatabaseSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/HostDatabaseSource.cs delete mode 100644 src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/ProcessDataDatabaseSource.cs create mode 100644 src/Reveal.Sdk.Dom/Data/SchemaDatabaseSource.cs diff --git a/e2e/Sandbox/MainWindow.xaml.cs b/e2e/Sandbox/MainWindow.xaml.cs index 0d1c162..aad4895 100644 --- a/e2e/Sandbox/MainWindow.xaml.cs +++ b/e2e/Sandbox/MainWindow.xaml.cs @@ -1,9 +1,26 @@ using Reveal.Sdk; using Reveal.Sdk.Data; +using Reveal.Sdk.Data.Amazon.Athena; +using Reveal.Sdk.Data.Amazon.Redshift; +using Reveal.Sdk.Data.Amazon.S3; +using Reveal.Sdk.Data.Box; +using Reveal.Sdk.Data.Dropbox; using Reveal.Sdk.Data.Excel; +using Reveal.Sdk.Data.Google.Analytics4; +using Reveal.Sdk.Data.Google.BigQuery; +using Reveal.Sdk.Data.Google.Drive; using Reveal.Sdk.Data.Json; +using Reveal.Sdk.Data.Microsoft.AnalysisServices; +using Reveal.Sdk.Data.Microsoft.OneDrive; using Reveal.Sdk.Data.Microsoft.SqlServer; +using Reveal.Sdk.Data.Microsoft.SynapseAnalytics; +using Reveal.Sdk.Data.MongoDB; +using Reveal.Sdk.Data.MySql; +using Reveal.Sdk.Data.OData; +using Reveal.Sdk.Data.Oracle; +using Reveal.Sdk.Data.PostgreSQL; using Reveal.Sdk.Data.Rest; +using Reveal.Sdk.Data.Snowflake; using Reveal.Sdk.Dom; using Reveal.Sdk.Dom.Data; using Reveal.Sdk.Dom.Visualizations; @@ -189,8 +206,8 @@ private async void Create_Dashboard(object sender, RoutedEventArgs e) //var document = HealthcareDashboard.CreateDashboard(); //var document = ManufacturingDashboard.CreateDashboard(); //var document = CustomDashboard.CreateDashboard(); - var document = RestDataSourceDashboards.CreateDashboard(); - //var document = SqlServerDataSourceDashboards.CreateDashboard(); + //var document = RestDataSourceDashboards.CreateDashboard(); + var document = SqlServerDataSourceDashboards.CreateDashboard(); //var document = DashboardLinkingDashboard.CreateDashboard(); var json = document.ToJsonString(); diff --git a/e2e/Sandbox/Sandbox.csproj b/e2e/Sandbox/Sandbox.csproj index dec7efb..198e33a 100644 --- a/e2e/Sandbox/Sandbox.csproj +++ b/e2e/Sandbox/Sandbox.csproj @@ -8,8 +8,23 @@ + + + + + + + + + + + + + + + diff --git a/src/Reveal.Sdk.Dom/Data/DataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSource.cs index 0544f8c..dbacee6 100644 --- a/src/Reveal.Sdk.Dom/Data/DataSource.cs +++ b/src/Reveal.Sdk.Dom/Data/DataSource.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Converters; using Reveal.Sdk.Dom.Core; using Reveal.Sdk.Dom.Core.Constants; +using Reveal.Sdk.Dom.Core.Extensions; using System; using System.Collections.Generic; @@ -32,6 +33,12 @@ public string Id public string Subtitle { get; set; } + public string DefaultRefreshRate + { + get => Properties.GetValue("DefaultRefreshRate"); + set => Properties.SetItem("DefaultRefreshRate", value); + } + [JsonProperty] internal Dictionary Properties { get; set; } diff --git a/src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSourceItem.cs b/src/Reveal.Sdk.Dom/Data/DataSourceItems/MicrosoftSqlServerDataSourceItem.cs similarity index 96% rename from src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSourceItem.cs rename to src/Reveal.Sdk.Dom/Data/DataSourceItems/MicrosoftSqlServerDataSourceItem.cs index 0c18af4..bcb32ef 100644 --- a/src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSourceItem.cs +++ b/src/Reveal.Sdk.Dom/Data/DataSourceItems/MicrosoftSqlServerDataSourceItem.cs @@ -28,6 +28,7 @@ public string Table protected override void InitializeDataSource(DataSource dataSource, string title) { + //todo: make generic and place in base class if (!(dataSource is MicrosoftSqlServerDataSource)) { var ds = MicrosoftSqlServerDataSource.Create(dataSource); diff --git a/src/Reveal.Sdk.Dom/Data/RestDataSourceItem.cs b/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs similarity index 98% rename from src/Reveal.Sdk.Dom/Data/RestDataSourceItem.cs rename to src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs index 9ff5f50..a9e9877 100644 --- a/src/Reveal.Sdk.Dom/Data/RestDataSourceItem.cs +++ b/src/Reveal.Sdk.Dom/Data/DataSourceItems/RestDataSourceItem.cs @@ -1,4 +1,5 @@ -using Reveal.Sdk.Dom.Core.Constants; +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Constants; using Reveal.Sdk.Dom.Core.Extensions; using Reveal.Sdk.Dom.Visualizations; using System.Collections.Generic; @@ -32,12 +33,14 @@ public RestDataSourceItem(string title, DataSource dataSource) : UpdateResourceItemDataSource(_dataSource); } + [JsonIgnore] public bool IsAnonymous { get { return ResourceItemDataSource.Properties.GetValue("_rpUseAnonymousAuthentication"); } set { ResourceItemDataSource.Properties.SetItem("_rpUseAnonymousAuthentication", value); } } + [JsonIgnore] public string Uri { get { return ResourceItem.Properties.GetValue("Url"); } diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/AmazonAthenaDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonAthenaDataSource.cs new file mode 100644 index 0000000..39ec155 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonAthenaDataSource.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class AmazonAthenaDataSource : DatabaseSource + { + public AmazonAthenaDataSource() + { + Provider = DataSourceProvider.AmazonAthena; + } + + [JsonIgnore] + public string DataCatalog { get; set; } + + [JsonIgnore] + public string OutputLocation { get; set; } + + [JsonIgnore] + public string Region { get; set; } + + [JsonIgnore] + public string Workgroup { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/AmazonRedshiftDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonRedshiftDataSource.cs new file mode 100644 index 0000000..b9c227c --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonRedshiftDataSource.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + internal class AmazonRedshiftDataSource : HostDatabaseSource + { + public AmazonRedshiftDataSource() + { + Provider = DataSourceProvider.AmazonRedshift; + } + + [JsonIgnore] + public string Schema + { + get => Properties.GetValue("Schema"); + set => Properties.SetItem("Schema", value); + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/AmazonS3DataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonS3DataSource.cs new file mode 100644 index 0000000..f0ada2b --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/AmazonS3DataSource.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class AmazonS3DataSource : DataSource + { + public AmazonS3DataSource() + { + Provider = DataSourceProvider.AmazonS3; + } + + [JsonIgnore] + public string AccountId { get; set; } + + [JsonIgnore] + public string Region { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/BoxDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/BoxDataSource.cs new file mode 100644 index 0000000..5a838d0 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/BoxDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class BoxDataSource : DataSource + { + public BoxDataSource() + { + Provider = DataSourceProvider.Box; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/DropboxDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/DropboxDataSource.cs new file mode 100644 index 0000000..0f1cadb --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/DropboxDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class DropboxDataSource : DataSource + { + public DropboxDataSource() + { + Provider = DataSourceProvider.Dropbox; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/GoogleAnalytics4DataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleAnalytics4DataSource.cs new file mode 100644 index 0000000..b7afb01 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleAnalytics4DataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class GoogleAnalytics4DataSource : DataSource + { + public GoogleAnalytics4DataSource() + { + Provider = DataSourceProvider.GoogleAnalytics4; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/GoogleBigQueryDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleBigQueryDataSource.cs new file mode 100644 index 0000000..594116f --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleBigQueryDataSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class GoogleBigQueryDataSource : DatabaseSource + { + public GoogleBigQueryDataSource() + { + Provider = DataSourceProvider.GoogleBigQuery; + } + + [JsonIgnore] + public string ProjectId { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/GoogleDriveDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleDriveDataSource.cs new file mode 100644 index 0000000..8454088 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleDriveDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class GoogleDriveDataSource : DataSource + { + public GoogleDriveDataSource() + { + Provider = DataSourceProvider.GoogleDrive; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/GoogleSheetsDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleSheetsDataSource.cs new file mode 100644 index 0000000..4a88e5d --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/GoogleSheetsDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class GoogleSheetsDataSource : DataSource + { + public GoogleSheetsDataSource() + { + Provider = DataSourceProvider.GoogleSheets; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAnalysisServicesDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAnalysisServicesDataSource.cs new file mode 100644 index 0000000..994e735 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAnalysisServicesDataSource.cs @@ -0,0 +1,21 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftAnalysisServicesDataSource : DataSource + { + public MicrosoftAnalysisServicesDataSource() + { + Provider = DataSourceProvider.MicrosoftAnalysisServices; + } + + [JsonIgnore] + public string Catalog { get; set; } + + [JsonIgnore] + public string Host { get; set; } + + [JsonIgnore] + public int Port { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureAnalysisServicesDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureAnalysisServicesDataSource.cs new file mode 100644 index 0000000..90c92cf --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureAnalysisServicesDataSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftAzureAnalysisServicesDataSource : MicrosoftAnalysisServicesDataSource + { + public MicrosoftAzureAnalysisServicesDataSource() + { + Provider = DataSourceProvider.MicrosoftAzureAnalysisServices; + } + + [JsonIgnore] + public string ServerUrl { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSqlServerDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSqlServerDataSource.cs new file mode 100644 index 0000000..96c062c --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSqlServerDataSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftAzureSqlServerDataSource : MicrosoftSqlServerDataSource + { + public MicrosoftAzureSqlServerDataSource() + { + Provider = DataSourceProvider.MicrosoftAzureSqlServer; + } + + [JsonIgnore] + public bool TrustServerCertificate { get; set; } //todo: implement + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSynapseAnalyticsDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSynapseAnalyticsDataSource.cs new file mode 100644 index 0000000..12ee17b --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftAzureSynapseAnalyticsDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftAzureSynapseAnalyticsDataSource : MicrosoftAzureSqlServerDataSource + { + public MicrosoftAzureSynapseAnalyticsDataSource() + { + Provider = DataSourceProvider.MicrosoftAzureSynapseAnalytics; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftOneDriveDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftOneDriveDataSource.cs new file mode 100644 index 0000000..49d0393 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftOneDriveDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftOneDriveDataSource : DataSource + { + public MicrosoftOneDriveDataSource() + { + Provider = DataSourceProvider.MicrosoftOneDrive; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSharePointDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSharePointDataSource.cs new file mode 100644 index 0000000..4a654da --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSharePointDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class MicrosoftSharePointDataSource : DataSource + { + public MicrosoftSharePointDataSource() + { + Provider = DataSourceProvider.MicrosoftSharePoint; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSqlServerDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSqlServerDataSource.cs new file mode 100644 index 0000000..530dd1c --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftSqlServerDataSource.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + public class MicrosoftSqlServerDataSource : SchemaDatabaseSource + { + public MicrosoftSqlServerDataSource() + { + Provider = DataSourceProvider.MicrosoftSqlServer; + } + + [JsonIgnore] + public bool Encrypt + { + get => Properties.GetValue("Encrypt"); + set => Properties.SetItem("Encrypt", value); + } + + internal static MicrosoftSqlServerDataSource Create(DataSource dataSource) + { + return new MicrosoftSqlServerDataSource() + { + Id = dataSource.Id, + Title = dataSource.Title, + Subtitle = dataSource.Subtitle, + }; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MongoDBDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MongoDBDataSource.cs new file mode 100644 index 0000000..c9e31ba --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MongoDBDataSource.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + internal class MongoDBDataSource : DatabaseSource + { + public MongoDBDataSource() + { + Provider = DataSourceProvider.MongoDB; + } + + [JsonIgnore] + public string ConnectionString { get; set; } + + [JsonIgnore] + public bool ProcessDataOnServerDefaultValue + { + get => Properties.GetValue("ServerAggregationDefault"); + set => Properties.SetItem("ServerAggregationDefault", value); + } + + [JsonIgnore] + public bool ProcessDataOnServerReadOnly + { + get => Properties.GetValue("ServerAggregationReadOnly"); + set => Properties.SetItem("ServerAggregationReadOnly", value); + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/MySQLDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/MySQLDataSource.cs new file mode 100644 index 0000000..cf4992d --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/MySQLDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class MySQLDataSource : ProcessDataDatabaseSource + { + public MySQLDataSource() + { + Provider = DataSourceProvider.MySQL; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/ODataDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/ODataDataSource.cs new file mode 100644 index 0000000..8f2bb20 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/ODataDataSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class ODataDataSource : WebServiceDataSource + { + public ODataDataSource() + { + Provider = DataSourceProvider.OData; + } + + [JsonIgnore] + public bool UsePreemptiveAuthentication { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/OracleDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/OracleDataSource.cs new file mode 100644 index 0000000..b80b7b4 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/OracleDataSource.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class OracleDataSource : HostDatabaseSource + { + public OracleDataSource() + { + Provider = DataSourceProvider.Oracle; + } + + [JsonIgnore] + public string Service { get; set; } //todo: should this be two separate objects? + + [JsonIgnore] + public string SID { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/PostgreSQLDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/PostgreSQLDataSource.cs new file mode 100644 index 0000000..6beea99 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/PostgreSQLDataSource.cs @@ -0,0 +1,10 @@ +namespace Reveal.Sdk.Dom.Data +{ + internal class PostgreSQLDataSource : SchemaDatabaseSource + { + public PostgreSQLDataSource() + { + Provider = DataSourceProvider.PostgreSQL; + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/RestDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/RestDataSource.cs new file mode 100644 index 0000000..d93c2c4 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/RestDataSource.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Reveal.Sdk.Dom.Data +{ + //todo: not sure this will ever be needed. a rest DS can only point to one URL and it doesn't really make sense to have a rest DS + //when everything can be done in the rest DS item. This might be needed to simplify the creation of the REST DS item, so to copy properties + //to different DS/DSI schema properties + internal class RestDataSource : ODataDataSource + { + public RestDataSource() + { + Provider = DataSourceProvider.REST; + } + + [JsonIgnore] + public string Body { get; set; } + + [JsonIgnore] + public string ContentType { get; set; } + + [JsonIgnore] + public List Headers { get; set; } + + [JsonIgnore] + public string Method { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/SnowflakeDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/SnowflakeDataSource.cs new file mode 100644 index 0000000..8200236 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/SnowflakeDataSource.cs @@ -0,0 +1,21 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class SnowflakeDataSource : ProcessDataDatabaseSource + { + public SnowflakeDataSource() + { + Provider = DataSourceProvider.Snowflake; + } + + [JsonIgnore] + public string Account { get; set; } + + [JsonIgnore] + public string Role { get; set; } + + [JsonIgnore] + public string Warehouse { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DataSources/WebServiceDataSource.cs b/src/Reveal.Sdk.Dom/Data/DataSources/WebServiceDataSource.cs new file mode 100644 index 0000000..7ed4160 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DataSources/WebServiceDataSource.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Reveal.Sdk.Dom.Data +{ + internal class WebServiceDataSource : DataSource + { + public WebServiceDataSource() + { + Provider = DataSourceProvider.WebService; + } + + [JsonIgnore] + public string URL { get; set; } + + [JsonIgnore] + public bool UseAnonymousAuthentication { get; set; } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/DatabaseSource.cs b/src/Reveal.Sdk.Dom/Data/DatabaseSource.cs new file mode 100644 index 0000000..b21c43a --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/DatabaseSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + public abstract class DatabaseSource : DataSource + { + [JsonIgnore] + public string Database + { + get => Properties.GetValue("Database"); + set => Properties.SetItem("Database", value); + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/Enums/DataSourceProvider.cs b/src/Reveal.Sdk.Dom/Data/Enums/DataSourceProvider.cs index 97190fa..a1c468b 100644 --- a/src/Reveal.Sdk.Dom/Data/Enums/DataSourceProvider.cs +++ b/src/Reveal.Sdk.Dom/Data/Enums/DataSourceProvider.cs @@ -23,7 +23,7 @@ public enum DataSourceProvider CSV, [EnumMember(Value = "DROPBOXPROVIDER")] - DropBox, + Dropbox, [EnumMember(Value = "GOOGLE_ANALYTICS")] GoogleAnalytics, @@ -52,6 +52,9 @@ public enum DataSourceProvider [EnumMember(Value = "LOCALFILE")] LocalFile, + [EnumMember(Value = "MONGODB")] + MongoDB, + [EnumMember(Value = "REST")] REST, @@ -79,6 +82,9 @@ public enum DataSourceProvider [EnumMember(Value = "ONEDRIVEPROVIDER")] MicrosoftOneDrive, + [EnumMember(Value = "SHAREPOINT")] + MicrosoftSharePoint, + [EnumMember(Value = "SQLSERVER")] MicrosoftSqlServer, @@ -86,7 +92,7 @@ public enum DataSourceProvider MicrosoftSqlServerReportingServices, [EnumMember(Value = "MYSQL")] - MySql, + MySQL, [EnumMember(Value = "ODATAPROVIDER")] OData, @@ -95,7 +101,7 @@ public enum DataSourceProvider Oracle, [EnumMember(Value = "POSTGRES")] - PostgreSql, + PostgreSQL, [EnumMember(Value = "QUICK_BOOKS")] QuickBooks, @@ -106,9 +112,6 @@ public enum DataSourceProvider [EnumMember(Value = "SALESFORCE")] Salesforce, - [EnumMember(Value = "SHAREPOINT")] - SharePoint, - [EnumMember(Value = "SNOWFLAKE")] Snowflake, diff --git a/src/Reveal.Sdk.Dom/Data/HostDatabaseSource.cs b/src/Reveal.Sdk.Dom/Data/HostDatabaseSource.cs new file mode 100644 index 0000000..930590c --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/HostDatabaseSource.cs @@ -0,0 +1,22 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + public class HostDatabaseSource : DatabaseSource + { + [JsonIgnore] + public string Host + { + get => Properties.GetValue("Host"); + set => Properties.SetItem("Host", value); + } + + [JsonIgnore] + public string Port + { + get => Properties.GetValue("Port"); + set => Properties.SetItem("Port", value); + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSource.cs b/src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSource.cs deleted file mode 100644 index 42e9e6a..0000000 --- a/src/Reveal.Sdk.Dom/Data/MicrosoftSqlServerDataSource.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Newtonsoft.Json; -using Reveal.Sdk.Dom.Core.Extensions; - -namespace Reveal.Sdk.Dom.Data -{ - public class MicrosoftSqlServerDataSource : DataSource - { - public MicrosoftSqlServerDataSource() - { - Provider = DataSourceProvider.MicrosoftSqlServer; - Properties.SetItem("ServerAggregationDefault", true); - Properties.SetItem("ServerAggregationReadOnly", false); - } - - [JsonIgnore] - public string Database - { - get => Properties.GetValue("Database"); - set => Properties.SetItem("Database", value); - } - - [JsonIgnore] - public string Host - { - get => Properties.GetValue("Host"); - set => Properties.SetItem("Host", value); - } - - [JsonIgnore] - public string Port - { - get => Properties.GetValue("Port"); - set => Properties.SetItem("Port", value); - } - - [JsonIgnore] - public string Schema - { - get => Properties.GetValue("Schema"); - set => Properties.SetItem("Schema", value); - } - - internal static MicrosoftSqlServerDataSource Create(DataSource dataSource) - { - return new MicrosoftSqlServerDataSource() - { - Id = dataSource.Id, - Title = dataSource.Title, - Subtitle = dataSource.Subtitle, - }; - } - } -} diff --git a/src/Reveal.Sdk.Dom/Data/ProcessDataDatabaseSource.cs b/src/Reveal.Sdk.Dom/Data/ProcessDataDatabaseSource.cs new file mode 100644 index 0000000..aaec5ce --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/ProcessDataDatabaseSource.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + public abstract class ProcessDataDatabaseSource : HostDatabaseSource + { + protected ProcessDataDatabaseSource() + { + ProcessDataOnServerDefaultValue = true; + ProcessDataOnServerReadOnly = false; + } + + [JsonIgnore] + public bool ProcessDataOnServerDefaultValue + { + get => Properties.GetValue("ServerAggregationDefault"); + set => Properties.SetItem("ServerAggregationDefault", value); + } + + [JsonIgnore] + public bool ProcessDataOnServerReadOnly + { + get => Properties.GetValue("ServerAggregationReadOnly"); + set => Properties.SetItem("ServerAggregationReadOnly", value); + } + } +} diff --git a/src/Reveal.Sdk.Dom/Data/SchemaDatabaseSource.cs b/src/Reveal.Sdk.Dom/Data/SchemaDatabaseSource.cs new file mode 100644 index 0000000..3144c7d --- /dev/null +++ b/src/Reveal.Sdk.Dom/Data/SchemaDatabaseSource.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Extensions; + +namespace Reveal.Sdk.Dom.Data +{ + public class SchemaDatabaseSource : ProcessDataDatabaseSource + { + [JsonIgnore] + public string Schema + { + get => Properties.GetValue("Schema"); + set => Properties.SetItem("Schema", value); + } + } +}