Skip to content

Commit

Permalink
Adjusted namespaces from Umbraco10 to Umbraco
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperweber committed May 4, 2023
1 parent e9d718a commit 8314c58
Show file tree
Hide file tree
Showing 67 changed files with 118 additions and 118 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The migrator is software that should be considered as the layer between the outp

## Digging a bit deeper
The migrator solution consists of two layers. The __`Enterspeed.Migrator`__ layer is the generic layer that calls the Enterspeed API and turns the response into usable structured data in .NET objects.
This response is then used by the CMS-specific converter. In this example, we are showing the __`Umbraco10.Migrator`__ project. This layer interprets the objects we receive from the generic layer and converts them into Umbraco-specific types and saves them in the target CMS system.
This response is then used by the CMS-specific converter. In this example, we are showing the __`Umbraco.Migrator`__ project. This layer interprets the objects we receive from the generic layer and converts them into Umbraco-specific types and saves them in the target CMS system.

![migrator-solution](/assets/images/migrator-solution_cmeg05yrn.png)

Expand Down Expand Up @@ -97,17 +97,17 @@ So now we have a clean set of data, with all its unique schemas that we can work

### CMS-specific data converter
We have built an Umbraco 10 specific converter, that converts the output of the generic migrator to Umbraco data.
The __[DocumentTypeBuilder](/src/Migrators/Umbraco10/Umbraco10.Migrator/DocumentTypes/DocumentTypeBuilder.cs)__ receives the schemas from the generic migrator and interprets the different schemas and saves them as document types, elements, and compositions in Umbraco. Properties are all interpreted and added to before mentioned types of data in Umbraco.
The __[DocumentTypeBuilder](/src/Migrators/Umbraco/Umbraco.Migrator/DocumentTypes/DocumentTypeBuilder.cs)__ receives the schemas from the generic migrator and interprets the different schemas and saves them as document types, elements, and compositions in Umbraco. Properties are all interpreted and added to before mentioned types of data in Umbraco.

The simple types are managed through a switch statement, that converts these to the equivalent in Umbraco.
For the complex types, we have set up a component builder handler, that requires you to create your builders. This is for scenarios where you want to convert for example grid components to element types used in a blocklist or nested content.
There are quite a few samples __[here](/src/Migrators/Umbraco10/Umbraco10.Migrator/DocumentTypes/Components/Builders/)__.
There are quite a few samples __[here](/src/Migrators/Umbraco/Umbraco.Migrator/DocumentTypes/Components/Builders/)__.

You define an alias in the component builder and when the converter hits an alias with that specific value, your custom component builder will get executed.


## Getting started moving data into Umbraco 10
You need to pull down the source code and reference your Umbraco 10 project to the `Umbraco10.Migrator.Package` project. This should give you the required references to get started. Still pretty early, so no official package has been created for this project.
## Getting started moving data into Umbraco 10+
You need to pull down the source code and reference your Umbraco project to the `Umbraco.Migrator.Package` project. This should give you the required references to get started. Still pretty early, so no official package has been created for this project.

