Example #1
0
        // Done
        private void SetupInputDataForFlow(DataDefinitionCollection allInputs, ConvertedFlow newFlow, bool filterPP = false)
        {
            List <LogicBaseProjectConversionUtility.ProjectConversionService.DataDefinition> flowInputData = new List <LogicBaseProjectConversionUtility.ProjectConversionService.DataDefinition>();

            foreach (LogicBase.Core.Data.DataDefinition input in allInputs)
            {
                if (input.Name.StartsWith("[ProjectProperties].") || input.Name.StartsWith("[Global]."))
                {
                    continue;
                }

                try
                {
                    LogicBaseProjectConversionUtility.ProjectConversionService.DataDefinition fid = new LogicBaseProjectConversionUtility.ProjectConversionService.DataDefinition();
                    fid.CanBeNull    = input.IsNullAllowed;
                    fid.IsList       = input.IsArray;
                    fid.FullTypeName = input.DataType.FullName;
                    fid.Name         = input.Name;
                    flowInputData.Add(fid);
                } catch (Exception e)
                {
                    if (input == null)
                    {
                        Report("Tried to parse null input value");
                    }
                    else
                    {
                        Report("Problem converting input named {0} of type {1}", input.Name, input.DataType == null ? "NULL" : input.DataType.ToString());
                    }
                }
            }
            newFlow.InputData = flowInputData.ToArray();
        }
Example #2
0
        private ConvertedFlow[] ProcessModels(AbstractOrchestrationProject aop)
        {
            Report("Preparing to process models");
            flowsForProject.Clear();
            projectName = aop.ProjectSetupData.Name;


            foreach (Model m in aop.ProjectSetupData.Models)
            {
                Report("Creating Decisions Flow Named: {0}.{1}", aop.ProjectSetupData.Name, m.ModelName);
                ConvertedFlow newFlow = new ConvertedFlow();
                newFlow.FlowName = m.ModelName;
                newFlow.FlowId   = m.ModelID;

                if (string.IsNullOrEmpty(m.ParentModelName))
                {
                    newFlow.Tags = new string[] { "Root" };
                }

                else
                {
                    newFlow.Tags = new string[] { m.ParentModelName };
                }

                MODEL_NAME_TO_ID_MAP[m.ModelName] = m.ModelID;

                // Setup the flow input data according to the
                // LogicBase model input data
                IComponentModel myModel = aop.GetComponentModel(m);
                SetupInputDataForFlow(myModel.InputData, newFlow);

                ProcessComponentsFromModelToFlow(myModel, newFlow, aop.ProjectSetupData.Name, m.ModelName, flowsForProject);

                Report("Flow Complete.");

                AddFlowToList(newFlow);
            }
            return(flowsForProject.ToArray());
        }
Example #3
0
 private void SetupOutputDataForFlow(DataDefinitionCollection outputData, ConvertedFlow newFlow)
 {
     // When setting up output data for a flow it actually
     // needs to be data that is configured on the end steps,
     // not on the flow object itself.
 }
Example #4
0
        private void ProcessComponentsFromModelToFlow(IComponentModel compModel, ConvertedFlow newFlow, string projectName, string modelName, List <ConvertedFlow> allFlows)
        {
            List <ConvertedStep> allSteps = new List <ConvertedStep>();

            foreach (IOrchestrationComponent component in compModel.Components)
            {
                if (component is EmbeddedModelComponent)
                {
                    ConvertedFlow embeddedFlow = new ConvertedFlow();
                    embeddedFlow.FlowName = component.Name;


                    FieldInfo[] fields = component.GetType().GetFields(
                        BindingFlags.NonPublic |
                        BindingFlags.Instance);

                    IComponentModel internalModel = (IComponentModel)fields.First(xx => xx.Name == "_embeddedModel").GetValue(component);

                    SetupInputDataForFlow(internalModel.InputData, embeddedFlow, true);
                    SetupOutputDataForFlow(internalModel.OutputData, embeddedFlow);
                    embeddedFlow.Tags   = new string[] { modelName, "Embedded Model" };
                    embeddedFlow.FlowId = internalModel.Id;

                    ProcessComponentsFromModelToFlow(internalModel, embeddedFlow, projectName, component.Name + " Embedded", allFlows);

                    allFlows.Add(embeddedFlow);
                }

                ConvertedStep x = CreateFlowStepFromComponent(projectName, component, modelName);

                allSteps.Add(x);
            }

            newFlow.Steps = allSteps.ToArray();

            List <ConvertedConnection> stepConnections = new List <ConvertedConnection>();

            // Now that we have created and mapped all the steps we
            // need to create all of the necessary links
            foreach (IOrchestrationComponent component in compModel.Components)
            {
                Report("Linking {0}", component.Name);

                IComponentLink[] links = compModel.GetOutboundLinks(component);

                foreach (IComponentLink eachLink in links)
                {
                    string srcPath       = eachLink.Path;
                    int    srcPortNumber = eachLink.SourcePortNumber + 1;
                    int    dstPortNumber = eachLink.DestinationPortNumber - 1;
                    dstPortNumber = dstPortNumber < 0 ? 0 : dstPortNumber;
                    srcPortNumber = srcPortNumber > 3 ? 3 : srcPortNumber;

                    stepConnections.Add(new ConvertedConnection()
                    {
                        TargetStepId           = eachLink.DestinationComponentID,
                        SourceStepId           = eachLink.SourceComponentID,
                        TargetPortNumberOnStep = dstPortNumber,
                        SourcePortNumberOnStep = srcPortNumber,
                        PathName = eachLink.Path
                    });
                }
            }

            newFlow.Connections = stepConnections.ToArray();
        }
Example #5
0
 private void AddFlowToList(ConvertedFlow newFlow)
 {
     flowsForProject.Add(newFlow);
 }