use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.
the class AbstractBehaviorFactory method createFieldDeclarations.
public List<FieldDeclaration> createFieldDeclarations(List<FieldExtension> fieldList) {
List<FieldDeclaration> fieldDeclarations = new ArrayList<FieldDeclaration>();
for (FieldExtension fieldExtension : fieldList) {
FieldDeclaration fieldDeclaration = null;
if (StringUtils.isNotEmpty(fieldExtension.getExpression())) {
fieldDeclaration = new FieldDeclaration(fieldExtension.getFieldName(), Expression.class.getName(), expressionManager.createExpression(fieldExtension.getExpression()));
} else {
fieldDeclaration = new FieldDeclaration(fieldExtension.getFieldName(), Expression.class.getName(), new FixedValue(fieldExtension.getStringValue()));
}
fieldDeclarations.add(fieldDeclaration);
}
return fieldDeclarations;
}
use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method addExceptionMapAsFieldDeclaraion.
private void addExceptionMapAsFieldDeclaraion(List<FieldDeclaration> fieldDeclarations, List<MapExceptionEntry> mapExceptions) {
FieldDeclaration exceptionMapsFieldDeclaration = new FieldDeclaration(EXCEPTION_MAP_FIELD, mapExceptions.getClass().toString(), mapExceptions);
fieldDeclarations.add(exceptionMapsFieldDeclaration);
}
use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method createCamelActivityBehavior.
protected ActivityBehavior createCamelActivityBehavior(TaskWithFieldExtensions task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
try {
Class<?> theClass = null;
FieldExtension behaviorExtension = null;
for (FieldExtension fieldExtension : fieldExtensions) {
if ("camelBehaviorClass".equals(fieldExtension.getFieldName()) && StringUtils.isNotEmpty(fieldExtension.getStringValue())) {
theClass = Class.forName(fieldExtension.getStringValue());
behaviorExtension = fieldExtension;
break;
}
}
if (behaviorExtension != null) {
fieldExtensions.remove(behaviorExtension);
}
if (theClass == null) {
// Default Camel behavior class
theClass = Class.forName("org.activiti.camel.impl.CamelBehaviorDefaultImpl");
}
List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
addExceptionMapAsFieldDeclaraion(fieldDeclarations, task.getMapExceptions());
return (ActivityBehavior) ClassDelegate.defaultInstantiateDelegate(theClass, fieldDeclarations);
} catch (ClassNotFoundException e) {
throw new ActivitiException("Could not find org.activiti.camel.CamelBehavior: ", e);
}
}
use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method createMuleActivityBehavior.
protected ActivityBehavior createMuleActivityBehavior(TaskWithFieldExtensions task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
try {
Class<?> theClass = Class.forName("org.activiti.mule.MuleSendActivitiBehavior");
List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
return (ActivityBehavior) ClassDelegate.defaultInstantiateDelegate(theClass, fieldDeclarations);
} catch (ClassNotFoundException e) {
throw new ActivitiException("Could not find org.activiti.mule.MuleSendActivitiBehavior: ", e);
}
}
use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.
the class TestActivityBehaviorFactory method createNoOpServiceTask.
private ClassDelegate createNoOpServiceTask(ServiceTask serviceTask) {
List<FieldDeclaration> fieldDeclarations = new ArrayList<FieldDeclaration>();
fieldDeclarations.add(new FieldDeclaration("name", Expression.class.getName(), new FixedValue(serviceTask.getImplementation())));
return new ClassDelegate(NoOpServiceTask.class, fieldDeclarations);
}
Aggregations