#### App settings
For the migrator to work, we need to specify a few settings in the target CMS (in this case Umbraco 10).
Expand Down
8 changes: 4 additions & 4 deletions src/Enterspeed.Migrator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Enterspeed", "Enterspeed",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enterspeed.Migrator", "Enterspeed\Enterspeed.Migrator\Enterspeed.Migrator.csproj", "{6CCFA69E-5504-4AEA-AC18-377189D013B9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umbraco10", "Umbraco10", "{62FA3D31-F42F-48AC-B786-2741232C5E87}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umbraco", "Umbraco", "{62FA3D31-F42F-48AC-B786-2741232C5E87}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestSites", "TestSites", "{A35C69F8-C5B4-4689-A10F-892041DAF8CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco10.TestSite", "Migrators\Umbraco10\TestSites\Umbraco10.TestSite\Umbraco10.TestSite.csproj", "{6846697E-7F0C-4F6A-A731-751B129C305C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco10.TestSite", "Migrators\Umbraco\TestSites\Umbraco10.TestSite\Umbraco10.TestSite.csproj", "{6846697E-7F0C-4F6A-A731-751B129C305C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco10.Migrator", "Migrators\Umbraco10\Umbraco10.Migrator\Umbraco10.Migrator.csproj", "{FDE1485E-83E4-4F6D-AF28-1FCAE4127205}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Migrator", "Migrators\Umbraco\Umbraco.Migrator\Umbraco.Migrator.csproj", "{FDE1485E-83E4-4F6D-AF28-1FCAE4127205}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco10.Migrator.Package", "Migrators\Umbraco10\Umbraco10.Migrator.Package\Umbraco10.Migrator.Package.csproj", "{E402B117-7965-4AC7-BF9C-E62E08289673}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Migrator.Package", "Migrators\Umbraco\Umbraco.Migrator.Package\Umbraco.Migrator.Package.csproj", "{E402B117-7965-4AC7-BF9C-E62E08289673}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
28 changes: 16 additions & 12 deletions src/Enterspeed/Enterspeed.Migrator/Enterspeed/PagesResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,23 @@ private void CreateArrayType(PageData pageData, JsonProperty jsonProperty, Enter
var arrayOfElements = jsonProperty.Value.EnumerateArray();
foreach (var element in arrayOfElements)
{
var objectOfElement = element.EnumerateObject();
var newArrayItem = new EnterspeedPropertyType()
// TODO Do support other types than object, like array of string or numbers
if (element.ValueKind == JsonValueKind.Object)
{
Name = "arrayObject",
Alias = "arrayObject",
Type = JsonValueKind.Object,
Value = objectOfElement
};

// Add arrayitem directly to array property
currentProperty.ChildProperties.Add(newArrayItem);

MapData(pageData, element, newArrayItem);
var objectOfElement = element.EnumerateObject();
var newArrayItem = new EnterspeedPropertyType()
{
Name = "arrayObject",
Alias = "arrayObject",
Type = JsonValueKind.Object,
Value = objectOfElement
};

// Add arrayitem directly to array property
currentProperty.ChildProperties.Add(newArrayItem);

MapData(pageData, element, newArrayItem);
}
}

// Ensure that we do not add nested properties to the root level of the properties for the page.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"javascript": [
"/App_Plugins/Umbraco.Migrator.Package/Dashboard/dashboard.controller.js",
"/App_Plugins/Umbraco.Migrator.Package/Dashboard/migrator.resource.js"
],
"css": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Umbraco10.Migrator.Package\Umbraco10.Migrator.Package.csproj" />
<ProjectReference Include="..\..\Umbraco.Migrator.Package\Umbraco.Migrator.Package.csproj" />
</ItemGroup>

<!-- Keep this as false if ModelsBuilder mode is InMemoryAuto -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"javascript": [
"/App_Plugins/Umbraco.Migrator.Package/Dashboard/dashboard.controller.js",
"/App_Plugins/Umbraco.Migrator.Package/Dashboard/migrator.resource.js"
],
"css": []
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Web.BackOffice.Controllers;

