public virtual MigratingProcessInstanceValidationException FailingMigratingProcessInstanceValidation( MigratingProcessInstanceValidationReportImpl validationReport) { var sb = new StringBuilder(); validationReport.WriteTo(sb); return(new MigratingProcessInstanceValidationException(ExceptionMessage("004", "{}", sb.ToString()), validationReport)); }
protected internal virtual void ValidateInstructions(CommandContext commandContext, MigratingProcessInstance migratingProcessInstance, MigratingProcessInstanceValidationReportImpl processInstanceReport) { var migratingActivityInstanceValidators = commandContext.ProcessEngineConfiguration.MigratingActivityInstanceValidators; var migratingTransitionInstanceValidators = commandContext.ProcessEngineConfiguration.MigratingTransitionInstanceValidators; var migratingCompensationInstanceValidators = commandContext.ProcessEngineConfiguration.MigratingCompensationInstanceValidators; IDictionary <MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl> instanceReports = new Dictionary <MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl>(); foreach (var migratingActivityInstance in migratingProcessInstance.MigratingActivityInstances) { var instanceReport = ValidateActivityInstance(migratingActivityInstance, migratingProcessInstance, migratingActivityInstanceValidators); instanceReports[migratingActivityInstance] = instanceReport; } foreach (var migratingEventScopeInstance in migratingProcessInstance.MigratingEventScopeInstances) { var ancestorInstance = migratingEventScopeInstance.ClosestAncestorActivityInstance; ValidateEventScopeInstance(migratingEventScopeInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports[ancestorInstance]); } foreach ( var migratingEventSubscriptionInstance in migratingProcessInstance.MigratingCompensationSubscriptionInstances) { var ancestorInstance = migratingEventSubscriptionInstance.ClosestAncestorActivityInstance; ValidateCompensateSubscriptionInstance(migratingEventSubscriptionInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports[ancestorInstance]); } foreach (var instanceReport in instanceReports.Values) { if (instanceReport.HasFailures()) { processInstanceReport.AddActivityInstanceReport(instanceReport); } } foreach (var migratingTransitionInstance in migratingProcessInstance.MigratingTransitionInstances) { var instanceReport = ValidateTransitionInstance(migratingTransitionInstance, migratingProcessInstance, migratingTransitionInstanceValidators); if (instanceReport.HasFailures()) { processInstanceReport.AddTransitionInstanceReport(instanceReport); } } }
public virtual void EnsureNoEntitiesAreLeft <T1>(string entityName, ICollection <T1> dbEntities, MigratingProcessInstanceValidationReportImpl processInstanceReport) where T1 : IDbEntity { if (dbEntities.Count > 0) { throw new NotImplementedException(); //processInstanceReport.AddFailure("Process instance contains not migrated " + entityName + ": [" +StringUtil.JoinDbEntityIds(dbEntities) + "]"); } }
public virtual void validateNoEntitiesLeft(MigratingProcessInstanceValidationReportImpl processInstanceReport) { processInstanceReport.ProcessInstanceId = migratingProcessInstance.ProcessInstanceId; ensureNoEntitiesAreLeft("tasks", tasks_Renamed, processInstanceReport); ensureNoEntitiesAreLeft("externalTask", externalTasks_Renamed, processInstanceReport); ensureNoEntitiesAreLeft("incidents", incidents_Renamed, processInstanceReport); ensureNoEntitiesAreLeft("jobs", jobs_Renamed, processInstanceReport); ensureNoEntitiesAreLeft("event subscriptions", eventSubscriptions_Renamed, processInstanceReport); ensureNoEntitiesAreLeft("variables", variables_Renamed, processInstanceReport); }
public virtual void ValidateNoEntitiesLeft(MigratingProcessInstanceValidationReportImpl processInstanceReport) { processInstanceReport.ProcessInstanceId = migratingProcessInstance.ProcessInstanceId; EnsureNoEntitiesAreLeft("tasks", TasksRenamed, processInstanceReport); EnsureNoEntitiesAreLeft("externalTask", ExternalTasksRenamed, processInstanceReport); EnsureNoEntitiesAreLeft("incidents", IncidentsRenamed, processInstanceReport); EnsureNoEntitiesAreLeft("jobs", JobsRenamed, processInstanceReport); EnsureNoEntitiesAreLeft("event subscriptions", EventSubscriptionsRenamed, processInstanceReport); EnsureNoEntitiesAreLeft("variables", VariablesRenamed, processInstanceReport); }
public virtual MigratingProcessInstance Parse(string processInstanceId, IMigrationPlan migrationPlan, MigratingProcessInstanceValidationReportImpl processInstanceReport) { var commandContext = Context.CommandContext; var eventSubscriptions = FetchEventSubscriptions(commandContext, processInstanceId); var executions = FetchExecutions(commandContext, processInstanceId); var externalTasks = FetchExternalTasks(commandContext, processInstanceId); var incidents = FetchIncidents(commandContext, processInstanceId); var jobs = FetchJobs(commandContext, processInstanceId); var tasks = FetchTasks(commandContext, processInstanceId); var 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); var activityInstance = Engine.RuntimeService.GetActivityInstance(processInstanceId); var 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; return(null); }
public virtual Void migrateProcessInstance(CommandContext commandContext, string processInstanceId, MigrationPlan migrationPlan, ProcessDefinitionEntity targetProcessDefinition) { ensureNotNull(typeof(BadUserRequestException), "Process instance id cannot be null", "process instance id", processInstanceId); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId); ExecutionEntity processInstance = commandContext.ExecutionManager.findExecutionById(processInstanceId); ensureProcessInstanceExist(processInstanceId, processInstance); ensureOperationAllowed(commandContext, processInstance, targetProcessDefinition); ensureSameProcessDefinition(processInstance, migrationPlan.SourceProcessDefinitionId); MigratingProcessInstanceValidationReportImpl processInstanceReport = new MigratingProcessInstanceValidationReportImpl(); // Initialize migration: match migration instructions to activity instances and collect required entities MigratingInstanceParser migratingInstanceParser = new MigratingInstanceParser(Context.ProcessEngineConfiguration.ProcessEngine); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.migration.instance.MigratingProcessInstance migratingProcessInstance = migratingInstanceParser.parse(processInstance.getId(), migrationPlan, processInstanceReport); MigratingProcessInstance migratingProcessInstance = migratingInstanceParser.parse(processInstance.Id, migrationPlan, processInstanceReport); validateInstructions(commandContext, migratingProcessInstance, processInstanceReport); if (processInstanceReport.hasFailures()) { throw LOGGER.failingMigratingProcessInstanceValidation(processInstanceReport); } executeInContext(() => { deleteUnmappedActivityInstances(migratingProcessInstance); }, migratingProcessInstance.SourceDefinition); executeInContext(() => { migrateProcessInstance(migratingProcessInstance); }, migratingProcessInstance.TargetDefinition); return(null); }
public virtual void ensureNoEntitiesAreLeft <T1>(string entityName, ICollection <T1> dbEntities, MigratingProcessInstanceValidationReportImpl processInstanceReport) where T1 : org.camunda.bpm.engine.impl.db.DbEntity { if (dbEntities.Count > 0) { processInstanceReport.addFailure("Process instance contains not migrated " + entityName + ": [" + StringUtil.joinDbEntityIds(dbEntities) + "]"); } }