示例#1
0
        private void InitializeSupportedDataObjects()
        {
            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockWell.Type));
            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockWellbore.Type));
            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockChannelSet.Type));
            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockChannel.Type));
            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockTrajectory.Type));

            SupportedDataObjects.AddSupportedDataObject(new EtpSupportedDataObject(MockPropertyKind.Type));
        }
示例#2
0
        private void RefreshFamilies()
        {
            CheckLocked();

            foreach (var dataspace in Dataspaces)
            {
                foreach (var family in dataspace.Families)
                {
                    family.SupportedObjectCount = SupportedDataObjects.Count(sdo => sdo.QualifiedType.MatchesFamilyAndVersion(family.Type));
                }
            }
        }
示例#3
0
        public IEnumerable <MockSupportedType> GetSupportedTypes(EtpVersion version, MockGraphContext context, bool includeEmptyTypes)
        {
            CheckLocked();

            var uri = context.Uri;

            if (!((version == EtpVersion.v11 && uri.IsEtp11) || (version == EtpVersion.v12 && uri.IsEtp12)))
            {
                yield break;
            }

            var dataspace = GetDataspace(uri);

            if (dataspace == null || context.IsSelfOnly)
            {
                yield break;
            }

            IEnumerable <IDataObjectType> primarySupportedTypes, secondarySupportedTypes = Enumerable.Empty <IDataObjectType>();
            IEnumerable <MockObject>      objects;

            if (uri.IsDataRootUri)
            {
                primarySupportedTypes = SupportedDataObjects.Select(sdo => sdo.QualifiedType);
                if (uri.IsFamilyVersionUri)
                {
                    primarySupportedTypes = primarySupportedTypes.FilterByFamilyAndVersion(uri.DataObjectType);
                }

                objects = dataspace.Objects.Values;
            }
            else
            {
                MockObject @object;
                if (!ObjectsByUri[version].TryGetValue(uri, out @object))
                {
                    yield break;
                }

                primarySupportedTypes   = @object.SupportedPrimarySourceAndTargetTypes(context);
                secondarySupportedTypes = @object.SupportedSecondarySourceAndTargetTypes(context);
                objects = @object.SourcesAndTargets(context);
            }

            foreach (var supportedType in primarySupportedTypes)
            {
                var count = objects.Count(o => o.DataObjectType.MatchesExact(supportedType));
                if (count > 0 || includeEmptyTypes)
                {
                    yield return new MockSupportedType {
                               Uri = uri.Append(supportedType), DataObjectType = supportedType, ObjectCount = count, IsPrimaryRelationship = true
                    }
                }
                ;
            }

            foreach (var supportedType in secondarySupportedTypes)
            {
                var count = objects.Count(o => o.DataObjectType.MatchesExact(supportedType));
                if (count > 0 || includeEmptyTypes)
                {
                    yield return new MockSupportedType {
                               Uri = uri.Append(supportedType), DataObjectType = supportedType, ObjectCount = count, IsPrimaryRelationship = false
                    }
                }
                ;
            }
        }
    }
}