1. add service Task in yout bpmn-xml-file:

<serviceTask id="java_execution" name="Java Execution" activiti:delegateExpression="${JavaExecutionDelegate}" />

2. add JavaExecutionDelegate bean to the workflow-context.xml file

<bean id="JavaExecutionDelegate"
        class="de.lustin.alfresco.workflow.JavaExecutionDelegate"
        parent="baseJavaDelegate">
</bean>

3. Create a Java class

import org.alfresco.repo.workflow.activiti.BaseJavaDelegate;

public class JavaExecutionDelegate extends BaseJavaDelegate {

    @Override
    public void execute(DelegateExecution execution) throws Exception {

...