Пример #1
0
        public bool LoadRelationship(SoapNodeManager nodeManager)
        {
            Metadata.Clear();
            INodeManager nodeSetManager = Nodes;

            nodeSetManager.Clear();

            foreach (KeyValuePair <ServerObjects.MetadataContext, ServerObjects.Metadata> metadataPair in ServiceRelationship.Metadata)
            {
                if (metadataPair.Value.NodeUid.HasValue)
                {
                    INode node = nodeManager.FindNode(metadataPair.Value.NodeUid.Value);
                    Metadata.Load(metadataPair.Value, node);
                }
                else if (metadataPair.Value.RelationshipUid.HasValue)
                {
                    Metadata.Load(metadataPair.Value, null);
                }
            }

            foreach (KeyValuePair <Guid, Guid> relationship in ServiceRelationship.Nodes)
            {
                Guid descriptorTypeId = relationship.Key;
                Guid nodeId           = relationship.Value;

                // TODO: There needs to be a proper check for the ConnectionType that will perform an appropriate operation if none exists.
                if (MapManager.ConnectionTypes.ContainsKey(descriptorTypeId))
                {
                    INode          node;
                    ConnectionType connectionType = MapManager.ConnectionTypes[descriptorTypeId];

                    node = nodeManager.FindNode(nodeId);

                    ConnectionSet connectionSet = ConnectionSetFactory.Instance.GetConnection(node, this, connectionType);

                    if (node.Status != LoadState.None)
                    {
                        IRelationshipManager relationshipSetManager = node.Relationships;

                        relationshipSetManager.Load(connectionSet);
                    }

                    nodeSetManager.Load(connectionSet);
                }
            }

            Status = LoadState.Full;

            ProcessDelayedActions();

            return(true);
        }
Пример #2
0
        public bool LoadRelationship(SoapNodeManager nodeManager)
        {
            Metadata.Clear();
            INodeManager nodeSetManager = Nodes;
            nodeSetManager.Clear();

            foreach (KeyValuePair<ServerObjects.MetadataContext, ServerObjects.Metadata> metadataPair in ServiceRelationship.Metadata)
            {
                if (metadataPair.Value.NodeUid.HasValue)
                {
                    INode node = nodeManager.FindNode(metadataPair.Value.NodeUid.Value);
                    Metadata.Load(metadataPair.Value, node);
                }
                else if (metadataPair.Value.RelationshipUid.HasValue)
                {
                    Metadata.Load(metadataPair.Value, null);
                }
            }

            foreach (KeyValuePair<Guid, Guid> relationship in ServiceRelationship.Nodes)
            {
                Guid descriptorTypeId = relationship.Key;
                Guid nodeId = relationship.Value;

                // TODO: There needs to be a proper check for the ConnectionType that will perform an appropriate operation if none exists.
                if (MapManager.ConnectionTypes.ContainsKey(descriptorTypeId))
                {
                    INode node;
                    ConnectionType connectionType = MapManager.ConnectionTypes[descriptorTypeId];

                    node = nodeManager.FindNode(nodeId);

                    ConnectionSet connectionSet = ConnectionSetFactory.Instance.GetConnection(node, this, connectionType);

                    if (node.Status != LoadState.None)
                    {
                        IRelationshipManager relationshipSetManager = node.Relationships;

                        relationshipSetManager.Load(connectionSet);
                    }

                    nodeSetManager.Load(connectionSet);
                }
            }

            Status = LoadState.Full;

            ProcessDelayedActions();

            return true;
        }