Skip to content

Commit

Permalink
support multiple mappings concatenation, remove sitecore reference fr…
Browse files Browse the repository at this point in the history
…om managers, use SharedAssemblyInfo.cs
  • Loading branch information
danlr committed Jan 21, 2017
1 parent 3aa809d commit f1f7929
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 66 deletions.
9 changes: 7 additions & 2 deletions GatherContent.Connector.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{2E80067B-A8EF-4EF2-BB43-B48E3EA15D9F}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -24,6 +24,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GatherContent.Connector.Web
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GatherContent.Connector.WebControllers", "src\GatherContent.Connector.WebControllers\GatherContent.Connector.WebControllers.csproj", "{59E5F602-4A8D-484C-8009-C6B01DAD10CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{86710B3E-B926-414B-8BEA-BE65773200EA}"
ProjectSection(SolutionItems) = preProject
src\SharedAssemblyInfo.cs = src\SharedAssemblyInfo.cs
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug 7|Any CPU = Debug 7|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Entities\Account.cs" />
<Compile Include="Entities\AccountEntity.cs" />
<Compile Include="Entities\Config.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.Entities")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.Entities")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,6 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Interfaces\IAccountsService.cs" />
<Compile Include="Interfaces\IItemsService.cs" />
<Compile Include="Interfaces\IService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.GatherContentService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.GatherContentService")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +30,3 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Interfaces\IAccountsRepository.cs" />
<Compile Include="Interfaces\IDropTreeRepository.cs" />
<Compile Include="Interfaces\IMediaRepository.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.IRepositories")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.IRepositories")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,6 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References 7.2\Sitecore\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Release 8.1'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Release 8.0'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References 8.0\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Release 7'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References 7.2\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Debug 8.1'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Debug 8.0'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References 8.0\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, processorArchitecture=MSIL" Condition="'$(Configuration)'=='Debug 7'">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References 7.2\Sitecore\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Caching" />
Expand All @@ -148,11 +124,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Enums\TryMapItemState.cs" />
<Compile Include="Interfaces\ICacheManager.cs" />
<Compile Include="Interfaces\IDropTreeManager.cs" />
<Compile Include="Interfaces\IImportManager.cs" />
<Compile Include="Interfaces\ILinkManager.cs" />
<Compile Include="Interfaces\ILogger.cs" />
<Compile Include="Interfaces\IManager.cs" />
<Compile Include="Interfaces\IMappingManager.cs" />
<Compile Include="Interfaces\IUpdateManager.cs" />
Expand Down
26 changes: 26 additions & 0 deletions src/GatherContent.Connector.Managers/Interfaces/ILogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;

