Skip to content

Commit

Permalink
Merge pull request #1 from KayeeNL/feature/NugetPackages_Introduction
Browse files Browse the repository at this point in the history
Feature/nuget packages introduction
  • Loading branch information
KayeeNL authored Jun 23, 2020
2 parents f8de4cb + 4016007 commit 8642100
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 243 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<commands>
<command name="dataExchange:enableItem" type="Sitecore.DataExchange.Gutters.Commands.EnableItemCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:showEnable" type="Sitecore.DataExchange.Gutters.Commands.ShowEnableCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:pipelineBatchContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineBatchContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:cleanPipelineBatchSummary" type="Sitecore.DataExchange.Gutters.Commands.CleanPipelineBatchSummaryCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayPipelineSteps" type="Sitecore.DataExchange.Gutters.Commands.DisplayPipelineStepsCommand, Sitecore.DataExchange.Gutters" />

<command name="dataExchange:valueMappingContextMenu" type="Sitecore.DataExchange.Gutters.Commands.ValueMappingContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:referenceMenu" type="Sitecore.DataExchange.Gutters.Commands.ReferenceMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:goToReference" type="Sitecore.DataExchange.Gutters.Commands.GoToReferenceCommand, Sitecore.DataExchange.Gutters" />

<command name="dataExchange:pipelineStepContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineStepContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayRequired" type="Sitecore.DataExchange.Gutters.Commands.DisplayRequiredCommand, Sitecore.DataExchange.Gutters" />
</commands>
</sitecore>
<sitecore>
<commands>
<command name="dataExchange:enableItem" type="Sitecore.DataExchange.Gutters.Commands.EnableItemCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:showEnable" type="Sitecore.DataExchange.Gutters.Commands.ShowEnableCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:pipelineBatchContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineBatchContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:cleanPipelineBatchSummary" type="Sitecore.DataExchange.Gutters.Commands.CleanPipelineBatchSummaryCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayPipelineSteps" type="Sitecore.DataExchange.Gutters.Commands.DisplayPipelineStepsCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:valueMappingContextMenu" type="Sitecore.DataExchange.Gutters.Commands.ValueMappingContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:referenceMenu" type="Sitecore.DataExchange.Gutters.Commands.ReferenceMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:goToReference" type="Sitecore.DataExchange.Gutters.Commands.GoToReferenceCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:pipelineStepContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineStepContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayRequired" type="Sitecore.DataExchange.Gutters.Commands.DisplayRequiredCommand, Sitecore.DataExchange.Gutters" />
</commands>
</sitecore>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Data;
using Data.Items;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Web.UI.Sheer;
using System;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Framework.Commands;
using Sitecore.Web.UI.Sheer;

namespace Sitecore.DataExchange.Gutters.Commands
{
[Serializable]
public class CleanPipelineBatchSummaryCommand : Command
{
Expand All @@ -16,7 +16,7 @@ public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));
var item = context.Items[0];
if (item.TemplateID != this.PipelineBatchTemplateId)
if (item.TemplateID != PipelineBatchTemplateId)
{
SheerResponse.Alert("The context item is not Pipeline Batch.");
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System.Collections.Generic;
using System.Linq;
using Common;
using Data;
using Data.Items;
using localhost;
using Pipelines.GetLookupSourceItems;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Web.UI.Sheer;
using System.Collections.Generic;
using System.Linq;
using Sitecore.Data;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Framework.Commands;
using Sitecore.Web.UI.Sheer;

namespace Sitecore.DataExchange.Gutters.Commands
{
public class DisplayPipelineStepsCommand : Command
{
protected readonly ID PipelineBatchTemplateId = new ID("{075C4FBD-F54E-4E6D-BD54-D49BDA0913D8}");

public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));
var item = context.Items[0];
if (item.TemplateID != this.PipelineBatchTemplateId)
if (item.TemplateID != PipelineBatchTemplateId)
{
SheerResponse.Alert("The context item is not Pipeline Batch.");
return;
}

var db = item.Database;

var pipelines = this.GetPipelines(item);
var pipelines = GetPipelines(item);

var enumerable = pipelines as ID[] ?? pipelines.ToArray();
if (!enumerable.Any())
Expand All @@ -37,27 +36,23 @@ public override void Execute(CommandContext context)

var list = new List<ID>();

foreach (var pipeline in enumerable)
{
list.AddRange(this.GetSteps(pipeline, db));
}
foreach (var pipeline in enumerable) list.AddRange(GetSteps(pipeline, db));

string str = string.Empty;
var str = string.Empty;

int k = 0;
var k = 0;
foreach (var id in list)
{
++k;
str = str + k + ". " + db.GetItem(id).DisplayName + "\n";
}

Sitecore.Context.ClientPage.ClientResponse.Alert(str);

}

