forked from Sitecore/Media-Framework-Brightcove-Edition
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from codrod/v10.1
V10.1.2.0 Updates
- Loading branch information
Showing
393 changed files
with
9,722 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Brightcove.Core.Models | ||
{ | ||
/// <summary> | ||
/// Represents a video object from the Brightcove API | ||
/// For more information, see http://support.brightcove.com/en/video-cloud/docs/media-api-objects-reference#Video | ||
/// </summary> | ||
public class VideoVariant | ||
{ | ||
[JsonIgnore] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)] | ||
public string Language { get; set; } | ||
|
||
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)] | ||
public string Description { get; set; } | ||
|
||
[JsonProperty("long_description", NullValueHandling = NullValueHandling.Ignore)] | ||
public string LongDescription { get; set; } | ||
|
||
[JsonProperty("custom_fields", NullValueHandling = NullValueHandling.Ignore)] | ||
public IDictionary<string, string> CustomFields { get; set; } | ||
|
||
public VideoVariant ShallowCopy() | ||
{ | ||
return (VideoVariant)this.MemberwiseClone(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
Brightcove.DataExchangeFramework/Converters/UpdatePipelineStepConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using Brightcove.DataExchangeFramework.Settings; | ||
using Sitecore.Data; | ||
using Sitecore.Data.Items; | ||
using Sitecore.DataExchange.Attributes; | ||
using Sitecore.DataExchange.Converters.PipelineSteps; | ||
using Sitecore.DataExchange.DataAccess; | ||
using Sitecore.DataExchange.Models; | ||
using Sitecore.DataExchange.Plugins; | ||
using Sitecore.DataExchange.Providers.Sc.Converters.PipelineSteps; | ||
using Sitecore.DataExchange.Repositories; | ||
using Sitecore.Services.Core.Model; | ||
using System; | ||
|
||
namespace Brightcove.DataExchangeFramework.Converters | ||
{ | ||
[SupportedIds("{D79A5F5C-9A5E-4B1C-B884-8E3B97CACA2D}", "{F598D123-2FE9-45D3-99E2-3E4B5063190A}")] | ||
public class UpdatePipelineStepConverter : BasePipelineStepConverter | ||
{ | ||
public UpdatePipelineStepConverter(IItemModelRepository repository) : base(repository) { } | ||
|
||
protected override void AddPlugins(ItemModel source, PipelineStep pipelineStep) | ||
{ | ||
MappingSettings mappingSettings = new MappingSettings() | ||
{ | ||
ModelMappingSets = this.ConvertReferencesToModels<IMappingSet>(source, "ModelMappingSets"), | ||
VariantMappingSets = this.ConvertReferencesToModels<IMappingSet>(source, "VariantMappingSets"), | ||
SourceObjectLocation = this.GetGuidValue(source, "SourceObjectLocation"), | ||
TargetObjectLocation = this.GetGuidValue(source, "TargetObjectLocation") | ||
}; | ||
|
||
pipelineStep.AddPlugin<MappingSettings>(mappingSettings); | ||
|
||
BrightcoveEndpointSettings endpointSettings = new BrightcoveEndpointSettings() | ||
{ | ||
BrightcoveEndpoint = this.ConvertReferenceToModel<Endpoint>(source, "BrightcoveEndpoint"), | ||
SitecoreEndpoint = this.ConvertReferenceToModel<Endpoint>(source, "SitecoreEndpoint") | ||
}; | ||
|
||
pipelineStep.AddPlugin<BrightcoveEndpointSettings>(endpointSettings); | ||
|
||
Guid endpointId = this.GetGuidValue(source, "BrightcoveEndpoint"); | ||
|
||
if(endpointId == null) | ||
{ | ||
return; | ||
} | ||
|
||
ItemModel endpointModel = ItemModelRepository.Get(endpointId); | ||
|
||
if(endpointModel == null) | ||
{ | ||
return; | ||
} | ||
|
||
Guid accountItemId = this.GetGuidValue(endpointModel, "Account"); | ||
|
||
if(accountItemId == null) | ||
{ | ||
return; | ||
} | ||
|
||
Item accountItem = Sitecore.Context.ContentDatabase.GetItem(new ID(accountItemId)); | ||
|
||
if(accountItem == null) | ||
{ | ||
return; | ||
} | ||
|
||
WebApiSettings webApiSettings = new WebApiSettings(); | ||
|
||
if (accountItem != null) | ||
{ | ||
webApiSettings.AccountId = accountItem["AccountId"]; | ||
webApiSettings.ClientId = accountItem["ClientId"]; | ||
webApiSettings.ClientSecret = accountItem["ClientSecret"]; | ||
} | ||
|
||
endpointSettings.BrightcoveEndpoint.AddPlugin(webApiSettings); | ||
} | ||
} | ||
} |
Oops, something went wrong.