private void concurrentBlock(XmlElement concurrentElement, ConcurrentBlockImpl concurrentBlock, ProcessBlockImpl currentProcessBlock) { concurrentBlock.ProcessDefinition = ProcessDefinition; this.processBlock(concurrentElement, concurrentBlock); JoinImpl joinImpl = concurrentBlock.CreateJoin(); ForkImpl forkImpl = concurrentBlock.CreateFork(); XmlElement joinElement = concurrentElement.GetChildElement("join"); this.join(joinElement, joinImpl, concurrentBlock); XmlElement forkElement = concurrentElement.GetChildElement("fork"); this.fork(forkElement, forkImpl, concurrentBlock); this.addReferencableObject(joinImpl.Name, currentProcessBlock, typeof(INode), joinImpl); this.addReferencableObject(forkImpl.Name, currentProcessBlock, typeof(INode), forkImpl); }
private void processBlock(XmlElement processBlockElement, ProcessBlockImpl currentProcessBlock) { currentProcessBlock.Nodes = new ListSet(); currentProcessBlock.Attributes = new ListSet(); currentProcessBlock.ChildBlocks = new ListSet(); IEnumerator iterAttr = processBlockElement.GetChildElements("attribute").GetEnumerator(); while (iterAttr.MoveNext()) { AttributeImpl attribute = new AttributeImpl(); this.attribute((XmlElement)iterAttr.Current, attribute, currentProcessBlock); currentProcessBlock.Attributes.Add(attribute); } IEnumerator iterActivityState = processBlockElement.GetChildElements("activity-state").GetEnumerator(); while (iterActivityState.MoveNext()) { ActivityStateImpl activityState = currentProcessBlock.CreateActivityState(); this.activityState((XmlElement)iterActivityState.Current, activityState, currentProcessBlock); currentProcessBlock.Nodes.Add(activityState); } IEnumerator iterConcurrent = processBlockElement.GetChildElements("concurrent-block").GetEnumerator(); while (iterConcurrent.MoveNext()) { ConcurrentBlockImpl concurrentBlock = currentProcessBlock.CreateConcurrentBlock(); this.concurrentBlock((XmlElement)iterConcurrent.Current, concurrentBlock, currentProcessBlock); } IEnumerator iterDecision = processBlockElement.GetChildElements("decision").GetEnumerator(); while (iterDecision.MoveNext()) { DecisionImpl decision = currentProcessBlock.CreateDecision(); this.decision((XmlElement)iterDecision.Current, decision, currentProcessBlock); } this.definitionObject(processBlockElement, currentProcessBlock, currentProcessBlock); }
public void CancelFlow(String authenticatedActorId, Int64 flowId, DbSession dbSession, IOrganisationService organisationComponent) { // first check if the actor is allowed to cancel this flow authorizationHelper.CheckCancelFlow(authenticatedActorId, flowId, dbSession); FlowImpl flow = (FlowImpl)dbSession.Load(typeof(FlowImpl), flowId); log.Info("actor '" + authenticatedActorId + "' cancels flow '" + flowId + "'..."); // only perform the cancel if this flow is not finished yet if (!flow.EndHasValue) { ExecutionContextImpl executionContext = new ExecutionContextImpl(authenticatedActorId, flow, dbSession, organisationComponent); executionContext.CreateLog(authenticatedActorId, EventType.FLOW_CANCEL); if (flow.IsRootFlow()) { // set the flow in the end-state log.Debug("setting root flow to the end state..."); EndStateImpl endState = (EndStateImpl)flow.ProcessInstance.ProcessDefinition.EndState; engine.ProcessEndState(endState, executionContext, dbSession); } else { // set the flow in the join ConcurrentBlockImpl concurrentBlock = (ConcurrentBlockImpl)flow.Node.ProcessBlock; JoinImpl join = (JoinImpl)concurrentBlock.Join; log.Debug("setting concurrent flow to join '" + join + "'"); engine.ProcessJoin(join, executionContext, dbSession); } // flush the updates to the db dbSession.Update(flow); dbSession.Flush(); } }