protected virtual IEnumerable<ID> GetPipelines(Item item)
{
var multilistField = (Sitecore.Data.Fields.MultilistField)item.Fields["Pipelines"];
var multilistField = (MultilistField) item.Fields["Pipelines"];

return multilistField == null ? Enumerable.Empty<ID>() : multilistField.TargetIDs;
}
Expand All @@ -71,11 +66,8 @@ protected virtual List<ID> GetSteps(ID pipelineId, Database database)
list.Add(item.ID);
if (!string.IsNullOrEmpty(item["Pipelines"]))
{
var pipelines = this.GetPipelines(item);
foreach (var pipeline in pipelines)
{
list.AddRange(this.GetSteps(pipeline, database));
}
var pipelines = GetPipelines(item);
foreach (var pipeline in pipelines) list.AddRange(GetSteps(pipeline, database));
}
}

Expand Down
42 changes: 21 additions & 21 deletions Sitecore.DataExchange.Gutters/Commands/DisplayRequiredCommand.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Attributes;
using Shell.Framework.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Sitecore.DataExchange.Attributes;
using Sitecore.Shell.Framework.Commands;

namespace Sitecore.DataExchange.Gutters.Commands
{
public class DisplayRequiredCommand : Command
{
public override void Execute(CommandContext context)
Expand All @@ -20,35 +20,35 @@ public override void Execute(CommandContext context)
Sitecore.Context.ClientPage.ClientResponse.Alert("No Required!");
return;
}

var requiredAttributes = type.GetCustomAttributes<BaseRequiredPluginsAttribute>(true);
var baseRequiredPluginsAttributes = requiredAttributes as BaseRequiredPluginsAttribute[] ?? requiredAttributes.ToArray();
if (!baseRequiredPluginsAttributes.Any())
{
Sitecore.Context.ClientPage.ClientResponse.Alert("No Required!");
return;
}

var groupBy = baseRequiredPluginsAttributes.GroupBy(a => a.GetType());

string str = string.Empty;
var str = string.Empty;

foreach (var groupRequired in groupBy)
{
int k = 0;
str = str + this.ProposeCategoryName(groupRequired.Key.Name) + "\n";
var k = 0;
str = str + ProposeCategoryName(groupRequired.Key.Name) + "\n";
var pluginList = groupRequired.Select(a => a.RequiredPlugins);
var pluginArray = pluginList as IEnumerable<Type>[] ?? pluginList.ToArray();
foreach (var plugins in pluginArray)
foreach (var plugin in plugins)
{
foreach (var plugin in plugins)
{
++k;
str = str + "\t" + k + ". " + plugin.Name + "\n";
}

++k;
str = $"{str}\t{k}. {plugin.Name}\n";
}

str = str + "\n";
str = $"{str}\n";
}

Sitecore.Context.ClientPage.ClientResponse.Alert(str);

//var pluginList = baseRequiredPluginsAttributes.Select(a => a.RequiredPlugins);
Expand Down Expand Up @@ -79,8 +79,8 @@ private string[] SplitCamelCase(string source)

protected virtual string ProposeCategoryName(string source)
{
var splitCamelCase = this.SplitCamelCase(source).ToList();
splitCamelCase.RemoveAt(splitCamelCase.Count-1);
var splitCamelCase = SplitCamelCase(source).ToList();
splitCamelCase.RemoveAt(splitCamelCase.Count - 1);
return string.Join(" ", splitCamelCase);
}
}
Expand Down
50 changes: 25 additions & 25 deletions Sitecore.DataExchange.Gutters/Commands/EnableItemCommand.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Data.Items;
using Diagnostics;
using Globalization;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Version = Data.Version;
using System;
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Globalization;
using Sitecore.Shell.Framework.Commands;
using Version = Sitecore.Data.Version;

