Search in sources :

Example 1 with ValidatingMigrationInstruction

use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.

the class CreateMigrationPlanCmd method validateMigrationPlan.

protected void validateMigrationPlan(CommandContext commandContext, MigrationPlanImpl migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition) {
    List<MigrationInstructionValidator> migrationInstructionValidators = commandContext.getProcessEngineConfiguration().getMigrationInstructionValidators();
    MigrationPlanValidationReportImpl planReport = new MigrationPlanValidationReportImpl(migrationPlan);
    ValidatingMigrationInstructions validatingMigrationInstructions = wrapMigrationInstructions(migrationPlan, sourceProcessDefinition, targetProcessDefinition, planReport);
    for (ValidatingMigrationInstruction validatingMigrationInstruction : validatingMigrationInstructions.getInstructions()) {
        MigrationInstructionValidationReportImpl instructionReport = validateInstruction(validatingMigrationInstruction, validatingMigrationInstructions, migrationInstructionValidators);
        if (instructionReport.hasFailures()) {
            planReport.addInstructionReport(instructionReport);
        }
    }
    if (planReport.hasInstructionReports()) {
        throw LOG.failingMigrationPlanValidation(planReport);
    }
}
Also used : MigrationInstructionValidator(org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidator) MigrationInstructionValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidationReportImpl) ValidatingMigrationInstructions(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstructions) MigrationPlanValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationPlanValidationReportImpl) ValidatingMigrationInstruction(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction)

Example 2 with ValidatingMigrationInstruction

use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.

the class DefaultMigrationInstructionGenerator method generate.

public void generate(ScopeImpl sourceScope, ScopeImpl targetScope, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, ValidatingMigrationInstructions existingInstructions, boolean updateEventTriggers) {
    List<ValidatingMigrationInstruction> flowScopeInstructions = generateInstructionsForActivities(sourceScope.getActivities(), targetScope.getActivities(), updateEventTriggers, existingInstructions);
    existingInstructions.addAll(flowScopeInstructions);
    List<ValidatingMigrationInstruction> eventScopeInstructions = generateInstructionsForActivities(sourceScope.getEventActivities(), targetScope.getEventActivities(), updateEventTriggers, existingInstructions);
    existingInstructions.addAll(eventScopeInstructions);
    existingInstructions.filterWith(migrationInstructionValidators);
    for (ValidatingMigrationInstruction generatedInstruction : flowScopeInstructions) {
        if (existingInstructions.contains(generatedInstruction)) {
            generate(generatedInstruction.getSourceActivity(), generatedInstruction.getTargetActivity(), sourceProcessDefinition, targetProcessDefinition, existingInstructions, updateEventTriggers);
        }
    }
}
Also used : ValidatingMigrationInstruction(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction)

Example 3 with ValidatingMigrationInstruction

use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.

the class DefaultMigrationInstructionGenerator method generateInstructionsForActivities.

protected List<ValidatingMigrationInstruction> generateInstructionsForActivities(Collection<ActivityImpl> sourceActivities, Collection<ActivityImpl> targetActivities, boolean updateEventTriggers, ValidatingMigrationInstructions existingInstructions) {
    List<ValidatingMigrationInstruction> generatedInstructions = new ArrayList<ValidatingMigrationInstruction>();
    for (ActivityImpl sourceActivity : sourceActivities) {
        if (!existingInstructions.containsInstructionForSourceScope(sourceActivity)) {
            for (ActivityImpl targetActivity : targetActivities) {
                if (isValidActivity(sourceActivity) && isValidActivity(targetActivity) && migrationActivityMatcher.matchActivities(sourceActivity, targetActivity)) {
                    // for conditional events the update event trigger must be set
                    boolean updateEventTriggersForInstruction = sourceActivity.getActivityBehavior() instanceof ConditionalEventBehavior || updateEventTriggers && UpdateEventTriggersValidator.definesPersistentEventTrigger(sourceActivity);
                    ValidatingMigrationInstruction generatedInstruction = new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, updateEventTriggersForInstruction);
                    generatedInstructions.add(generatedInstruction);
                }
            }
        }
    }
    return generatedInstructions;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ValidatingMigrationInstructionImpl(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstructionImpl) ArrayList(java.util.ArrayList) ConditionalEventBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior) ValidatingMigrationInstruction(org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction)

Aggregations

ValidatingMigrationInstruction (org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction)3 ArrayList (java.util.ArrayList)1 ConditionalEventBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.ConditionalEventBehavior)1 MigrationInstructionValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidationReportImpl)1 MigrationInstructionValidator (org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidator)1 MigrationPlanValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationPlanValidationReportImpl)1 ValidatingMigrationInstructionImpl (org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstructionImpl)1 ValidatingMigrationInstructions (org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstructions)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1