protected internal virtual void ValidateMigrationPlan(CommandContext commandContext,
                                                              MigrationPlanImpl migrationPlan, ProcessDefinitionImpl sourceProcessDefinition,
                                                              ProcessDefinitionImpl targetProcessDefinition)
        {
            var migrationInstructionValidators =
                commandContext.ProcessEngineConfiguration.MigrationInstructionValidators;

            var planReport = new MigrationPlanValidationReportImpl(migrationPlan);
            var validatingMigrationInstructions = WrapMigrationInstructions(migrationPlan, sourceProcessDefinition,
                                                                            targetProcessDefinition, planReport);

            foreach (var validatingMigrationInstruction in validatingMigrationInstructions.Instructions)
            {
                var instructionReport = ValidateInstruction(validatingMigrationInstruction,
                                                            validatingMigrationInstructions, migrationInstructionValidators);
                if (instructionReport.HasFailures())
                {
                    planReport.AddInstructionReport(instructionReport);
                }
            }

            if (planReport.HasInstructionReports())
            {
                throw Log.FailingMigrationPlanValidation(planReport);
            }
        }
Exemple #2
0
        public virtual MigrationPlan execute(CommandContext commandContext)
        {
            ProcessDefinitionEntity sourceProcessDefinition = getProcessDefinition(commandContext, migrationBuilder.SourceProcessDefinitionId, "Source");
            ProcessDefinitionEntity targetProcessDefinition = getProcessDefinition(commandContext, migrationBuilder.TargetProcessDefinitionId, "Target");

            checkAuthorization(commandContext, sourceProcessDefinition, targetProcessDefinition);

            MigrationPlanImpl            migrationPlan = new MigrationPlanImpl(sourceProcessDefinition.Id, targetProcessDefinition.Id);
            IList <MigrationInstruction> instructions  = new List <MigrationInstruction>();

            if (migrationBuilder.MapEqualActivities)
            {
                ((IList <MigrationInstruction>)instructions).AddRange(generateInstructions(commandContext, sourceProcessDefinition, targetProcessDefinition, migrationBuilder.UpdateEventTriggersForGeneratedInstructions));
            }

            ((IList <MigrationInstruction>)instructions).AddRange(migrationBuilder.ExplicitMigrationInstructions);
            migrationPlan.Instructions = instructions;

            validateMigrationPlan(commandContext, migrationPlan, sourceProcessDefinition, targetProcessDefinition);

            return(migrationPlan);
        }
        public virtual IMigrationPlan Execute(CommandContext commandContext)
        {
            var sourceProcessDefinition = GetProcessDefinition(commandContext,
                                                               MigrationBuilder.SourceProcessDefinitionId, "Source");
            var targetProcessDefinition = GetProcessDefinition(commandContext,
                                                               MigrationBuilder.TargetProcessDefinitionId, "Target");

            CheckAuthorization(commandContext, sourceProcessDefinition, targetProcessDefinition);

            var migrationPlan = new MigrationPlanImpl(sourceProcessDefinition.Id, targetProcessDefinition.Id);
            IList <IMigrationInstruction> instructions = new List <IMigrationInstruction>();

            if (MigrationBuilder.MapEqualActivitiesRenamed)
            {
                ((List <IMigrationInstruction>)instructions).AddRange(GenerateInstructions(commandContext, sourceProcessDefinition, targetProcessDefinition, MigrationBuilder.UpdateEventTriggersForGeneratedInstructions));
            }

            ((List <IMigrationInstruction>)instructions).AddRange(MigrationBuilder.ExplicitMigrationInstructions);
            migrationPlan.Instructions = instructions;

            ValidateMigrationPlan(commandContext, migrationPlan, (ProcessDefinitionImpl)sourceProcessDefinition, targetProcessDefinition);

            return(migrationPlan);
        }
Exemple #4
0
        protected internal virtual void validateMigrationPlan(CommandContext commandContext, MigrationPlanImpl migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition)
        {
            IList <MigrationInstructionValidator> migrationInstructionValidators = commandContext.ProcessEngineConfiguration.MigrationInstructionValidators;

            MigrationPlanValidationReportImpl planReport = new MigrationPlanValidationReportImpl(migrationPlan);
            ValidatingMigrationInstructions   validatingMigrationInstructions = wrapMigrationInstructions(migrationPlan, sourceProcessDefinition, targetProcessDefinition, planReport);

            foreach (ValidatingMigrationInstruction validatingMigrationInstruction in validatingMigrationInstructions.Instructions)
            {
                MigrationInstructionValidationReportImpl instructionReport = validateInstruction(validatingMigrationInstruction, validatingMigrationInstructions, migrationInstructionValidators);
                if (instructionReport.hasFailures())
                {
                    planReport.addInstructionReport(instructionReport);
                }
            }

            if (planReport.hasInstructionReports())
            {
                throw LOG.failingMigrationPlanValidation(planReport);
            }
        }