namespace Umbraco10.Migrator.Package.Controllers
namespace Umbraco.Migrator.Package.Controllers
{
public class MigratorController : UmbracoAuthorizedApiController
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Dashboards;

namespace Umbraco10.Migrator.Package
namespace Umbraco.Migrator.Package
{
public class EnterspeedMigratorDashboard : IDashboard
{
public string Alias => "EnterspeedMigrator";
public string View => "/App_Plugins/Umbraco10.Migrator.Package/dashboard/dashboard.html";
public string View => "/App_Plugins/Umbraco.Migrator.Package/dashboard/dashboard.html";

public string[] Sections => new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;

namespace Umbraco10.Migrator.Package
namespace Umbraco.Migrator.Package
{
public class PackageComposer : IComposer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<PackageTags>Enterspeed, Migration, Umbraco</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Umbraco10.Migrator\Umbraco10.Migrator.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.0" />
</ItemGroup>
Expand All @@ -32,6 +28,10 @@
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Umbraco.Migrator\Umbraco.Migrator.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="icon.png">
<Pack>True</Pack>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Migrators/Umbraco/Umbraco.Migrator.Package/paths.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"library": "../Umbraco.Migrator.Package",
"pluginFolder": "Umbraco.Migrator.Package",
"site": "../TestSites/Umbraco10.TestSite"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco10.Migrator.DataTypes;
using Umbraco10.Migrator.DocumentTypes.Components.Builders;
using Umbraco10.Migrator.Settings;
using Umbraco.Migrator.DataTypes;
using Umbraco.Migrator.DocumentTypes.Components.Builders;
using Umbraco.Migrator.Settings;

namespace Umbraco10.Migrator.Content
namespace Umbraco.Migrator.Content
{
public class ContentBuilder : IContentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Enterspeed.Migrator.Models;
using Umbraco.Cms.Core.Models;

namespace Umbraco10.Migrator.Content
namespace Umbraco.Migrator.Content
{
public interface IContentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Umbraco10.Migrator.DataTypes
namespace Umbraco.Migrator.DataTypes
{
public class Blocklist
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders
{
public abstract class ComponentBuilder : IComponentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Enterspeed.Migrator.ValueTypes;
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders

{
public class EmbedComponentBuilder : ComponentBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using Enterspeed.Migrator.Constants;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Infrastructure.Persistence;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders

{
public class HeadlineComponentBuilder : ComponentBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders
{
public interface IComponentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Enterspeed.Migrator.ValueTypes;
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders

{
public class MacroComponentBuilder : ComponentBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Enterspeed.Migrator.ValueTypes;
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders
{
public class MediaComponentBuilder : ComponentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Enterspeed.Migrator.ValueTypes;
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders
{
public class QuoteComponentBuilder : ComponentBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Enterspeed.Migrator.ValueTypes;
using System.Collections.Generic;
using Enterspeed.Migrator.ValueTypes;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;

namespace Umbraco10.Migrator.DocumentTypes.Components.Builders
namespace Umbraco.Migrator.DocumentTypes.Components.Builders

{
public class RTEComponentBuilder : ComponentBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
using Umbraco10.Migrator.DocumentTypes.Components.Builders;
using Umbraco.Migrator.DocumentTypes.Components.Builders;

namespace Umbraco10.Migrator.DocumentTypes.Components
namespace Umbraco.Migrator.DocumentTypes.Components
{
public class ComponentBuilderHandler : IComponentBuilderHandler
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Umbraco10.Migrator.DocumentTypes.Components
namespace Umbraco.Migrator.DocumentTypes.Components
{
public interface IComponentBuilderHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Strings;
using Umbraco.Extensions;
using Umbraco10.Migrator.DocumentTypes.Components;
using Umbraco10.Migrator.Extensions;
using Umbraco10.Migrator.Settings;
using Umbraco.Migrator.DocumentTypes.Components;
using Umbraco.Migrator.Extensions;
using Umbraco.Migrator.Settings;

namespace Umbraco10.Migrator.DocumentTypes
namespace Umbraco.Migrator.DocumentTypes
{
public class DocumentTypeBuilder : IDocumentTypeBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Enterspeed.Migrator.Models;

namespace Umbraco10.Migrator.DocumentTypes
namespace Umbraco.Migrator.DocumentTypes
{
public interface IDocumentTypeBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using Umbraco.Extensions;

namespace Umbraco10.Migrator.Extensions
namespace Umbraco.Migrator.Extensions
{
public static class StringExtensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace Umbraco10.Migrator
namespace Umbraco.Migrator
{
public interface IUmbracoMigratorService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Umbraco10.Migrator.Content;
using Umbraco10.Migrator.DocumentTypes;
using Umbraco10.Migrator.DocumentTypes.Components;
using Umbraco10.Migrator.DocumentTypes.Components.Builders;
using Umbraco10.Migrator.Settings;
using Umbraco.Migrator.Content;
using Umbraco.Migrator.DocumentTypes;
using Umbraco.Migrator.DocumentTypes.Components;
using Umbraco.Migrator.DocumentTypes.Components.Builders;
using Umbraco.Migrator.Settings;

namespace Umbraco10.Migrator
namespace Umbraco.Migrator
{
public static class IoC
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Umbraco10.Migrator.Settings
namespace Umbraco.Migrator.Settings
{
public class UmbracoMigrationConfiguration
{
Expand Down
Loading

0 comments on commit 8314c58

Please sign in to comment.