Ejemplo n.º 1
0
 protected override void ProcessIdentifiableItems(IIdentifiable identifiable, IObjectNode collection, NodeIndex index)
 {
     if (propertyGraphDefinition.IsTargetItemObjectReference(collection, index, identifiable))
     {
         externalReferences.Add(identifiable);
         if (!externalReferenceAccessors.TryGetValue(identifiable, out var accessors))
         {
             externalReferenceAccessors.Add(identifiable, accessors = new List <NodeAccessor>());
         }
         accessors.Add(CurrentPath.GetAccessor());
     }
     else
     {
         internalReferences.Add(identifiable);
     }
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        protected override void VisitObjectNode([NotNull] IAssetObjectNode objectNode, int inNonIdentifiableType)
        {
            if (!objectNode.IsReference)
            {
                return;
            }

            foreach (var index in ((IAssetObjectNodeInternal)objectNode).Indices)
            {
                if (!propertyGraphDefinition.IsTargetItemObjectReference(objectNode, index, objectNode.Retrieve(index)))
                {
                    continue;
                }

                var itemPath = ConvertPath(CurrentPath, inNonIdentifiableType);
                if (CollectionItemIdHelper.HasCollectionItemIds(objectNode.Retrieve()))
                {
                    var itemId = objectNode.IndexToId(index);
                    itemPath.PushItemId(itemId);
                }
                else
                {
                    itemPath.PushIndex(index.Value);
                }
                var value = objectNode.Retrieve(index) as IIdentifiable;
                if (value == null)
                {
                    throw new InvalidOperationException("IsObjectReference returned true for an object that is not IIdentifiable");
                }
                var id = value.Id;
                if (ShouldOutputReference?.Invoke(id) ?? true)
                {
                    Result.Set(itemPath, id);
                }
            }
        }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 protected override bool ShouldVisitTargetItem(IObjectNode collectionNode, NodeIndex index)
 {
     return(base.ShouldVisitTargetItem(collectionNode, index) && !PropertyGraphDefinition.IsTargetItemObjectReference(collectionNode, index, collectionNode.Retrieve(index)));
 }