Search in sources :

Example 1 with ServiceTaskDelegateExpressionActivityBehavior

use of org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior in project Activiti by Activiti.

the class DefaultActivityBehaviorFactory method createServiceTaskDelegateExpressionActivityBehavior.

public ServiceTaskDelegateExpressionActivityBehavior createServiceTaskDelegateExpressionActivityBehavior(ServiceTask serviceTask) {
    Expression delegateExpression = expressionManager.createExpression(serviceTask.getImplementation());
    Expression skipExpression;
    if (StringUtils.isNotEmpty(serviceTask.getSkipExpression())) {
        skipExpression = expressionManager.createExpression(serviceTask.getSkipExpression());
    } else {
        skipExpression = null;
    }
    return new ServiceTaskDelegateExpressionActivityBehavior(serviceTask.getId(), delegateExpression, skipExpression, createFieldDeclarations(serviceTask.getFieldExtensions()));
}
Also used : ServiceTaskDelegateExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior) Expression(org.activiti.engine.delegate.Expression)

Example 2 with ServiceTaskDelegateExpressionActivityBehavior

use of org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior in project Activiti by Activiti.

the class ServiceTaskParseHandlerTest method executeParseShouldUseDefaultBehaviorWhenNoInformationIsProvided.

@Test
public void executeParseShouldUseDefaultBehaviorWhenNoInformationIsProvided() throws Exception {
    // given
    ServiceTask serviceTask = new ServiceTask();
    ServiceTaskDelegateExpressionActivityBehavior defaultBehavior = mock(ServiceTaskDelegateExpressionActivityBehavior.class);
    given(activityBehaviorFactory.createDefaultServiceTaskBehavior(serviceTask)).willReturn(defaultBehavior);
    // when
    serviceTaskParseHandler.executeParse(bpmnParse, serviceTask);
    // then
    assertThat(serviceTask.getBehavior()).isEqualTo(defaultBehavior);
}
Also used : ServiceTaskDelegateExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior) ServiceTask(org.activiti.bpmn.model.ServiceTask) Test(org.junit.Test)

Aggregations

ServiceTaskDelegateExpressionActivityBehavior (org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior)2 ServiceTask (org.activiti.bpmn.model.ServiceTask)1 Expression (org.activiti.engine.delegate.Expression)1 Test (org.junit.Test)1