use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class SameEventScopeInstructionValidator method validate.
public void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl sourceActivity = instruction.getSourceActivity();
if (isCompensationBoundaryEvent(sourceActivity)) {
// event scopes need not be active at runtime
return;
}
ScopeImpl sourceEventScope = instruction.getSourceActivity().getEventScope();
ScopeImpl targetEventScope = instruction.getTargetActivity().getEventScope();
if (sourceEventScope == null || sourceEventScope == sourceActivity.getFlowScope()) {
// => validation not necessary for event subprocesses
return;
}
if (targetEventScope == null) {
report.addFailure("The source activity's event scope (" + sourceEventScope.getId() + ") must be mapped but the " + "target activity has no event scope");
} else {
ScopeImpl mappedSourceEventScope = findMappedEventScope(sourceEventScope, instruction, instructions);
if (mappedSourceEventScope == null || !mappedSourceEventScope.getId().equals(targetEventScope.getId())) {
report.addFailure("The source activity's event scope (" + sourceEventScope.getId() + ") " + "must be mapped to the target activity's event scope (" + targetEventScope.getId() + ")");
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class SameEventTypeValidator method validate.
@Override
public void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl sourceActivity = instruction.getSourceActivity();
ActivityImpl targetActivity = instruction.getTargetActivity();
if (isEvent(sourceActivity) && isEvent(targetActivity)) {
String sourceType = sourceActivity.getProperties().get(BpmnProperties.TYPE);
String targetType = targetActivity.getProperties().get(BpmnProperties.TYPE);
if (!sourceType.equals(targetType)) {
report.addFailure("Events are not of the same type (" + sourceType + " != " + targetType + ")");
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl 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");
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseCompensationHandlerOfMiActivity.
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.compensationMiActivity.bpmn20.xml")
public void testParseCompensationHandlerOfMiActivity() {
ActivityImpl miActivity = findActivityInDeployedProcessDefinition("undoBookHotel");
ScopeImpl flowScope = miActivity.getFlowScope();
assertEquals(ActivityTypes.MULTI_INSTANCE_BODY, flowScope.getProperty(BpmnParse.PROPERTYNAME_TYPE));
assertEquals("bookHotel" + BpmnParse.MULTI_INSTANCE_BODY_ID_SUFFIX, ((ActivityImpl) flowScope).getActivityId());
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseCompensationHandlerOfMiSubprocess.
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.compensationMiSubprocess.bpmn20.xml")
public void testParseCompensationHandlerOfMiSubprocess() {
ActivityImpl miActivity = findActivityInDeployedProcessDefinition("undoBookHotel");
ScopeImpl flowScope = miActivity.getFlowScope();
assertEquals(ActivityTypes.MULTI_INSTANCE_BODY, flowScope.getProperty(BpmnParse.PROPERTYNAME_TYPE));
assertEquals("scope" + BpmnParse.MULTI_INSTANCE_BODY_ID_SUFFIX, ((ActivityImpl) flowScope).getActivityId());
}
Aggregations