use of org.activiti.crystalball.simulator.delegate.AbstractSimulationActivityBehavior in project Activiti by Activiti.
the class SimulatorParserUtils method setSimulationBehavior.
static void setSimulationBehavior(ScopeImpl scope, BaseElement baseElement) {
String behaviorClassName = getBehaviorClassName(baseElement);
if (behaviorClassName != null) {
ProcessDefinitionImpl processDefinition = scope.getProcessDefinition();
ActivityImpl activity = processDefinition.findActivity(baseElement.getId());
LOG.debug("Scripting task [" + activity.getId() + "] setting behavior to [" + behaviorClassName + "]");
try {
@SuppressWarnings("unchecked") Class<AbstractSimulationActivityBehavior> behaviorClass = (Class<AbstractSimulationActivityBehavior>) Class.forName(behaviorClassName);
Constructor<AbstractSimulationActivityBehavior> constructor = behaviorClass.getDeclaredConstructor(ScopeImpl.class, ActivityImpl.class);
activity.setActivityBehavior(constructor.newInstance(scope, activity));
} catch (Throwable t) {
LOG.error("unable to set simulation behavior class[" + behaviorClassName + "]", t);
throw new ActivitiException("unable to set simulation behavior class[" + behaviorClassName + "]");
}
}
}
Aggregations