예제 #1
0
        public virtual MigratingProcessInstance parse(string processInstanceId, MigrationPlan migrationPlan, MigratingProcessInstanceValidationReportImpl processInstanceReport)
        {
            CommandContext commandContext = Context.CommandContext;
            IList <EventSubscriptionEntity> eventSubscriptions = fetchEventSubscriptions(commandContext, processInstanceId);
            IList <ExecutionEntity>         executions         = fetchExecutions(commandContext, processInstanceId);
            IList <ExternalTaskEntity>      externalTasks      = fetchExternalTasks(commandContext, processInstanceId);
            IList <IncidentEntity>          incidents          = fetchIncidents(commandContext, processInstanceId);
            IList <JobEntity>              jobs      = fetchJobs(commandContext, processInstanceId);
            IList <TaskEntity>             tasks     = fetchTasks(commandContext, processInstanceId);
            IList <VariableInstanceEntity> variables = fetchVariables(commandContext, processInstanceId);

            ExecutionEntity processInstance = commandContext.ExecutionManager.findExecutionById(processInstanceId);

            processInstance.restoreProcessInstance(executions, eventSubscriptions, variables, tasks, jobs, incidents, externalTasks);

            ProcessDefinitionEntity     targetProcessDefinition = Context.ProcessEngineConfiguration.DeploymentCache.findDeployedProcessDefinitionById(migrationPlan.TargetProcessDefinitionId);
            IList <JobDefinitionEntity> targetJobDefinitions    = fetchJobDefinitions(commandContext, targetProcessDefinition.Id);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final MigratingInstanceParseContext parseContext = new MigratingInstanceParseContext(this, migrationPlan, processInstance, targetProcessDefinition).eventSubscriptions(eventSubscriptions).externalTasks(externalTasks).incidents(incidents).jobs(jobs).tasks(tasks).targetJobDefinitions(targetJobDefinitions).variables(variables);
            MigratingInstanceParseContext parseContext = (new MigratingInstanceParseContext(this, migrationPlan, processInstance, targetProcessDefinition)).eventSubscriptions(eventSubscriptions).externalTasks(externalTasks).incidents(incidents).jobs(jobs).tasks(tasks).targetJobDefinitions(targetJobDefinitions).variables(variables);

            ActivityInstance activityInstance = engine.RuntimeService.getActivityInstance(processInstanceId);

            ActivityInstanceWalker activityInstanceWalker = new ActivityInstanceWalker(activityInstance);

            activityInstanceWalker.addPreVisitor(new TreeVisitorAnonymousInnerClass(this, parseContext));

            activityInstanceWalker.walkWhile();

            CompensationEventSubscriptionWalker compensateSubscriptionsWalker = new CompensationEventSubscriptionWalker(parseContext.MigratingActivityInstances);

            compensateSubscriptionsWalker.addPreVisitor(new TreeVisitorAnonymousInnerClass2(this, parseContext));

            compensateSubscriptionsWalker.walkWhile();

            foreach (IncidentEntity incidentEntity in incidents)
            {
                incidentHandler.handle(parseContext, incidentEntity);
            }

            parseContext.validateNoEntitiesLeft(processInstanceReport);

            return(parseContext.MigratingProcessInstance);
        }