Exemplo n.º 1
0
        public virtual ProcessStateImpl CreateProcessState()
        {
            ProcessStateImpl processState = new ProcessStateImpl(_processDefinition);

            AddNode(processState);
            return(processState);
        }
Exemplo n.º 2
0
        public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
        {
            this._nodes       = new ListSet();
            this._attributes  = new ListSet();
            this._childBlocks = new ListSet();

            base.ReadProcessData(xmlElement, creationContext);

            IEnumerator iter = xmlElement.GetChildElements("attribute").GetEnumerator();

            while (iter.MoveNext())
            {
                AttributeImpl attribute = new AttributeImpl();
                attribute.ReadProcessData((XmlElement)iter.Current, creationContext);
                _attributes.Add(attribute);
            }

            iter = xmlElement.GetChildElements("activity-state").GetEnumerator();
            while (iter.MoveNext())
            {
                ActivityStateImpl activityState = new ActivityStateImpl();
                activityState.ReadProcessData((XmlElement)iter.Current, creationContext);
                _nodes.Add(activityState);
            }

            iter = xmlElement.GetChildElements("process-state").GetEnumerator();
            while (iter.MoveNext())
            {
                ProcessStateImpl processState = new ProcessStateImpl();
                processState.ReadProcessData((XmlElement)iter.Current, creationContext);
                _nodes.Add(processState);
            }

            iter = xmlElement.GetChildElements("decision").GetEnumerator();
            while (iter.MoveNext())
            {
                DecisionImpl decision = new DecisionImpl();
                decision.ReadProcessData((XmlElement)iter.Current, creationContext);
                _nodes.Add(decision);
            }

            iter = xmlElement.GetChildElements("concurrent-block").GetEnumerator();
            while (iter.MoveNext())
            {
                ConcurrentBlockImpl concurrentBlock = new ConcurrentBlockImpl();
                concurrentBlock.ReadProcessData((XmlElement)iter.Current, creationContext);
                _childBlocks.Add(concurrentBlock);
            }
        }
Exemplo n.º 3
0
		public override void ReadProcessData(XmlElement xmlElement, ProcessDefinitionBuildContext creationContext)
		{
			this._nodes = new ListSet();
			this._attributes = new ListSet();
			this._childBlocks = new ListSet();

			base.ReadProcessData(xmlElement, creationContext);

			IEnumerator iter = xmlElement.GetChildElements("attribute").GetEnumerator();
			while (iter.MoveNext())
			{
				AttributeImpl attribute = new AttributeImpl();
				attribute.ReadProcessData((XmlElement) iter.Current, creationContext);
				_attributes.Add(attribute);
			}

			iter = xmlElement.GetChildElements("activity-state").GetEnumerator();
			while (iter.MoveNext())
			{
				ActivityStateImpl activityState = new ActivityStateImpl();
				activityState.ReadProcessData((XmlElement) iter.Current, creationContext);
				_nodes.Add(activityState);
			}

			iter = xmlElement.GetChildElements("process-state").GetEnumerator();
			while (iter.MoveNext())
			{
				ProcessStateImpl processState = new ProcessStateImpl();
				processState.ReadProcessData((XmlElement) iter.Current, creationContext);
				_nodes.Add(processState);
			}

			iter = xmlElement.GetChildElements("decision").GetEnumerator();
			while (iter.MoveNext())
			{
				DecisionImpl decision = new DecisionImpl();
				decision.ReadProcessData((XmlElement) iter.Current, creationContext);
				_nodes.Add(decision);
			}

			iter = xmlElement.GetChildElements("concurrent-block").GetEnumerator();
			while (iter.MoveNext())
			{
				ConcurrentBlockImpl concurrentBlock = new ConcurrentBlockImpl();
				concurrentBlock.ReadProcessData((XmlElement) iter.Current, creationContext);
				_childBlocks.Add(concurrentBlock);
			}
		}
Exemplo n.º 4
0
        public virtual ProcessStateImpl CreateProcessState()
		{
			ProcessStateImpl processState = new ProcessStateImpl(_processDefinition);
			AddNode(processState);
			return processState;
		}
Exemplo n.º 5
0
        public void ProcessProcessState(ProcessStateImpl processState, ExecutionContextImpl executionContext,DbSession dbSession)
        {
            // TODO : try to group similarities between this method and ExecutionComponentImpl.startProcessInstance and
            //        group them in a common method

            // provide a convenient local var for the database session
            //DbSession dbSession = executionContext.DbSession;

            // get the sub-process-definition and its start-state
            ProcessDefinitionImpl subProcessDefinition = (ProcessDefinitionImpl) processState.SubProcess;
            StartStateImpl startState = (StartStateImpl) subProcessDefinition.StartState;

            log.Info("processState '" + processState.Name + "' starts an instance of process '" + subProcessDefinition.Name + "'...");

            // get the actor that is supposed to start this process instance
            IActor subProcessStarter = actorExpressionResolver.ResolveArgument(processState.ActorExpression, executionContext);
            String subProcessStarterId = subProcessStarter.Id;

            // create the process-instance
            ProcessInstanceImpl subProcessInstance = new ProcessInstanceImpl(subProcessStarterId, subProcessDefinition);
            FlowImpl rootFlow = (FlowImpl) subProcessInstance.RootFlow;

            // attach the subProcesInstance to the parentFlow
            FlowImpl superProcessFlow = (FlowImpl) executionContext.GetFlow();
            superProcessFlow.SetSubProcessInstance(subProcessInstance);
            subProcessInstance.SuperProcessFlow = superProcessFlow;

            // create the execution context for the sub-process
            ExecutionContextImpl subExecutionContext = new ExecutionContextImpl(subProcessStarterId, rootFlow, dbSession, executionContext.GetOrganisationComponent());

            // save the process instance to allow hibernate queries
            dbSession.Save(subProcessInstance);

            // add the log
            executionContext.CreateLog(EventType.SUB_PROCESS_INSTANCE_START);
            executionContext.AddLogDetail(new ObjectReferenceImpl(subProcessInstance));

            // delegate the attributeValues
            Object[] processInvocationData = delegationHelper.DelegateProcessInvocation(processState.ProcessInvokerDelegation, subExecutionContext);
            String transitionName = (String) processInvocationData[0];
            IDictionary attributeValues = (IDictionary) processInvocationData[1];

            // store the attributes
            subExecutionContext.CreateLog(subProcessStarterId, EventType.PROCESS_INSTANCE_START);
            subExecutionContext.StoreAttributeValues(attributeValues);
            subExecutionContext.StoreRole(subProcessStarterId, startState);

            // log event & trigger actions
            delegationService.RunActionsForEvent(EventType.SUB_PROCESS_INSTANCE_START, processState.Id, subExecutionContext,dbSession);
            delegationService.RunActionsForEvent(EventType.PROCESS_INSTANCE_START, subProcessDefinition.Id, subExecutionContext,dbSession);

            // from here on, we consider the actor as being the previous actor
            subExecutionContext.SetActorAsPrevious();

            // process the start-transition
            TransitionImpl startTransition = transitionRepository.GetTransition(transitionName, startState, dbSession);
            ProcessTransition(startTransition, subExecutionContext,dbSession);

            // add the assigned flows of the subContext to the parentContext
            executionContext.AssignedFlows.AddRange(subExecutionContext.AssignedFlows);

            // flush the updates to the db
            dbSession.Update(subProcessInstance);
            dbSession.Flush();
        }