private IEnumerable <StitchDataMessage> AddressApplicationMessage(StitchDataMessage message)
        {
            var messages  = new List <StitchDataMessage>();
            var groupName = new StitchGroupName(message.ToStitchGroup);
            var stitches  = _stitches
                            .Where(si => groupName.Contains(si.GroupName))
                            .Where(si => si.Id != message.FromStitchInstanceId)
                            .ToList();

            foreach (var stitch in stitches)
            {
                messages.Add(new StitchDataMessage
                {
                    // Leave the ToNodeID and NetworkID empty, so it gets routed locally
                    Data = message.Data,
                    ToStitchInstanceId   = stitch.Id,
                    FromNetworkId        = message.FromNetworkId,
                    FromNodeId           = message.FromNodeId,
                    FromStitchInstanceId = message.FromStitchInstanceId,
                    ToNetworkId          = stitch.NetworkNodeId,
                    ToNodeId             = stitch.NodeId
                });
            }

            return(messages);
        }
Exemplo n.º 2
0
        public List <StitchSummary> GetStitchSummaries(StitchSummaryRequest request)
        {
            IEnumerable <StitchSummary> query = _data.GetAllStitchSummaries();

            if (!string.IsNullOrEmpty(request.NodeId))
            {
                query = query.Where(ss => ss.NodeId == request.NodeId);
            }
            if (!string.IsNullOrEmpty(request.StitchGroupName))
            {
                var name = new StitchGroupName(request.StitchGroupName);
                query = query.Where(ss => name.Contains(ss.GroupName));
            }
            if (!string.IsNullOrEmpty(request.StitchId))
            {
                query = query.Where(ss => ss.Id == request.StitchId);
            }

            return(query.ToList());
        }
Exemplo n.º 3
0
 public List <StitchSummary> GetStitchesInGroup(StitchGroupName group)
 {
     // TODO: Is there ever a case where we fall back to the data module?
     return(StitchCache.GetStitchSummaries().Where(si => group.Contains(si.GroupName)).ToList());
 }