Search in sources :

Example 1 with MigratingCompensationEventSubscriptionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance in project camunda-bpm-platform by camunda.

the class CompensationInstanceHandler method createMigratingEventSubscriptionInstance.

protected MigratingProcessElementInstance createMigratingEventSubscriptionInstance(MigratingInstanceParseContext parseContext, EventSubscriptionEntity element) {
    ActivityImpl compensationHandler = parseContext.getSourceProcessDefinition().findActivity(element.getActivityId());
    MigrationInstruction migrationInstruction = getMigrationInstruction(parseContext, compensationHandler);
    ActivityImpl targetScope = null;
    if (migrationInstruction != null) {
        ActivityImpl targetEventScope = (ActivityImpl) parseContext.getTargetActivity(migrationInstruction).getEventScope();
        targetScope = targetEventScope.findCompensationHandler();
    }
    MigratingCompensationEventSubscriptionInstance migratingCompensationInstance = parseContext.getMigratingProcessInstance().addCompensationSubscriptionInstance(migrationInstruction, element, compensationHandler, targetScope);
    parseContext.consume(element);
    return migratingCompensationInstance;
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) MigratingCompensationEventSubscriptionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance) MigrationInstruction(org.camunda.bpm.engine.migration.MigrationInstruction)

Example 2 with MigratingCompensationEventSubscriptionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance in project camunda-bpm-platform by camunda.

the class NoUnmappedCompensationStartEventValidator method validate.

@Override
public void validate(MigratingEventScopeInstance migratingInstance, MigratingProcessInstance migratingProcessInstance, MigratingActivityInstanceValidationReportImpl ancestorInstanceReport) {
    MigratingCompensationEventSubscriptionInstance eventSubscription = migratingInstance.getEventSubscription();
    ActivityImpl eventHandlerActivity = (ActivityImpl) eventSubscription.getSourceScope();
    // note: compensation event scopes without children are already handled by NoUnmappedLeafInstanceValidator
    if (eventHandlerActivity.isTriggeredByEvent() && eventSubscription.getTargetScope() == null && !migratingInstance.getChildren().isEmpty()) {
        ancestorInstanceReport.addFailure("Cannot migrate subscription for compensation handler '" + eventSubscription.getSourceScope().getId() + "'. " + "There is no migration instruction for the compensation start event");
    }
}
Also used : MigratingCompensationEventSubscriptionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)

Example 3 with MigratingCompensationEventSubscriptionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance in project camunda-bpm-platform by camunda.

the class MigrateProcessInstanceCmd method validateInstructions.

protected void validateInstructions(CommandContext commandContext, MigratingProcessInstance migratingProcessInstance, MigratingProcessInstanceValidationReportImpl processInstanceReport) {
    List<MigratingActivityInstanceValidator> migratingActivityInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingActivityInstanceValidators();
    List<MigratingTransitionInstanceValidator> migratingTransitionInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingTransitionInstanceValidators();
    List<MigratingCompensationInstanceValidator> migratingCompensationInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingCompensationInstanceValidators();
    Map<MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl> instanceReports = new HashMap<MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl>();
    for (MigratingActivityInstance migratingActivityInstance : migratingProcessInstance.getMigratingActivityInstances()) {
        MigratingActivityInstanceValidationReportImpl instanceReport = validateActivityInstance(migratingActivityInstance, migratingProcessInstance, migratingActivityInstanceValidators);
        instanceReports.put(migratingActivityInstance, instanceReport);
    }
    for (MigratingEventScopeInstance migratingEventScopeInstance : migratingProcessInstance.getMigratingEventScopeInstances()) {
        MigratingActivityInstance ancestorInstance = migratingEventScopeInstance.getClosestAncestorActivityInstance();
        validateEventScopeInstance(migratingEventScopeInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports.get(ancestorInstance));
    }
    for (MigratingCompensationEventSubscriptionInstance migratingEventSubscriptionInstance : migratingProcessInstance.getMigratingCompensationSubscriptionInstances()) {
        MigratingActivityInstance ancestorInstance = migratingEventSubscriptionInstance.getClosestAncestorActivityInstance();
        validateCompensateSubscriptionInstance(migratingEventSubscriptionInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports.get(ancestorInstance));
    }
    for (MigratingActivityInstanceValidationReportImpl instanceReport : instanceReports.values()) {
        if (instanceReport.hasFailures()) {
            processInstanceReport.addActivityInstanceReport(instanceReport);
        }
    }
    for (MigratingTransitionInstance migratingTransitionInstance : migratingProcessInstance.getMigratingTransitionInstances()) {
        MigratingTransitionInstanceValidationReportImpl instanceReport = validateTransitionInstance(migratingTransitionInstance, migratingProcessInstance, migratingTransitionInstanceValidators);
        if (instanceReport.hasFailures()) {
            processInstanceReport.addTransitionInstanceReport(instanceReport);
        }
    }
}
Also used : MigratingTransitionInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidator) MigratingCompensationEventSubscriptionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance) MigratingActivityInstanceValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidationReportImpl) HashMap(java.util.HashMap) MigratingActivityInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance) MigratingEventScopeInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance) MigratingTransitionInstanceValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidationReportImpl) MigratingTransitionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance) MigratingCompensationInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingCompensationInstanceValidator) MigratingActivityInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidator)

Aggregations

MigratingCompensationEventSubscriptionInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance)3 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)2 HashMap (java.util.HashMap)1 MigratingActivityInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance)1 MigratingEventScopeInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance)1 MigratingTransitionInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance)1 MigratingActivityInstanceValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidationReportImpl)1 MigratingActivityInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidator)1 MigratingCompensationInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingCompensationInstanceValidator)1 MigratingTransitionInstanceValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidationReportImpl)1 MigratingTransitionInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidator)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1