Exemplo n.º 1
0
        /// <summary>
        /// The mappings between routes go from the source to the destination,
        /// in most cases the destination is the one that needs the mappings
        /// this method will make sure the destination has the mappings as well
        /// </summary>
        /// <param name="module"></param>
        public void BackPopulateMappings(RouteModuleConfig module)
        {
            var incomingModule = this.PipelineModules.Where(pm => (pm.PrimaryOutput != null && pm.PrimaryOutput.Id == module.Id) ||
                                                            pm.SecondaryOutputs != null && pm.SecondaryOutputs.Where(rt => rt.Id == module.Id).Any()).FirstOrDefault();

            if (incomingModule != null)
            {
                if (incomingModule.PrimaryOutput != null)
                {
                    foreach (var mapping in incomingModule.PrimaryOutput.Mappings)
                    {
                        if (!module.IncomingMappings.Where(mod => mod.Key == mapping.Key).Any())
                        {
                            module.IncomingMappings.Add(mapping);
                        }
                    }
                }

                if (incomingModule.SecondaryOutputs != null)
                {
                    var incomingPath = incomingModule.SecondaryOutputs.Where(mod => mod.Id == module.Id).FirstOrDefault();
                    if (incomingPath != null)
                    {
                        foreach (var mapping in incomingPath.Mappings)
                        {
                            if (!module.IncomingMappings.Where(mod => mod.Key == mapping.Key).Any())
                            {
                                module.IncomingMappings.Add(mapping);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static Route Create()
        {
            var route = new Route();

            var sentinel = new RouteModuleConfig()
            {
                ModuleType      = EntityHeader <PipelineModuleType> .Create(PipelineModuleType.Sentinel),
                DiagramLocation = new DeviceAdmin.Models.DiagramLocation()
                {
                    Page = 1, X = 50, Y = 25
                }
            };

            route.PipelineModules.Add(sentinel);

            var inputTranslator = new RouteModuleConfig()
            {
                ModuleType      = EntityHeader <PipelineModuleType> .Create(PipelineModuleType.InputTranslator),
                DiagramLocation = new DeviceAdmin.Models.DiagramLocation()
                {
                    Page = 1, X = 200, Y = 125
                }
            };

            sentinel.PrimaryOutput = RouteConnection.Create(inputTranslator.Id, DeploymentAdminResources.RouteModuleConfig_Unassigned);
            route.PipelineModules.Add(inputTranslator);

            var workflow = new RouteModuleConfig()
            {
                ModuleType      = EntityHeader <PipelineModuleType> .Create(PipelineModuleType.Workflow),
                DiagramLocation = new DeviceAdmin.Models.DiagramLocation()
                {
                    Page = 1, X = 350, Y = 225
                }
            };

            inputTranslator.PrimaryOutput = RouteConnection.Create(workflow.Id, DeploymentAdminResources.RouteModuleConfig_Unassigned);
            route.PipelineModules.Add(workflow);

            var outputTranslator = new RouteModuleConfig()
            {
                ModuleType      = EntityHeader <PipelineModuleType> .Create(PipelineModuleType.OutputTranslator),
                DiagramLocation = new DeviceAdmin.Models.DiagramLocation()
                {
                    Page = 1, X = 500, Y = 325
                }
            };

            workflow.PrimaryOutput = RouteConnection.Create(outputTranslator.Id, DeploymentAdminResources.RouteModuleConfig_Unassigned);
            route.PipelineModules.Add(outputTranslator);

            return(route);
        }