/// <summary> /// Set process input data /// </summary> /// <param name="data"></param> public void SetProcessInputData(IDataObject data) { StructDef procInput = Definition.GetProcessInputDataSchema(); data.Validate(procInput); DataObject dob = new DataObject(); IProcessScript ctx = CreateProcessScriptContext(); foreach (VariableDef vd in Definition.ProcessVariables) { if (data.ContainsKey(vd.Name)) { dob[vd.Name] = data[vd.Name]; } else { if (vd.DefaultValueExpr == null || vd.DefaultValueExpr.Length == 0) { if (vd.IsRequired && (vd.VariableDir == VariableDef.Dir.In || vd.VariableDir == VariableDef.Dir.InOut)) throw new ApplicationException("Missing required input variable: " + vd.Name); } else { object val = ctx.GetDefaultVariableValue(vd.Name); dob[vd.Name] = val; } } } StructDef internalSchema = GetProcessInternalDataSchema(); dob.Validate(internalSchema); _processInstanceData = new DataObject(); _processInstanceData["variables"] = dob; _processInstanceData["instanceInfo"] = new DataObject(); }