Skip to content

Commit

Permalink
V10.2.0.3 (#16)
Browse files Browse the repository at this point in the history
* Fixed broken DXF configuration content for labels/folders

* Add more error handling to the folder and labels property value readers

* Fix bug preventing new labels from being synced

* Remove automatic re-indexing from the videos/playlists pipeline

---------

Co-authored-by: Cody Rodgers <[email protected]>
  • Loading branch information
codrod and rdacrodgers authored Mar 31, 2023
1 parent c03f97b commit 52ff79f
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class GetPlayListsPipelineStepProcessor : BasePipelineStepWithWebApiEndpointProc
protected override void ProcessPipelineStep(PipelineStep pipelineStep = null, PipelineContext pipelineContext = null, ILogger logger = null)
{
base.ProcessPipelineStep(pipelineStep, pipelineContext, logger);

//We may need to refresh the search index before syncing
RefreshSearchIndex(pipelineStep);

service = new BrightcoveService(WebApiSettings.AccountId, WebApiSettings.ClientId, WebApiSettings.ClientSecret);

var data = this.GetIterableData(WebApiSettings, pipelineStep);
Expand All @@ -54,21 +50,5 @@ protected virtual IEnumerable<PlayList> GetIterableData(WebApiSettings settings,
}
}
}

private void RefreshSearchIndex(PipelineStep pipelineStep)
{
Item videosFolder = Sitecore.Data.Database.GetDatabase("master").GetItem(WebApiSettings.AccountItem.Paths.FullPath + "/Videos");

Logger.Debug($"Started refreshing the search index before syncing videos... (pipeline step: {pipelineStep.Name})");

var jobs = Sitecore.ContentSearch.Maintenance.IndexCustodian.RefreshTree((SitecoreIndexableItem)videosFolder);

foreach (var job in jobs)
{
job.Wait();
}

Logger.Debug($"Finished refreshing the search index (pipeline step: {pipelineStep.Name})");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ protected override void ProcessPipelineStep(PipelineStep pipelineStep = null, Pi
{
base.ProcessPipelineStep(pipelineStep, pipelineContext, logger);

//We may need to refresh the search index before syncing
RefreshSearchIndex(pipelineStep);

service = new BrightcoveService(WebApiSettings.AccountId, WebApiSettings.ClientId, WebApiSettings.ClientSecret);

var data = GetIterableData(pipelineStep);
Expand All @@ -56,23 +53,5 @@ protected virtual IEnumerable<Video> GetIterableData(PipelineStep pipelineStep)
}
}
}

