public ConnectionSet GetConnection(INode node, IRelationship relationship, ConnectionType connectionType) { if (Connections.ContainsKey(node)) { if (Connections[node].ContainsKey(relationship)) { if (Connections[node][relationship].ContainsKey(connectionType)) { return Connections[node][relationship][connectionType]; } } else { Connections[node][relationship] = new Dictionary<ConnectionType, ConnectionSet>(); } } else { Connections[node] = new Dictionary<IRelationship, Dictionary<ConnectionType, ConnectionSet>>(); Connections[node][relationship] = new Dictionary<ConnectionType, ConnectionSet>(); } ConnectionSet newConnectionSet = new ConnectionSet() { Node = node, Relationship = relationship, ConnectionType = connectionType }; Connections[node][relationship][connectionType] = newConnectionSet; return newConnectionSet; }
public bool LoadRelationship(SoapNodeManager nodeManager) { Metadata.Clear(); Proxy.INodeManager nodeSetManager = Nodes; nodeSetManager.Clear(); foreach (KeyValuePair <ServerObjects.MetadataContext, ServerObjects.Metadata> metadataPair in ServiceRelationship.Metadata) { if (metadataPair.Value.NodeUid.HasValue) { Proxy.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)) { Proxy.INode node; Proxy.ConnectionType connectionType = MapManager.ConnectionTypes[descriptorTypeId]; node = nodeManager.FindNode(nodeId); Proxy.ConnectionSet connectionSet = Proxy.ConnectionSetFactory.Instance.GetConnection(node, this, connectionType); if (node.Status != Proxy.LoadState.None) { Proxy.IRelationshipManager relationshipSetManager = node.Relationships; relationshipSetManager.Load(connectionSet); } nodeSetManager.Load(connectionSet); } } Status = Proxy.LoadState.Full; ProcessDelayedActions(); return(true); }
void INodeManager.Load(ConnectionSet connectionSet) { ConnectionSet setToUpdate = null; foreach (ConnectionSet set in Connections) { if (set.ConnectionType == connectionSet.ConnectionType) { setToUpdate = set; break; } } if (setToUpdate != null) { Connections.Remove(setToUpdate); } Connections.Add(connectionSet); }
void IRelationshipManager.Load(ConnectionSet connectionSet) { Connections.Add(connectionSet); }