public void TryGetProcessTest() { tProcess p = null; def.TryGetProcess("losFlow", out p); Assert.IsNotNull(p); }
public void DefineProcess(tProcess process, Guid definitionKey) { BpmnProcess procDef = new BpmnProcess(); procDef.DefinitionKey = definitionKey; procDef.Id = process.id; procDef.Name = process.name; procDef.IsExecutable = process.isExecutable; procDef.IsClosed = process.isClosed; processStore.Create(procDef); //SetProperty(process.property); Dictionary <string, Guid> ItemsKeys = new Dictionary <string, Guid>(); //Dictionary<Guid, ProcessItemDefinition> itemProcs = new Dictionary<Guid, ProcessItemDefinition>(); foreach (var item in process.Items.OfType <tFlowNode>()) { BpmnFlowNode node = new BpmnFlowNode(); node.Id = item.id; node.Name = item.name; node.ItemType = ProcessItem.GetProcessType(item); ItemsKeys.Add(item.id, node.Key); flowNodeStore.Create(node); } foreach (var flow in process.Items.OfType <tSequenceFlow>()) { BpmnSequenceFlow seqFlow = new BpmnSequenceFlow(); seqFlow.Id = flow.id; seqFlow.Name = flow.name; Guid ItemSourceRef; if (ItemsKeys.TryGetValue(flow.sourceRef, out ItemSourceRef)) { seqFlow.ItemSourceRef = ItemSourceRef; } Guid ItemTargetRef; if (ItemsKeys.TryGetValue(flow.targetRef, out ItemTargetRef)) { seqFlow.ItemSourceTarget = ItemTargetRef; } if (flow.conditionExpression != null) { seqFlow.ConditionExpression = string.Join(" ", flow.conditionExpression.Text); } sequenceFlowStore.Create(seqFlow); } }
private async Task SaveAllFlowNodeAsync(int deploymentId, int processNodeId, tProcess process, Dictionary <string, int> itemKeys, string tenantId) { // Get all tFlowNode foreach (var flowNode in process.Items.OfType <tFlowNode>()) { // Get All Process Flow Node FlowNodeEntity node = await CreateFlowNodeAsync(flowNode.id, flowNode.name, ProcessItem.GetProcessType(flowNode), process.id, processNodeId); itemKeys.Add(flowNode.id, node.Id); // Get Sub Process if (ProcessItem.IsSubProcess(flowNode)) { await SaveSubProcess(deploymentId, flowNode as tSubProcess, process, node, tenantId); } } }
private async Task SaveSubProcess(int deploymentId, tSubProcess subProcess, tProcess process, FlowNodeEntity node, string tenantId) { Dictionary <string, int> itemKeys = new Dictionary <string, int>(); //SaveProcessDefinition await SaveProcessDefinitionAsync(deploymentId, node.Id, subProcess.id, subProcess.name, process.isClosed, process.isExecutable, tenantId); // Get Sub Process Flow Node foreach (var subProcessItem in subProcess.Items1.OfType <tFlowNode>()) { FlowNodeEntity subNode = await CreateFlowNodeAsync(subProcessItem.id, subProcessItem.name, ProcessItem.GetProcessType(subProcessItem), subProcess.id, node.Id); itemKeys.Add(subProcessItem.id, subNode.Id); } // Get Sub Process Sequence Flow foreach (var sequenceFlow in subProcess.Items1.OfType <tSequenceFlow>()) { // Save Sub Process Sequence Flow await CreateSequenceFlowAsync(sequenceFlow, itemKeys); } }