protected void WriteCompositeTask(CompositeTaskDef t) { WriteLine("composite_task \"{0}\":", t.Id); Indent(() => { if (t.ExtensionProperties != null) { WriteMeta(t.ExtensionProperties); } foreach (var vd in t.Variables) { WriteVariable(vd); } foreach (var pl in t.Places) { } foreach (var tsk in t.Tasks) { if (tsk is CompositeTaskDef) { WriteCompositeTask((CompositeTaskDef)tsk); } else { WriteAtomicTask((AtomicTaskDef)tsk); } } foreach (var fl in t.Flows) { } }); }
/// <summary> /// Composite task definition /// </summary> /// <param name="id"></param> /// <param name="act"></param> protected void composite_task(string id, Action act) { var p = _currentCompositeTask; _currentCompositeTask = new CompositeTaskDef(); _currentCompositeTask.Id = id; act(); if (_currentCompositeTask.JoinType == TaskSplitType.OR && (_currentCompositeTask.OrJoinCheckList == null || _currentCompositeTask.OrJoinCheckList.Count == 0)) { throw new Exception("Define or_join_checklist for task " + _currentCompositeTask.Id); } p.AddTask(_currentCompositeTask); _currentCompositeTask = p; }
protected void GenerateScript(CompositeTaskDef ct) { GenerateBaseTaskScripts(ct); foreach (var fl in ct.Flows) { if (!string.IsNullOrEmpty(fl.InputCondition)) { GenCondition(DslUtil.FlowConditionKey(ct.Id, fl.From, fl.To), fl.InputCondition); } } foreach (var t in ct.Tasks) { GenerateScript(t); } }
public ProcessDef GetProcessDef() { _curProcessDef = new ProcessDef(); string name = this.GetType().FullName; int idx = name.LastIndexOf('.'); if (idx < 0) { throw new Exception("Invalid type name"); } _curProcessDef.PackageName = Package == null ? null : Package.Name; _curProcessDef.ProcessName = name.Substring(0, idx); _curProcessDef.Version = Int32.Parse(name.Substring(idx + 1)); _curProcessDef.Version = 1; _curProcessDef.DataTypes = new TypeSet(); _currentCompositeTask = new CompositeTaskDef { Id = _curProcessDef.ProcessName }; _curProcessDef.Body = _currentCompositeTask; Prepare(); _curProcessDef.FinishModelBuild(); return(_curProcessDef); }