[Serializable]
public class EnableItemCommand: Command
{
public override void Execute(CommandContext context)
namespace Sitecore.DataExchange.Gutters.Commands
{
[Serializable]
public class EnableItemCommand : Command
{
Assert.ArgumentNotNull(context, nameof(context));
string database = context.Parameters["database"];
string id = context.Parameters["id"];
string language = context.Parameters["language"];
string version = context.Parameters["version"];
public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));
var database = context.Parameters["database"];
var id = context.Parameters["id"];
var language = context.Parameters["language"];
var version = context.Parameters["version"];

var db = Sitecore.Configuration.Factory.GetDatabase(database);
var item = db.GetItem(id, Language.Parse(language), Version.Parse(version));
var db = Factory.GetDatabase(database);
var item = db.GetItem(id, Language.Parse(language), Version.Parse(version));

using (new EditContext(item))
{
item["Enabled"] = "1";
}
using (new EditContext(item))
{
item["Enabled"] = "1";
}
}
}
}
}
16 changes: 9 additions & 7 deletions Sitecore.DataExchange.Gutters/Commands/GoToReferenceCommand.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Shell.Framework.Commands;
using System;
using Sitecore.Shell.Framework;
using Sitecore.Shell.Framework.Commands;
using Sitecore.Text;

namespace Sitecore.DataExchange.Gutters.Commands
{
[Serializable]
public class GoToReferenceCommand : Command
{
public override void Execute(CommandContext context)
{
var item = context.Items[0];
string id = context.Parameters["id"];
var id = context.Parameters["id"];

//Sitecore.Context.ClientPage.ClientResponse.Timer(string.Format("item:load(id={0})", id), 100);
Sitecore.Text.UrlString parameters = new Sitecore.Text.UrlString();
var parameters = new UrlString();
parameters.Add("id", id);
parameters.Add("fo", id);
Sitecore.Shell.Framework.Windows.RunApplication("Content Editor", parameters.ToString());
Windows.RunApplication("Content Editor", parameters.ToString());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Data;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Web.UI.HtmlControls;
using Web.UI.Sheer;
using System;
using Sitecore.Diagnostics;
using Sitecore.Shell.Framework.Commands;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;

namespace Sitecore.DataExchange.Gutters.Commands
{
[Serializable]
public class PipelineBatchContextMenuCommand : Command
{
public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));

Menu menu = new Menu();
var menu = new Menu();
SheerResponse.DisableOutput();

menu.Add("Run it", "Office/32x32/elements_selection.png", "dataExchange:runPipelineBatchCommand");
menu.Add("Clean Summary", "Office/32x32/document_empty.png", "dataExchange:cleanPipelineBatchSummary");
menu.Add("Display Pipeline Steps", "office/32x32/elements.png", "dataExchange:displayPipelineSteps");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Data;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Web.UI.HtmlControls;
using Web.UI.Sheer;
using System;
using Sitecore.Diagnostics;
using Sitecore.Shell.Framework.Commands;
using Sitecore.Web.UI.HtmlControls;
using Sitecore.Web.UI.Sheer;

namespace Sitecore.DataExchange.Gutters.Commands
{
[Serializable]
public class PipelineStepContextMenuCommand : Command
{
public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));

Menu menu = new Menu();
var menu = new Menu();
SheerResponse.DisableOutput();

menu.Add("Display Required", "Applications/32x32/warning.png", "dataExchange:displayRequired");

SheerResponse.EnableOutput();
Expand Down
Loading

0 comments on commit 8642100

Please sign in to comment.