private void RefreshSearchIndex(PipelineStep pipelineStep)
{
Item labelsFolder = Sitecore.Data.Database.GetDatabase("master").GetItem(WebApiSettings.AccountItem.Paths.FullPath + "/Labels");
Item foldersFolder = Sitecore.Data.Database.GetDatabase("master").GetItem(WebApiSettings.AccountItem.Paths.FullPath + "/Folders");

Logger.Debug($"Started refreshing the search index before syncing videos... (pipeline step: {pipelineStep.Name})");

var jobs = Sitecore.ContentSearch.Maintenance.IndexCustodian.RefreshTree((SitecoreIndexableItem)labelsFolder);
jobs.Concat(Sitecore.ContentSearch.Maintenance.IndexCustodian.RefreshTree((SitecoreIndexableItem)foldersFolder));

foreach (var job in jobs)
{
job.Wait();
}

Logger.Debug($"Finished refreshing the search index (pipeline step: {pipelineStep.Name})");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,9 @@ protected override void ProcessPipelineStep(PipelineStep pipelineStep = null, Pi
return;
}

DateTime lastSyncTime = DateTime.UtcNow;
DateField lastModifiedTime = item.Fields["__Updated"];
bool isNewLabel = string.IsNullOrWhiteSpace(item["LastSyncTime"]);
bool isNewLabel = !string.IsNullOrWhiteSpace(item["NewLabel"]);

if (!isNewLabel)
{
lastSyncTime = DateTime.Parse(item["LastSyncTime"]);
}

//If the brightcove item has been modified since the last sync (or is new) then send the updates to brightcove
//Unless the brightcove model has already been modified since the last sync (presumably outside of Sitecore)
if (isNewLabel || lastModifiedTime.DateTime > lastSyncTime)
if (isNewLabel)
{
Label updatedLabel = service.UpdateLabel(label);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public virtual ReadResult Read(object source, DataAccessContext context)
obj = null;
}

if(!wasValueRead || obj == null)
{
wasValueRead = true;
obj = "";
}

return new ReadResult(DateTime.UtcNow)
{
WasValueRead = wasValueRead,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public virtual ReadResult Read(object source, DataAccessContext context)
.Where(r => r.Path.Contains(accountPath) && r.TemplateId == labelTemplate && r.Label == label)
.FirstOrDefault();

string labelItemId = searchResult.ItemId.ToString();
string labelItemId = searchResult?.ItemId?.ToString();

if(labelItemId != null)
{
Expand All @@ -81,6 +81,12 @@ public virtual ReadResult Read(object source, DataAccessContext context)
obj = null;
}

if (!wasValueRead || obj == null)
{
wasValueRead = true;
obj = "";
}

return new ReadResult(DateTime.UtcNow)
{
WasValueRead = wasValueRead,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Parent: "9f623c7f-51f5-4091-8645-daad69627e67"
Template: "beec5e96-d7d6-4eb8-8472-e118c131340b"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Data Access/Value Accessor Sets/Providers/Brightcove/Video Model Properties/Folder Property
DB: master
SharedFields:
- ID: "2fd34e11-3d44-446b-8317-de171f9656e3"
Hint: PropertyName
Value: Folder
Languages:
- Language: en
Versions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Template: "a0737430-a34e-4034-8f98-e15fbcc6948c"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Data Access/Value Accessor Sets/Providers/Brightcove/Video Model Properties/Labels Property
DB: master
SharedFields:
- ID: "16b64a43-1c28-47cd-9b1e-de707cd7f9a9"
Hint: PropertyName
Value: Labels
- ID: "3c7f78cc-0c5c-4076-80ef-9a49fda5ff96"
Hint: ConverterType
Value: Brightcove.DataExchangeFramework.Converters.LabelsPropertyValueAccessorConverter, Brightcove.DataExchangeFramework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Template: "2aacdf56-8d6e-4e38-9e84-690561575946"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Pipelines/Subpipelines/Update Model Pipelines/Update Folder Models Pipeline/Resolve Folder Model
DB: master
SharedFields:
- ID: "76a70ea3-0001-40dc-9d69-418f80dd0b01"
Hint: AssetModelLocation
Value: "{EC64487D-E7E6-40B0-A86C-40C74B95E04E}"
- ID: "b7a4edcd-a81c-4b77-8c9d-3481ad3e10b1"
Hint: AssetItemLocation
Value: "{17DF1143-A38D-4C77-A933-E66B5ED21E9A}"
- ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
Hint: __Sortorder
Value: 100
Expand All @@ -19,3 +25,6 @@ Languages:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20220406T132500Z
- ID: "c2de7951-18eb-4b70-8af4-cc6082a5d12b"
Hint: EndpointFrom
Value: "{17DF1FC5-386D-4783-9CC6-A31ABFCF6A48}"
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ Template: "f71558cf-4314-4f88-9e36-b284372fb8f7"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Pipelines/Subpipelines/Update Model Pipelines/Update Folder Models Pipeline/Update Folder Model
DB: master
SharedFields:
- ID: "137634be-547d-4773-a6d8-f851ba47a346"
Hint: AssetModelLocation
Value: "{EC64487D-E7E6-40B0-A86C-40C74B95E04E}"
- ID: "506bad49-3da6-474c-acb5-7bcb509bfbd7"
Hint: Enabled
Type: Checkbox
Value: 1
- ID: "a2d0b651-7b83-4edc-b2f2-585219764079"
Hint: AssetItemLocation
Value: "{17DF1143-A38D-4C77-A933-E66B5ED21E9A}"
- ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
Hint: __Sortorder
Value: 200
Expand All @@ -20,6 +26,9 @@ Languages:
Versions:
- Version: 1
Fields:
- ID: "03bd4a56-4e60-488f-b176-6ceaf2069f22"
Hint: EndpointFrom
Value: "{17DF1FC5-386D-4783-9CC6-A31ABFCF6A48}"
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20220406T132500Z
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Template: "5b822f3f-d51a-48c8-88a8-ff38f8799f2c"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Pipelines/Subpipelines/Update Model Pipelines/Update Label Models Pipeline/Resolve Label Model
DB: master
SharedFields:
- ID: "19174e44-13f2-4c97-8e6c-ad909db4e29d"
Hint: AssetModelLocation
Value: "{EC64487D-E7E6-40B0-A86C-40C74B95E04E}"
- ID: "264d947f-bc3e-4769-ae24-1f256bf2cb61"
Hint: AssetItemLocation
Value: "{17DF1143-A38D-4C77-A933-E66B5ED21E9A}"
- ID: "f6d8a61c-2f84-4401-bd24-52d2068172bc"
Hint: __Originator
Value: "{8C35E043-E7C9-4446-AC1C-9C4E8D515075}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ Template: "a3b4449b-2acb-414c-a239-5d12a1473759"
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Pipelines/Subpipelines/Update Model Pipelines/Update Label Models Pipeline/Update Label Model
DB: master
SharedFields:
- ID: "1123c057-aebf-47c1-9494-c292ba59a41b"
Hint: AssetItemLocation
Value: "{17DF1143-A38D-4C77-A933-E66B5ED21E9A}"
- ID: "506bad49-3da6-474c-acb5-7bcb509bfbd7"
Hint: Enabled
Type: Checkbox
Value: 1
- ID: "8a95a576-fe84-4ec8-9845-c464499805e8"
Hint: AssetModelLocation
Value: "{EC64487D-E7E6-40B0-A86C-40C74B95E04E}"
- ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
Hint: __Sortorder
Value: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DB: master
SharedFields:
- ID: "1eb8ae32-e190-44a6-968d-ed904c794ebf"
Hint: Source
Value: "query:../../../../../../../Labels//*[@@templateid='{8B6A9EAD-4DE9-4C59-B8F5-F3FF40A64F12}']"
Value: "query:../../../../../../../Labels/*"
- ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
Hint: Type
Value: Multilist
Expand Down

0 comments on commit 52ff79f

Please sign in to comment.