private void AddDescriptorByRelationship(QueryMapDescriptor descriptor) { if (descriptor.RelationshipUid.HasValue) { Dictionary <Guid, List <QueryMapDescriptor> > descriptorsForRelationshipByDescriptorType; if (DescriptorsByRelationship.ContainsKey(descriptor.RelationshipUid.Value)) { descriptorsForRelationshipByDescriptorType = DescriptorsByRelationship[descriptor.RelationshipUid.Value]; } else { descriptorsForRelationshipByDescriptorType = new Dictionary <Guid, List <QueryMapDescriptor> >(); DescriptorsByRelationship[descriptor.RelationshipUid.Value] = descriptorsForRelationshipByDescriptorType; } List <QueryMapDescriptor> descriptorsForRelationship; if (descriptorsForRelationshipByDescriptorType.ContainsKey(descriptor.DescriptorTypeUid.Value)) { descriptorsForRelationship = descriptorsForRelationshipByDescriptorType[descriptor.DescriptorTypeUid.Value]; } else { descriptorsForRelationship = new List <QueryMapDescriptor>(); descriptorsForRelationshipByDescriptorType[descriptor.DescriptorTypeUid.Value] = descriptorsForRelationship; } descriptorsForRelationship.Add(descriptor); } }
private void AddDescriptorByNode(QueryMapDescriptor descriptor) { if (descriptor.NodeUid.HasValue && descriptor.DescriptorTypeUid.HasValue) { Dictionary <Guid, List <QueryMapDescriptor> > descriptorsForNodeByDescriptorType; if (DescriptorsByNode.ContainsKey(descriptor.NodeUid.Value)) { descriptorsForNodeByDescriptorType = DescriptorsByNode[descriptor.NodeUid.Value]; } else { descriptorsForNodeByDescriptorType = new Dictionary <Guid, List <QueryMapDescriptor> >(); DescriptorsByNode[descriptor.NodeUid.Value] = descriptorsForNodeByDescriptorType; } List <QueryMapDescriptor> descriptorsForNode; if (descriptorsForNodeByDescriptorType.ContainsKey(descriptor.DescriptorTypeUid.Value)) { descriptorsForNode = descriptorsForNodeByDescriptorType[descriptor.DescriptorTypeUid.Value]; } else { descriptorsForNode = new List <QueryMapDescriptor>(); descriptorsForNodeByDescriptorType[descriptor.DescriptorTypeUid.Value] = descriptorsForNode; } descriptorsForNode.Add(descriptor); } }
public QueryMapResultSet(IMultipleResults queryMapResultSets) { var queryMapResultSet = queryMapResultSets.GetResult <QueryMapMultiDepthResult>(); while (queryMapResultSet != null) { foreach (var queryMapResult in queryMapResultSet) { if (queryMapResult.Level != null) { if (queryMapResult.NodeUid.HasValue && queryMapResult.NodeUid != Guid.Empty) { /// Make sure that we aren't displaying a domain node. if (queryMapResult.NodeTypeUid.HasValue && queryMapResult.NodeTypeUid != new Guid("263754C2-2F31-4D21-B9C4-6509E00A5E94")) { /// The QueryMap procedure returns ALL nodes by following relationships to max depth meaning some nodes are repeated in some of the levels multiple nodes may connect to them. if (!Nodes.ContainsKey(queryMapResult.NodeUid.Value)) { /// TODO: Need to consider if we require the NodeOriginalId. QueryMapNode node = new QueryMapNode(queryMapResult); Nodes[queryMapResult.NodeUid.Value] = node; } } } } else if (queryMapResult.MetadataId != null) { if (queryMapResult.MetadataId.HasValue && queryMapResult.MetadataId != Guid.Empty) { QueryMapMetadata metadatum = new QueryMapMetadata(queryMapResult); if (metadatum.NodeUid.HasValue) { if (Nodes.ContainsKey(metadatum.NodeUid.Value)) { Nodes[metadatum.NodeUid.Value].AddMetadata(metadatum); } } Metadata.Add(metadatum); } } else if (queryMapResult.DescriptorUid != null) { if (queryMapResult.DescriptorUid.HasValue && queryMapResult.DescriptorUid != Guid.Empty) { QueryMapDescriptor descriptor = new QueryMapDescriptor(queryMapResult); Descriptors.Add(descriptor); AddDescriptorByNode(descriptor); AddDescriptorByRelationship(descriptor); } } else { if (queryMapResult.RelationshipUid.HasValue && queryMapResult.RelationshipUid != Guid.Empty) { /// TODO: Need to consider if we require the RelationshipOriginalId. QueryMapRelationship relationship = new QueryMapRelationship(queryMapResult); Relationships[relationship.RelationshipUid] = relationship; } } } queryMapResultSet = queryMapResultSets.GetResult <QueryMapMultiDepthResult>(); } }