Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made RepositoriesIndexUpdate Obsolete and added logic in runjob to se… #43

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.0.18</Version>
<Version>10.5.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Dynamicweb Provider</Title>
<Description>Dynamicweb Provider</Description>
Expand All @@ -14,7 +14,7 @@
<Copyright>Copyright © 2023 Dynamicweb Software A/S</Copyright>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -23,8 +23,8 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.0.19" />
<PackageReference Include="Dynamicweb.Ecommerce" Version="10.0.9" />
<PackageReference Include="Dynamicweb.DataIntegration" Version="10.5.0" />
<PackageReference Include="Dynamicweb.Ecommerce" Version="10.5.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
22 changes: 12 additions & 10 deletions src/DynamicwebProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Dynamicweb.Logging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
Expand Down Expand Up @@ -189,7 +190,7 @@
[AddInParameter("Hide deactivated products"), AddInParameterEditor(typeof(YesNoParameterEditor), "Tooltip=When Deactivate missing products is ON, this option hides the deactivated products. If Delete incoming rows is ON, Hide deactivated products is skipped. If Deactivate missing products is OFF, Hide deactivated products is skipped"), AddInParameterGroup("Destination"), AddInParameterOrder(80)]
public bool HideDeactivatedProducts { get; set; }

[AddInParameter("Repositories index update"), AddInParameterEditor(typeof(DropDownParameterEditor), "multiple=true;none=true;Tooltip=Index update might affect on slower perfomance"), AddInParameterGroup("Destination"), AddInParameterOrder(80)]
[Obsolete("Use Job.RepositoriesIndexSettings")]
public string RepositoriesIndexUpdate { get; set; }

[Obsolete("Use the Job.ServiceCacheSettings.Services to clear wanted caches at the end of the job.")]
Expand Down Expand Up @@ -218,7 +219,7 @@
xmlTextWriter.WriteElementString("Shop", Shop);
xmlTextWriter.WriteElementString("DeleteProductsAndGroupForSpecificLanguage", DeleteProductsAndGroupForSpecificLanguage.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("DefaultLanguage", DefaultLanguage);
xmlTextWriter.WriteElementString("RepositoriesIndexUpdate", RepositoriesIndexUpdate);

Check warning on line 222 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 222 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
xmlTextWriter.WriteElementString("DiscardDuplicates", DiscardDuplicates.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("HideDeactivatedProducts", HideDeactivatedProducts.ToString(CultureInfo.CurrentCulture));
xmlTextWriter.WriteElementString("SkipFailingRows", SkipFailingRows.ToString(CultureInfo.CurrentCulture));
Expand Down Expand Up @@ -309,7 +310,7 @@
case "RepositoriesIndexUpdate":
if (node.HasChildNodes)
{
RepositoriesIndexUpdate = node.FirstChild.Value;

Check warning on line 313 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 313 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
break;
case "DiscardDuplicates":
Expand Down Expand Up @@ -372,7 +373,6 @@
UpdateSourceSettings(newProvider);
DeleteIncomingItems = newProvider.DeleteIncomingItems;
DeleteProductsAndGroupForSpecificLanguage = newProvider.DeleteProductsAndGroupForSpecificLanguage;
RepositoriesIndexUpdate = newProvider.RepositoriesIndexUpdate;
DiscardDuplicates = newProvider.DiscardDuplicates;
HideDeactivatedProducts = newProvider.HideDeactivatedProducts;
SkipFailingRows = newProvider.SkipFailingRows;
Expand Down Expand Up @@ -598,7 +598,7 @@

sqlTransaction.Commit();
AssortmentHandler?.RebuildAssortments();
UpdateProductIndex(job);
MoveRepositoriesIndexToJob(job);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -647,11 +647,18 @@
return true;
}

protected void UpdateProductIndex(Job job)
private void MoveRepositoriesIndexToJob(Job job)
{
if (!string.IsNullOrEmpty(RepositoriesIndexUpdate))

Check warning on line 652 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 652 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
{
UpdateIndexes(RepositoriesIndexUpdate.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList());
char[] separator = [','];
// if the provider already have RepositoriesIndexUpdate set, then we move them to the job, and set the add-in to string.empty
if (job.RepositoriesIndexSettings?.RepositoriesIndexes?.Count == 0)
{
job.RepositoriesIndexSettings = new RepositoriesIndexSettings(new Collection<string>([.. RepositoriesIndexUpdate.Split(separator, StringSplitOptions.RemoveEmptyEntries)]));

Check warning on line 658 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 658 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
}
RepositoriesIndexUpdate = string.Empty;

Check warning on line 660 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'

Check warning on line 660 in src/DynamicwebProvider.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

'DynamicwebProvider.RepositoriesIndexUpdate' is obsolete: 'Use Job.RepositoriesIndexSettings'
job.Save();
}
}

Expand Down Expand Up @@ -692,7 +699,6 @@
root.Add(CreateParameterNode(GetType(), "Shop", Shop));
root.Add(CreateParameterNode(GetType(), "Delete products/groups for languages included in input", DeleteProductsAndGroupForSpecificLanguage.ToString()));
root.Add(CreateParameterNode(GetType(), "Default Language", DefaultLanguage));
root.Add(CreateParameterNode(GetType(), "Repositories index update", RepositoriesIndexUpdate));
root.Add(CreateParameterNode(GetType(), "Discard duplicates", DiscardDuplicates.ToString()));
root.Add(CreateParameterNode(GetType(), "Hide deactivated products", HideDeactivatedProducts.ToString()));
root.Add(CreateParameterNode(GetType(), "Persist successful rows and skip failing rows", SkipFailingRows.ToString()));
Expand Down Expand Up @@ -785,10 +791,6 @@
options.Add(new("Full", "Full"));
options.Add(new("Partial", "Partial"));
}
else if (parameterName == "Repositories index update")
{
options = GetRepositoryIndexOptions().ToList();
}
else if (parameterName == "Default Language")
{
SqlCommand sqlLanguageCommand = new SqlCommand { Connection = Connection };
Expand Down
Loading