use of org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration in project camunda-bpm-platform by camunda.
the class MigratingAsyncJobInstance method updateAsyncBeforeTargetConfiguration.
protected void updateAsyncBeforeTargetConfiguration() {
AsyncContinuationConfiguration targetConfiguration = new AsyncContinuationConfiguration();
AsyncContinuationConfiguration currentConfiguration = (AsyncContinuationConfiguration) jobEntity.getJobHandlerConfiguration();
if (PvmAtomicOperation.PROCESS_START.getCanonicalName().equals(currentConfiguration.getAtomicOperation())) {
// process start always stays process start
targetConfiguration.setAtomicOperation(PvmAtomicOperation.PROCESS_START.getCanonicalName());
} else {
if (((ActivityImpl) targetScope).getIncomingTransitions().isEmpty()) {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.ACTIVITY_START_CREATE_SCOPE.getCanonicalName());
} else {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.TRANSITION_CREATE_SCOPE.getCanonicalName());
}
}
jobEntity.setJobHandlerConfiguration(targetConfiguration);
}
use of org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration in project camunda-bpm-platform by camunda.
the class AsyncAfterMigrationValidator method validate.
@Override
public void validate(MigratingTransitionInstance migratingInstance, MigratingProcessInstance migratingProcessInstance, MigratingTransitionInstanceValidationReportImpl instanceReport) {
ActivityImpl targetActivity = (ActivityImpl) migratingInstance.getTargetScope();
if (targetActivity != null && migratingInstance.isAsyncAfter()) {
MigratingJobInstance jobInstance = migratingInstance.getJobInstance();
AsyncContinuationConfiguration config = (AsyncContinuationConfiguration) jobInstance.getJobEntity().getJobHandlerConfiguration();
String sourceTransitionId = config.getTransitionId();
if (targetActivity.getOutgoingTransitions().size() > 1) {
if (sourceTransitionId == null) {
instanceReport.addFailure("Transition instance is assigned to no sequence flow" + " and target activity has more than one outgoing sequence flow");
} else {
TransitionImpl matchingOutgoingTransition = targetActivity.findOutgoingTransition(sourceTransitionId);
if (matchingOutgoingTransition == null) {
instanceReport.addFailure("Transition instance is assigned to a sequence flow" + " that cannot be matched in the target activity");
}
}
}
}
}
use of org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration in project camunda-bpm-platform by camunda.
the class MigratingAsyncJobInstance method updateAsyncAfterTargetConfiguration.
protected void updateAsyncAfterTargetConfiguration(AsyncContinuationConfiguration currentConfiguration) {
ActivityImpl targetActivity = (ActivityImpl) targetScope;
List<PvmTransition> outgoingTransitions = targetActivity.getOutgoingTransitions();
AsyncContinuationConfiguration targetConfiguration = new AsyncContinuationConfiguration();
if (outgoingTransitions.isEmpty()) {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.ACTIVITY_END.getCanonicalName());
} else {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.TRANSITION_NOTIFY_LISTENER_TAKE.getCanonicalName());
if (outgoingTransitions.size() == 1) {
targetConfiguration.setTransitionId(outgoingTransitions.get(0).getId());
} else {
TransitionImpl matchingTargetTransition = null;
String currentTransitionId = currentConfiguration.getTransitionId();
if (currentTransitionId != null) {
matchingTargetTransition = targetActivity.findOutgoingTransition(currentTransitionId);
}
if (matchingTargetTransition != null) {
targetConfiguration.setTransitionId(matchingTargetTransition.getId());
} else {
// should not happen since it is avoided by validation
throw new ProcessEngineException("Cannot determine matching outgoing sequence flow");
}
}
}
jobEntity.setJobHandlerConfiguration(targetConfiguration);
}
use of org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration in project camunda-bpm-platform by camunda.
the class AsyncContinuationJobHandler method newConfiguration.
@Override
public AsyncContinuationConfiguration newConfiguration(String canonicalString) {
String[] configParts = tokenizeJobConfiguration(canonicalString);
AsyncContinuationConfiguration configuration = new AsyncContinuationConfiguration();
configuration.setAtomicOperation(configParts[0]);
configuration.setTransitionId(configParts[1]);
return configuration;
}
use of org.camunda.bpm.engine.impl.jobexecutor.AsyncContinuationJobHandler.AsyncContinuationConfiguration in project camunda-bpm-platform by camunda.
the class MessageJobDeclaration method resolveJobHandlerConfiguration.
@Override
protected JobHandlerConfiguration resolveJobHandlerConfiguration(AtomicOperationInvocation context) {
AsyncContinuationConfiguration configuration = new AsyncContinuationConfiguration();
configuration.setAtomicOperation(context.getOperation().getCanonicalName());
ExecutionEntity execution = context.getExecution();
PvmActivity activity = execution.getActivity();
if (activity != null && activity.isAsyncAfter()) {
if (execution.getTransition() != null) {
// store id of selected transition in case this is async after.
// id is not serialized with the execution -> we need to remember it as
// job handler configuration.
configuration.setTransitionId(execution.getTransition().getId());
}
}
return configuration;
}
Aggregations