/// <summary> /// Save a flow with the gui input /// </summary> /// <param name="flowConfig"></param> /// <returns></returns> public async Task <Result> SaveFlowConfig(FlowGuiConfig flowConfig) { var config = await ConfigBuilder.Build(flowConfig); var existingFlow = await FlowData.GetByName(config.Name); Result result = null; if (existingFlow != null) { existingFlow.Gui = config.Gui; existingFlow.CommonProcessor.Template = config.CommonProcessor.Template; existingFlow.CommonProcessor.SparkJobTemplateRef = config.CommonProcessor.SparkJobTemplateRef; existingFlow.DisplayName = config.DisplayName; config = existingFlow; result = await FlowData.UpdateGuiForFlow(config.Name, config.Gui); if (result.IsSuccess) { result = await FlowData.UpdateCommonProcessorForFlow(config.Name, config.CommonProcessor); } } else { result = await this.FlowData.Upsert(config); } if (result.IsSuccess) { // pass the generated config back with the result var properties = new Dictionary <string, object>() { { FlowConfigPropertyName, config } }; if (result.Properties != null) { result.Properties.AppendDictionary(properties); } else { result.Properties = properties; } } return(result); }