namespace GatherContent.Connector.Managers.Interfaces
{
public interface ILogger
{
void Warn(string message, object sender);

void Error(string message, Exception exception);
}

internal class NullLogger : ILogger
{
public void Warn(string message, object sender)
{
Console.WriteLine("WARN: " + sender.GetType().FullName + " : " + message);
}

public void Error(string message, Exception exception)
{
Console.WriteLine("ERROR: " + message);
Console.WriteLine(exception.Message);
Console.WriteLine(exception.StackTrace);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using GatherContent.Connector.Managers.Interfaces;
using GatherContent.Connector.Managers.Models.Mapping;
using GatherContent.Connector.SitecoreRepositories.Repositories;
using Sitecore.Diagnostics;
//using Sitecore.Diagnostics;

namespace GatherContent.Connector.Managers.Managers
{
Expand All @@ -22,6 +22,7 @@ public class MappingManager : BaseManager, IMappingManager

protected IMappingRepository MappingRepository;
protected IItemsService ItemService;
protected readonly ILogger Log;
protected ITemplatesService TemplateService;
protected GCAccountSettings AccountSettings;

Expand All @@ -32,12 +33,14 @@ public MappingManager(
ITemplatesService templateService,
IItemsService itemService,
ICacheManager cacheManager,
ILogger logger,
GCAccountSettings accountSettings)
: base(accountsService, projectsService, templateService, cacheManager)
{
AccountSettings = accountSettings;
MappingRepository = mappingRepository;
ItemService = itemService;
Log = logger ?? new NullLogger();
TemplateService = templateService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
using GatherContent.Connector.Managers.Models.Mapping;
using GatherContent.Connector.Managers.Models.UpdateItems;
using GatherContent.Connector.Managers.Models.UpdateItems.New;
using Sitecore;
using Sitecore.Diagnostics;
using Constants = GatherContent.Connector.SitecoreRepositories.Repositories.Constants;

namespace GatherContent.Connector.Managers.Managers
Expand All @@ -30,6 +28,7 @@ public class UpdateManager : BaseManager, IUpdateManager
protected IMappingRepository MappingRepository;

protected IItemsService ItemsService;
protected readonly ILogger Log;

protected GCAccountSettings GcAccountSettings;

Expand All @@ -43,6 +42,7 @@ public class UpdateManager : BaseManager, IUpdateManager
/// <param name="projectsService"></param>
/// <param name="templateService"></param>
/// <param name="cacheManager"></param>
/// <param name="logger"></param>
/// <param name="gcAccountSettings"></param>
public UpdateManager(
IItemsRepository itemsRepository,
Expand All @@ -52,6 +52,7 @@ public UpdateManager(
IProjectsService projectsService,
ITemplatesService templateService,
ICacheManager cacheManager,
ILogger logger,
GCAccountSettings gcAccountSettings)
: base(accountsService, projectsService, templateService, cacheManager)
{
Expand All @@ -60,6 +61,7 @@ public UpdateManager(
MappingRepository = mappingRepository;

ItemsService = itemsService;
Log = logger ?? new NullLogger();

GcAccountSettings = gcAccountSettings;
}
Expand Down Expand Up @@ -461,7 +463,7 @@ public List<ItemResultModel> UpdateItems(string itemId, List<UpdateListIds> mode
var cmsSyncDateField = new CmsField
{
TemplateField = new CmsTemplateField { FieldName = "Last Sync Date" },
Value = DateUtil.ToIsoDate(DateTime.UtcNow)
Value = DateTime.UtcNow.ToString("yyyyMMddTHHmmss")
};

ItemsRepository.MapText(cmsItem, cmsSyncDateField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.Managers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.Managers")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,6 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Repositories\AccountsRepository.cs" />
<Compile Include="Repositories\BaseRepository.cs" />
<Compile Include="Repositories\Constants.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.SitecoreRepositories")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.SitecoreRepositories")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,6 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Controllers\BaseController.cs" />
<Compile Include="Controllers\DropTreeController.cs" />
<Compile Include="Controllers\ImportController.cs" />
Expand Down
18 changes: 17 additions & 1 deletion src/GatherContent.Connector.WebControllers/IoC/ServiceFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GatherContent.Connector.Entities;
using System;
using GatherContent.Connector.Entities;
using GatherContent.Connector.GatherContentService.Services;
using GatherContent.Connector.IRepositories.Interfaces;
using GatherContent.Connector.Managers.Interfaces;
Expand Down Expand Up @@ -65,6 +66,7 @@ public static IMappingManager MappingManager
new TemplatesService(Settings),
new ItemsService(Settings),
new CacheManager(),
new ScLogger(),
Settings
);
}
Expand Down Expand Up @@ -117,8 +119,22 @@ public static IUpdateManager UpdateManager
new ProjectsService(Settings),
new TemplatesService(Settings),
new CacheManager(),
new ScLogger(),
Settings);
}
}
}

public class ScLogger : ILogger
{
public void Warn(string message, object sender)
{
Sitecore.Diagnostics.Log.Warn(message, sender);
}

public void Error(string message, Exception exception)
{
Sitecore.Diagnostics.Log.Error(message, exception, this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
[assembly: AssemblyTitle("GatherContent.Connector.WebControllers1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatherContent.Connector.WebControllers1")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,6 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
<Content Include="sitecore modules\Shell\GatherContent\Import\Import.js" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Commands\ExpandRichTextLinksCommand.cs" />
<Compile Include="Commands\MultipleLocationsImportCommand.cs" />
<Compile Include="Commands\ImportCommand.cs" />
Expand All @@ -175,7 +178,7 @@
<Content Include="App_Config\Include\GatherContent.Connector.config">
<SubType>Designer</SubType>
</Content>
<Content Include="App_Config\Include\GatherContent.Connector.Repositories.config" />
<Content Include="App_Config\Include\GatherContent.Connector.Repositories.config" />
<Content Include="App_Config\Include\Unicorn.Configs.GatherContent.Connector.config" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit f1f7929

Please sign in to comment.