/* package private */ internal virtual TransitionImpl GetTransition(String transitionName, INode node, DbSession dbSession) { TransitionImpl transition = null; if ((Object)transitionName != null) { Object[] values = new Object[] { transitionName, node.Id }; IType[] types = new IType[] { DbType.STRING, DbType.LONG }; transition = (TransitionImpl)dbSession.FindOne(queryFindTransitionByName, values, types); } else { if (node is IState) { IState state = node as IState; ISet leavingTransitions = state.LeavingTransitions; if (leavingTransitions.Count == 1) { IEnumerator transEnum = leavingTransitions.GetEnumerator(); transEnum.MoveNext(); transition = (TransitionImpl)transEnum.Current; } else { throw new SystemException("no transitionName was specified : this is only allowed if the state (" + state.Name + ") has exactly 1 leaving transition (" + leavingTransitions.Count + ")"); } } } return(transition); }
public void ProcessTransition(TransitionImpl transition, FlowImpl flow, DbSession dbSession) { NodeImpl destination = (NodeImpl)transition.To; flow.Node = destination; if (destination is ActivityStateImpl) { ProcessActivityState((ActivityStateImpl)destination, flow, dbSession); } else if (destination is ProcessStateImpl) { //ProcessProcessState((ProcessStateImpl)destination, executionContext, dbSession); } else if (destination is DecisionImpl) { ProcessDecision((DecisionImpl)destination, flow, dbSession); } else if (destination is ForkImpl) { ProcessFork((ForkImpl)destination, flow, dbSession); } else if (destination is JoinImpl) { ProcessJoin((JoinImpl)destination, flow, dbSession); } else if (destination is EndStateImpl) { ProcessEndState((EndStateImpl)destination, flow, dbSession); } else { throw new SystemException(""); } }
public IProcessInstance StartProcessInstance(long processDefinitionId, IDictionary attributeValues = null, string transitionName = null, Relations relations = null) { ProcessInstanceImpl processInstance = null; IOrganisationService organisationService = null; using (ISession session = NHibernateHelper.OpenSession()) { using (var tran = session.BeginTransaction()) { DbSession dbSession = new DbSession(session); ProcessDefinitionImpl processDefinition = myProcessDefinitionService.GetProcessDefinition(processDefinitionId, dbSession); processInstance = new ProcessInstanceImpl(ActorId, processDefinition); processInstanceRepository.Save(processInstance, dbSession);//到這裏應該存了ProcessInstance,RootFlow ExecutionContext executionContext = new ExecutionContext(); //logRepository.CreateLog(); processDefinition.StartState.CheckAccess(attributeValues); attributeService = new AttributeService((FlowImpl)processInstance.RootFlow, dbSession); attributeService.StoreAttributeValue(attributeValues);//儲存傳入的欄位值 attributeService.StoreRole(organisationService.FindActorById(ActorId), (ActivityStateImpl)processDefinition.StartState); //flow的node推進到下一關卡 //flow的actor=解析出來的actor.Id transitionService = new TransitionService(ActorId, dbSession); TransitionImpl transitionTo = transitionService.GetTransition(transitionName, processDefinition.StartState, dbSession); transitionService.ProcessTransition(transitionTo, (FlowImpl)processInstance.RootFlow, dbSession); session.Flush(); tran.Commit(); } } return(processInstance); }
public TransitionImpl DelegateDecision(DelegationImpl delegation, ExecutionContextImpl executionContext) { TransitionImpl selectedTransition = null; try { IDecisionHandler decision = (IDecisionHandler)GetDelegate(delegation); executionContext.SetConfiguration(ParseConfiguration(delegation)); String transitionName = decision.Decide(executionContext); if ((Object)transitionName == null) { throw new SystemException("Decision-delegate for decision '" + executionContext.GetNode() + "' returned null instead of a transition-name : " + decision.GetType().FullName); } try { Object[] args = new Object[] { executionContext.GetNode().Id, transitionName }; IType[] types = new IType[] { DbType.LONG, DbType.STRING }; selectedTransition = (TransitionImpl)executionContext.DbSession.FindOne(queryFindLeavingTransitionByName, args, types); } catch (Exception t) { throw new SystemException("couldn't find transition '" + transitionName + "' that was selected by the decision-delegate of activity '" + executionContext.GetNode().Name + "' : " + t.Message); } } catch (Exception t) { HandleException(delegation, executionContext, t); } return(selectedTransition); }
private void node(XmlElement nodeElement, NodeImpl node, ProcessBlockImpl processBlock) { node.ArrivingTransitions = new ListSet(); node.LeavingTransitions = new ListSet(); IEnumerator iter = nodeElement.GetChildElements("transition").GetEnumerator(); while (iter.MoveNext()) { XmlElement transitionElement = (XmlElement)iter.Current; TransitionImpl transition = new TransitionImpl(); transition.ProcessDefinition = ProcessDefinition; transition.From = node; if (node is JoinImpl) { this.joinTransition(transitionElement, transition, processBlock); } else { this.transition(transitionElement, transition, processBlock); } node.LeavingTransitions.Add(transition); } this.definitionObject(nodeElement, node, processBlock); //把所有的Node加到集合中 this.addReferencableObject(node.Name, processBlock, typeof(INode), node); }
public void ProcessEndState(EndStateImpl endState, ExecutionContextImpl executionContext, DbSession dbSession) { delegationService.RunActionsForEvent(EventType.PROCESS_INSTANCE_END, endState.ProcessDefinition.Id, executionContext, dbSession); executionContext.CreateLog(EventType.PROCESS_INSTANCE_END); FlowImpl rootFlow = (FlowImpl)executionContext.GetFlow(); rootFlow.ActorId = null; rootFlow.End = DateTime.Now; rootFlow.Node = endState; // setting the node is not necessary if this method is called // from processTransition, but it is necessary if this method is // called from cancelProcessInstance in the component-impl. ProcessInstanceImpl processInstance = (ProcessInstanceImpl)executionContext.GetProcessInstance(); FlowImpl superProcessFlow = (FlowImpl)processInstance.SuperProcessFlow; if (superProcessFlow != null) { log.Debug("reactivating the super process..."); // create the execution context for the parent-process ExecutionContextImpl superExecutionContext = new ExecutionContextImpl(executionContext.PreviousActorId, superProcessFlow, executionContext.DbSession, executionContext.GetOrganisationComponent()); superExecutionContext.SetInvokedProcessContext(executionContext); // delegate the attributeValues ProcessStateImpl processState = (ProcessStateImpl)superProcessFlow.Node; Object[] completionData = delegationHelper.DelegateProcessTermination(processState.ProcessInvokerDelegation, superExecutionContext); IDictionary attributeValues = (IDictionary)completionData[0]; String transitionName = (String)completionData[1]; TransitionImpl transition = transitionRepository.GetTransition(transitionName, processState, executionContext.DbSession); // process the super process transition ProcessTransition(transition, superExecutionContext, dbSession); } }
protected internal virtual void AssertSequenceFlowWayPoints(TransitionImpl sequenceFlow, params int[] waypoints) { Assert.AreEqual(waypoints.Length, sequenceFlow.Waypoints.Count); for (int i = 0; i < waypoints.Length; i++) { Assert.AreEqual(waypoints[i], sequenceFlow.Waypoints.ToList().ElementAt(i)); } }
public virtual ProcessDefinitionBuilder EndActivity() { ScopeStack.Pop(); ProcessElement = ScopeStack.Peek(); transition = null; return(this); }
public virtual ProcessDefinitionBuilder endActivity() { scopeStack.Pop(); processElement = scopeStack.Peek(); transition_Renamed = null; return(this); }
public virtual ProcessDefinitionBuilder CreateActivity(string id) { var activity = (ActivityImpl)ScopeStack.Peek().CreateActivity(id); ScopeStack.Push(activity); ProcessElement = activity; transition = null; return(this); }
public virtual ProcessDefinitionBuilder createActivity(string id) { ActivityImpl activity = scopeStack.Peek().createActivity(id); scopeStack.Push(activity); processElement = activity; transition_Renamed = null; return(this); }
public void ProcessJoin(JoinImpl join, FlowImpl joiningFlow, DbSession dbSession) { joiningFlow.End = DateTime.Now; joiningFlow.ActorId = null; joiningFlow.Node = join; if (false != joiningFlow.ParentReactivation) { bool parentReactivation = false; IList concurrentFlows = flowRepository.GetOtherActiveConcurrentFlows(joiningFlow.Id, dbSession); if (concurrentFlows.Count == 0) { parentReactivation = true; } else { //DelegationImpl joinDelegation = join.JoinDelegation; //if (joinDelegation != null) //{ // IJoinHandler joiner = (IJoinHandler)joinDelegation.GetDelegate(); // IDictionary attributes = joinDelegation.ParseConfiguration(); // parentReactivation = delegationHelper.DelegateJoin(join.JoinDelegation, executionContext); //} } if (parentReactivation) { IEnumerator iter = concurrentFlows.GetEnumerator(); while (iter.MoveNext()) { FlowImpl concurrentFlow = (FlowImpl)iter.Current; concurrentFlow.ParentReactivation = false; } // reactivate the parent by first setting the parentflow into the executionContext FlowImpl parentFlow = (FlowImpl)joiningFlow.Parent; //executionContext.SetFlow(parentFlow); // and then process the (single, checked at process-archive-parsing-time) leaving transition. ISet leavingTransitions = join.LeavingTransitions; iter = leavingTransitions.GetEnumerator(); if (iter.MoveNext()) { TransitionImpl leavingTransition = (TransitionImpl)iter.Current; ProcessTransition(leavingTransition, parentFlow, dbSession); } else { // no transition throw exception? } } } }
public ForkedFlow ForkFlow(TransitionImpl transition, FlowImpl parentFlow, IDictionary attributeValues) { // create the subflow FlowImpl subFlow = new FlowImpl(transition.Name, parentFlow, (ProcessBlockImpl)transition.From.ProcessBlock); parentFlow.Children.Add(subFlow); // save it //_dbSession.SaveOrUpdate(subFlow); // add the transition and the flow to the set of created sub-flows return(new ForkedFlow(transition, subFlow)); }
public virtual ProcessDefinitionBuilder StartTransition(string destinationActivityId, string transitionId) { if (ReferenceEquals(destinationActivityId, null)) { throw new PvmException("destinationActivityId is null"); } var activity = Activity; transition = activity.CreateOutgoingTransition(transitionId); UnresolvedTransitions.Add(new object[] { transition, destinationActivityId }); ProcessElement = transition; return(this); }
public virtual ProcessDefinitionBuilder startTransition(string destinationActivityId, string transitionId) { if (string.ReferenceEquals(destinationActivityId, null)) { throw new PvmException("destinationActivityId is null"); } ActivityImpl activity = Activity; transition_Renamed = activity.createOutgoingTransition(transitionId); unresolvedTransitions.Add(new object[] { transition_Renamed, destinationActivityId }); processElement = transition_Renamed; return(this); }
public void ProcessDecision(DecisionImpl decision, ExecutionContextImpl executionContext, DbSession dbSession) { // trigger actions, scheduled before the decision actually is made delegationService.RunActionsForEvent(EventType.BEFORE_DECISION, decision.Id, executionContext, dbSession); // delegate the decision TransitionImpl selectedTransition = delegationHelper.DelegateDecision(decision.DecisionDelegation, executionContext); // process the selected transition ProcessTransition(selectedTransition, executionContext, dbSession); // trigger actions, scheduled after the decision is made delegationService.RunActionsForEvent(EventType.AFTER_DECISION, decision.Id, executionContext, dbSession); }
public virtual PvmProcessDefinition buildProcessDefinition() { foreach (object[] unresolvedTransition in unresolvedTransitions) { TransitionImpl transition = (TransitionImpl)unresolvedTransition[0]; string destinationActivityName = (string)unresolvedTransition[1]; ActivityImpl destination = processDefinition.findActivity(destinationActivityName); if (destination == null) { throw new Exception("destination '" + destinationActivityName + "' not found. (referenced from transition in '" + transition.Source.Id + "')"); } transition.setDestination(destination); } return(processDefinition); }
//private const String queryFindLeavingTransitionByName = "select t " + // "from t in class NetBpm.Workflow.Definition.Impl.TransitionImpl, " + // " n in class NetBpm.Workflow.Definition.Impl.NodeImpl " + // "where n.id = ? " + // " and t.From.id = n.id " + // " and t.Name = ? "; public void ForkFlow(String transitionName, IDictionary attributeValues) { // find the transition TransitionImpl transition = null; try { transition = transitionRepository.FindLeavingTransitionByName(_node.Id, transitionName, _dbSession); } catch (NotUniqueException e) { throw new SystemException("transition with name '" + transitionName + "' was not found for creating sub-flow on fork '" + _node.Name + "' : " + e.Message); } ForkFlow(transition, attributeValues); }
public void ProcessDecision(DecisionImpl decision, FlowImpl flow, DbSession dbSession) { //var delegateParameters = delegationService.ParseConfiguration(decision.DecisionDelegation); //IDecisionHandler decisionHandler = (IDecisionHandler)delegationService.GetDelegate(decision.DecisionDelegation); var attributes = decision.DecisionDelegation.ParseConfiguration(); string transiationName = new EvaluationDecision().Decide(attributes["attribute"].ToString()); TransitionImpl selectedTransition = this.GetTransition(transiationName, decision, dbSession); //// delegate the decision //TransitionImpl selectedTransition = delegationHelper.DelegateDecision(decision.DecisionDelegation, executionContext); //// process the selected transition ProcessTransition(selectedTransition, flow, dbSession); }
//private const String queryFindActionsByEventType = "select a from a in class NetBpm.Workflow.Definition.Impl.ActionImpl " + // "where a.EventType = ? " + // " and a.DefinitionObjectId = ? "; //public void RunActionsForEvent(EventType eventType, Int64 definitionObjectId, ExecutionContextImpl executionContext) //{ // log.Debug("processing '" + eventType + "' events for executionContext " + executionContext); // DbSession dbSession = executionContext.DbSession; // // find all actions for definitionObject on the given eventType // Object[] values = new Object[] {eventType, definitionObjectId}; // IType[] types = new IType[] {DbType.INTEGER, DbType.LONG}; // IList actions = dbSession.Find(queryFindActionsByEventType, values, types); // IEnumerator iter = actions.GetEnumerator(); // log.Debug("list" + actions); // while (iter.MoveNext()) // { // ActionImpl action = (ActionImpl) iter.Current; // log.Debug("action: " + action); // delegationHelper.DelegateAction(action.ActionDelegation, executionContext); // } // log.Debug("ende runActionsForEvent!"); //} public void ProcessTransition(TransitionImpl transition, ExecutionContextImpl executionContext, DbSession dbSession) { log.Debug("processing transition '" + transition + "' for flow '" + executionContext.GetFlow() + "'"); // trigger all the actions scheduled for this transition delegationService.RunActionsForEvent(EventType.TRANSITION, transition.Id, executionContext, dbSession); // first set the state of the execution context and the flow // to the node that is going to be processed FlowImpl flow = (FlowImpl)executionContext.GetFlow(); NodeImpl destination = (NodeImpl)transition.To; flow.Node = destination; executionContext.SetNode(destination); // note : I want to keep the engine methods grouped in this class, that is why I // didn't use inheritance but used an instanceof-switch instead. if (destination is ActivityStateImpl) { ProcessActivityState((ActivityStateImpl)destination, executionContext, dbSession); } else if (destination is ProcessStateImpl) { ProcessProcessState((ProcessStateImpl)destination, executionContext, dbSession); } else if (destination is DecisionImpl) { ProcessDecision((DecisionImpl)destination, executionContext, dbSession); } else if (destination is ForkImpl) { ProcessFork((ForkImpl)destination, executionContext, dbSession); } else if (destination is JoinImpl) { ProcessJoin((JoinImpl)destination, executionContext, dbSession); } else if (destination is EndStateImpl) { ProcessEndState((EndStateImpl)destination, executionContext, dbSession); } else { throw new SystemException(""); } }
public void ForkFlow(TransitionImpl transition, IDictionary attributeValues) { // create the subflow FlowImpl subFlow = new FlowImpl(transition.Name, _flow, (ProcessBlockImpl)_node.ProcessBlock); _flow.Children.Add(subFlow); // save it _dbSession.SaveOrUpdate(subFlow); // store the attributeValues this._flow = subFlow; StoreAttributeValues(attributeValues); this._flow = (FlowImpl)this._flow.Parent; // add the transition and the flow to the set of created sub-flows this._forkedFlows.Add(new ForkedFlow(transition, subFlow)); }
public IList PerformActivity(long flowId, IDictionary attributeValues = null, String transitionName = null, Relations relations = null) { if (string.IsNullOrEmpty(ActorId)) { throw new AuthorizationException("you can't perform an activity because you are not authenticated"); } IList flows = null; try { using (ISession session = NHibernateHelper.OpenSession()) { DbSession dbSession = new DbSession(session); FlowImpl flow = flowRepository.GetFlow(flowId, dbSession); ActivityStateImpl activityState = (ActivityStateImpl)flow.Node; ExecutionContext executionContext = new ExecutionContext(); activityState.CheckAccess(attributeValues); attributeService = new AttributeService(flow, dbSession); attributeService.StoreAttributeValue(attributeValues); transitionService = new TransitionService(ActorId, dbSession); TransitionImpl transitionTo = transitionService.GetTransition(transitionName, activityState, dbSession); transitionService.ProcessTransition(transitionTo, flow, dbSession); session.Flush(); } } catch (ExecutionException e) { throw e; } catch (Exception e) { throw new SystemException("uncaught exception : " + e.Message, e); } finally { //ServiceLocator.Instance.Release(organisationComponent); } return(flows); }
protected internal virtual void UpdateAsyncAfterTargetConfiguration( AsyncContinuationJobHandler.AsyncContinuationConfiguration currentConfiguration) { var targetActivity = (ActivityImpl)targetScope; var outgoingTransitions = (IList <IPvmTransition>)targetActivity.OutgoingTransitions; var targetConfiguration = new AsyncContinuationJobHandler.AsyncContinuationConfiguration(); if (outgoingTransitions.Count == 0) { targetConfiguration.AtomicOperation = PvmAtomicOperationFields.ActivityEnd.CanonicalName; } else { targetConfiguration.AtomicOperation = PvmAtomicOperationFields.TransitionNotifyListenerTake.CanonicalName; if (outgoingTransitions.Count == 1) { targetConfiguration.TransitionId = outgoingTransitions[0].Id; } else { TransitionImpl matchingTargetTransition = null; var currentTransitionId = currentConfiguration.TransitionId; if (!ReferenceEquals(currentTransitionId, null)) { matchingTargetTransition = (TransitionImpl)targetActivity.FindOutgoingTransition(currentTransitionId); } if (matchingTargetTransition != null) { targetConfiguration.TransitionId = matchingTargetTransition.Id; } else { throw new ProcessEngineException("Cannot determine matching outgoing sequence flow"); } } } //jobEntity.JobHandlerConfiguration = targetConfiguration; }
public virtual void TestExecutionEntitySerialization() { var execution = new ExecutionEntity(); var activityImpl = new ActivityImpl("test", null); activityImpl.ExecutionListeners.Add("start", new List <IDelegateListener <IBaseDelegateExecution> > { new TestExecutionListener() }); execution.Activity = activityImpl; var processDefinitionImpl = new ProcessDefinitionImpl("test"); processDefinitionImpl.ExecutionListeners.Add("start", new List <IDelegateListener <IBaseDelegateExecution> > { new TestExecutionListener() }); execution.ProcessDefinition = processDefinitionImpl; var transitionImpl = new TransitionImpl("test", new ProcessDefinitionImpl("test")); transitionImpl.AddExecutionListener(new TestExecutionListener()); execution.Transition = (transitionImpl); execution.ProcessInstanceStartContext.Initial = activityImpl; execution.SuperExecution = (new ExecutionEntity()); execution.IsActive = true; execution.Canceled = false; execution.BusinessKey = "myBusinessKey"; execution.DeleteReason = "no reason"; execution.ActivityInstanceId = "123"; execution.IsScope = false; var data = WriteObject(execution); execution = (ExecutionEntity)ReadObject(data); Assert.AreEqual("myBusinessKey", execution.BusinessKey); Assert.AreEqual("no reason", execution.DeleteReason); Assert.AreEqual("123", execution.ActivityInstanceId); }
protected internal virtual void updateAsyncAfterTargetConfiguration(AsyncContinuationConfiguration currentConfiguration) { ActivityImpl targetActivity = (ActivityImpl)targetScope; IList <PvmTransition> outgoingTransitions = targetActivity.OutgoingTransitions; AsyncContinuationConfiguration targetConfiguration = new AsyncContinuationConfiguration(); if (outgoingTransitions.Count == 0) { targetConfiguration.AtomicOperation = org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.ACTIVITY_END.CanonicalName; } else { targetConfiguration.AtomicOperation = org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation_Fields.TRANSITION_NOTIFY_LISTENER_TAKE.CanonicalName; if (outgoingTransitions.Count == 1) { targetConfiguration.TransitionId = outgoingTransitions[0].Id; } else { TransitionImpl matchingTargetTransition = null; string currentTransitionId = currentConfiguration.TransitionId; if (!string.ReferenceEquals(currentTransitionId, null)) { matchingTargetTransition = targetActivity.findOutgoingTransition(currentTransitionId); } if (matchingTargetTransition != null) { targetConfiguration.TransitionId = matchingTargetTransition.Id; } else { // should not happen since it is avoided by validation throw new ProcessEngineException("Cannot determine matching outgoing sequence flow"); } } } jobEntity.JobHandlerConfiguration = targetConfiguration; }
public virtual void execute(AsyncContinuationConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId) { LegacyBehavior.repairMultiInstanceAsyncJob(execution); PvmAtomicOperation atomicOperation = findMatchingAtomicOperation(configuration.AtomicOperation); ensureNotNull("Cannot process job with configuration " + configuration, "atomicOperation", atomicOperation); // reset transition id. string transitionId = configuration.TransitionId; if (!string.ReferenceEquals(transitionId, null)) { PvmActivity activity = execution.getActivity(); TransitionImpl transition = (TransitionImpl)activity.findOutgoingTransition(transitionId); execution.Transition = transition; } Context.CommandInvocationContext.performOperation(atomicOperation, execution); }
public void ProcessFork(ForkImpl fork, FlowImpl flow, DbSession dbSession) { // First initialize the children of the flow to be forked flow.Children = new ListSet(); DelegationImpl delegation = fork.ForkDelegation; IList <ForkedFlow> forkedFlows = new List <ForkedFlow>(); if (delegation != null) { //delegationHelper.DelegateFork(fork.ForkDelegation, executionContext); } else { // execute the default fork behaviour IEnumerator iter = fork.LeavingTransitions.GetEnumerator(); while (iter.MoveNext()) { TransitionImpl transition = (TransitionImpl)iter.Current; forkedFlows.Add(this.ForkFlow(transition, flow, null)); } } IEnumerator iter2 = forkedFlows.GetEnumerator(); while (iter2.MoveNext()) { ForkedFlow forkedFlow = (ForkedFlow)iter2.Current; } // loop over all flows that were forked in the ForkHandler implementation iter2 = forkedFlows.GetEnumerator(); while (iter2.MoveNext()) { ForkedFlow forkedFlow = (ForkedFlow)iter2.Current; ProcessTransition(forkedFlow.Transition, forkedFlow.Flow, dbSession); } }
private void resolveReferences() { IEnumerator iter = unresolvedReferences.GetEnumerator(); while (iter.MoveNext()) { UnresolvedReference unresolvedReference = (UnresolvedReference)iter.Current; Object referencingObject = unresolvedReference.ReferencingObject; String referenceDestinationName = unresolvedReference.DestinationName; ProcessBlockImpl scope = unresolvedReference.DestinationScope; String property = unresolvedReference.Property; Object referencedObject = FindInScope(unresolvedReference, unresolvedReference.DestinationScope); if (referencedObject == null) { //AddError("failed to deploy process archive : couldn't resolve " + property + "=\"" + referenceDestinationName + "\" from " + referencingObject + " in scope " + scope); } else { if (referencingObject is TransitionImpl) { if (property.Equals("to")) { TransitionImpl transition = (TransitionImpl)referencingObject; transition.To = (NodeImpl)referencedObject; } } if (referencingObject is FieldImpl) { if (property.Equals("attribute")) { FieldImpl field = (FieldImpl)referencingObject; field.Attribute = (AttributeImpl)referencedObject; } } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testExecutionEntitySerialization() throws Exception public virtual void testExecutionEntitySerialization() { ExecutionEntity execution = new ExecutionEntity(); ActivityImpl activityImpl = new ActivityImpl("test", null); activityImpl.ExecutionListeners["start"] = Collections.singletonList <ExecutionListener>(new TestExecutionListener()); execution.setActivity(activityImpl); ProcessDefinitionImpl processDefinitionImpl = new ProcessDefinitionImpl("test"); processDefinitionImpl.ExecutionListeners["start"] = Collections.singletonList <ExecutionListener>(new TestExecutionListener()); execution.setProcessDefinition(processDefinitionImpl); TransitionImpl transitionImpl = new TransitionImpl("test", new ProcessDefinitionImpl("test")); transitionImpl.addExecutionListener(new TestExecutionListener()); execution.Transition = transitionImpl; execution.ProcessInstanceStartContext.Initial = activityImpl; execution.setSuperExecution(new ExecutionEntity()); execution.Active = true; execution.Canceled = false; execution.BusinessKey = "myBusinessKey"; execution.DeleteReason = "no reason"; execution.ActivityInstanceId = "123"; execution.Scope = false; sbyte[] data = writeObject(execution); execution = (ExecutionEntity)readObject(data); assertEquals("myBusinessKey", execution.BusinessKey); assertEquals("no reason", execution.DeleteReason); assertEquals("123", execution.ActivityInstanceId); }
/// <summary> /// Join的Transition To會跳回上一層的ProcessBlock的Node /// </summary> /// <param name="transitionElement"></param> /// <param name="transition"></param> /// <param name="processBlock"></param> private void joinTransition(XmlElement transitionElement, TransitionImpl transition, ProcessBlockImpl processBlock) { this.definitionObject(transitionElement, transition, processBlock); this.addUnresolvedReference(transition, transitionElement.GetProperty("to"), processBlock.ParentBlock, "to", typeof(INode)); }