if (pi.getInternalId() == null) {
pi.setInternalId(context.getScopeInstance().getExecution().getProcessInstance().getId());
dao.saveProcessInstance(pi);
}
final ProcessToolProcessStep stepInstance = ctx.getRegistry().getStep(stepName);
if (stepInstance == null) {
throw new IllegalArgumentException("No step defined by name: " + stepName);
}
String res;
try {
PropertyAutoWiring.autowire(stepInstance, params);
final BpmStep step = prepareStep(pi);
res = watch.watchTask("actual step execution", new Callable<String>() {
@Override
public String call() throws Exception {
return stepInstance.invoke(step, params);
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}