Beispiel #1
0
        public Task <bool> TryExtractRelationshipsAsync(IResourceAccessor mediaItemAccessor, IDictionary <Guid, IList <MediaItemAspect> > aspects, IList <IDictionary <Guid, IList <MediaItemAspect> > > extractedLinkedAspects)
        {
            string id;

            MockCore.ShowMediaAspects(aspects, MockCore.Library.GetManagedMediaItemAspectMetadata());
            if (MediaItemAspect.TryGetExternalAttribute(aspects, ExternalSource, ExternalType, out id) && ExternalId == id)
            {
                ServiceRegistration.Get <ILogger>().Debug("Matched {0} / {1} / {2} / {3} / {4}", Role, LinkedRole, ExternalSource, ExternalType, ExternalId);
                foreach (IDictionary <Guid, IList <MediaItemAspect> > data in Data)
                {
                    extractedLinkedAspects.Add(data);
                }
                return(Task.FromResult(true));
            }
            ServiceRegistration.Get <ILogger>().Debug("No match for {0} / {1} / {2} / {3} / {4}", Role, LinkedRole, ExternalSource, ExternalType, ExternalId);

            return(Task.FromResult(false));
        }
Beispiel #2
0
        public bool TryExtractRelationships(IDictionary <Guid, IList <MediaItemAspect> > aspects, bool importOnly, out IList <RelationshipItem> extractedLinkedAspects)
        {
            string id;

            MockCore.ShowMediaAspects(aspects, MockCore.Library.GetManagedMediaItemAspectMetadata());
            if (MediaItemAspect.TryGetExternalAttribute(aspects, ExternalSource, ExternalType, out id) && ExternalId == id)
            {
                ServiceRegistration.Get <ILogger>().Debug("Matched {0} / {1} / {2} / {3} / {4}", Role, LinkedRole, ExternalSource, ExternalType, ExternalId);
                extractedLinkedAspects = new List <RelationshipItem>();
                foreach (IDictionary <Guid, IList <MediaItemAspect> > data in Data)
                {
                    extractedLinkedAspects.Add(new RelationshipItem(data, Guid.Empty));
                }
                return(true);
            }
            ServiceRegistration.Get <ILogger>().Debug("No match for {0} / {1} / {2} / {3} / {4}", Role, LinkedRole, ExternalSource, ExternalType, ExternalId);

            extractedLinkedAspects = null;
            return(false);
        }