<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color" xmlns:drools="http://www.jboss.org/drools" id="_JFgBcedSEeWopa6zIFRttQ" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" exporter="jBPM Designer" exporterVersion="6.2.0" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.omg.org/bpmn20" typeLanguage="http://www.java.com/javaTypes">

  <bpmn2:itemDefinition id="_personItem" structureRef="org.jbpm.bpmn2.objects.Person"/>
  <bpmn2:itemDefinition id="_addressItem" structureRef="org.jbpm.bpmn2.objects.Address"/>
  <bpmn2:itemDefinition id="__2_personInputXItem" structureRef="org.jbpm.bpmn2.objects.Person"/>
  <bpmn2:itemDefinition id="__2_personOutputXItem" structureRef="org.jbpm.bpmn2.objects.Person"/>
  <bpmn2:itemDefinition id="__3_addressInputXItem" structureRef="org.jbpm.bpmn2.objects.Address"/>
  <bpmn2:itemDefinition id="__3_addressOutputXItem" structureRef="org.jbpm.bpmn2.objects.Address"/>
  
  <bpmn2:process id="multiple-rule-tasks" drools:packageName="org.jbpm" drools:version="1.0" name="multiple-rule-tasks" isExecutable="true">
  
    <bpmn2:property id="person" itemSubjectRef="_personItem"/>
    <bpmn2:property id="address" itemSubjectRef="_addressItem"/>
  
    <bpmn2:extensionElements>
      <drools:global identifier="list" type="java.util.List" />
    </bpmn2:extensionElements>
        
    <bpmn2:startEvent id="_1" 
        drools:selectable="true"
        color:background-color="#9acd32" color:border-color="#000000" color:color="#000000" 
        name="start">
    </bpmn2:startEvent>
    
    <bpmn2:sequenceFlow id="_1-_2"
        drools:selectable="true" 
        color:background-color="#000000" color:border-color="#000000" color:color="#000000" 
        sourceRef="_1" targetRef="_2"/>
    
    <bpmn2:businessRuleTask id="_2" 
        drools:selectable="true" drools:ruleFlowGroup="person-rules" drools:scriptFormat="http://www.java.com/java" 
        color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" 
        name="First rule set">
      <bpmn2:ioSpecification id="_JFhPkOdSEeWopa6zIFRttQ">
        <bpmn2:dataInput id="_2_personInputX" drools:dtype="org.jbpm.bpmn2.objects.Person" itemSubjectRef="__2_personInputXItem" name="person"/>
        <bpmn2:dataOutput id="_2_personOutputX" drools:dtype="org.jbpm.bpmn2.objects.Person" itemSubjectRef="__2_personOutputXItem" name="person"/>
        <bpmn2:inputSet id="_JFidsOdSEeWopa6zIFRttQ">
          <bpmn2:dataInputRefs>_2_personInputX</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
        <bpmn2:outputSet id="_JFjEwOdSEeWopa6zIFRttQ">
          <bpmn2:dataOutputRefs>_2_personOutputX</bpmn2:dataOutputRefs>
        </bpmn2:outputSet>
      </bpmn2:ioSpecification>
      <bpmn2:dataInputAssociation id="_JFjEwedSEeWopa6zIFRttQ">
        <bpmn2:sourceRef>person</bpmn2:sourceRef>
        <bpmn2:targetRef>_2_personInputX</bpmn2:targetRef>
      </bpmn2:dataInputAssociation>
      <bpmn2:dataOutputAssociation id="_JFjEwudSEeWopa6zIFRttQ">
        <bpmn2:sourceRef>_2_personOutputX</bpmn2:sourceRef>
        <bpmn2:targetRef>person</bpmn2:targetRef>
      </bpmn2:dataOutputAssociation>
    </bpmn2:businessRuleTask>
    
    <bpmn2:sequenceFlow id="_2-_3"
        drools:selectable="true" 
        color:background-color="#000000" color:border-color="#000000" color:color="#000000" 
        sourceRef="_2" targetRef="_3"/>
    
    <bpmn2:businessRuleTask id="_3" drools:selectable="true" 
        drools:ruleFlowGroup="address-rules" drools:scriptFormat="http://www.java.com/java" 
        color:background-color="#fafad2" color:border-color="#000000" color:color="#000000" 
        name="Second rule set">
      <bpmn2:ioSpecification id="_JFjEw-dSEeWopa6zIFRttQ">
        <bpmn2:dataInput id="_3_addressInputX" drools:dtype="org.jbpm.bpmn2.objects.Address" itemSubjectRef="__3_addressInputXItem" name="address"/>
        <bpmn2:dataOutput id="_3_addressOutputX" drools:dtype="org.jbpm.bpmn2.objects.Address" itemSubjectRef="__3_addressOutputXItem" name="address"/>
        <bpmn2:inputSet id="_JFjExOdSEeWopa6zIFRttQ">
          <bpmn2:dataInputRefs>_3_addressInputX</bpmn2:dataInputRefs>
        </bpmn2:inputSet>
        <bpmn2:outputSet id="_JFjExedSEeWopa6zIFRttQ">
          <bpmn2:dataOutputRefs>_3_addressOutputX</bpmn2:dataOutputRefs>
        </bpmn2:outputSet>
      </bpmn2:ioSpecification>
      <bpmn2:dataInputAssociation id="_JFjExudSEeWopa6zIFRttQ">
        <bpmn2:sourceRef>address</bpmn2:sourceRef>
        <bpmn2:targetRef>_3_addressInputX</bpmn2:targetRef>
      </bpmn2:dataInputAssociation>
      <bpmn2:dataOutputAssociation id="_JFjEx-dSEeWopa6zIFRttQ">
        <bpmn2:sourceRef>_3_addressOutputX</bpmn2:sourceRef>
        <bpmn2:targetRef>address</bpmn2:targetRef>
      </bpmn2:dataOutputAssociation>
    </bpmn2:businessRuleTask>
    
    <bpmn2:sequenceFlow id="_3-_4"
        drools:selectable="true" 
        color:background-color="#000000" color:border-color="#000000" color:color="#000000" 
        sourceRef="_3" targetRef="_4"/>

    <bpmn2:task id="_4" name="Task" drools:taskName="TaskWithGlobalScripts" >
      <bpmn2:extensionElements>
        <drools:onEntry-script scriptFormat="http://www.java.com/java">
          <drools:script>list.add("On-entry1");</drools:script>
        </drools:onEntry-script>
        <drools:onEntry-script scriptFormat="http://www.java.com/java">
          <drools:script>list.add("On-entry2");</drools:script>
        </drools:onEntry-script>
        <drools:onExit-script scriptFormat="http://www.java.com/java">
          <drools:script>list.add("On-exit1");</drools:script>
        </drools:onExit-script>
        <drools:onExit-script scriptFormat="http://www.java.com/java">
          <drools:script>list.add("On-exit2");</drools:script>
        </drools:onExit-script>
      </bpmn2:extensionElements>
    </bpmn2:task>
        
    <bpmn2:sequenceFlow id="_4-_5"
        drools:selectable="true" 
        color:background-color="#000000" color:border-color="#000000" color:color="#000000" 
        sourceRef="_4" targetRef="_5"/>

    <bpmn2:endEvent id="_5" drools:selectable="true" 
    color:background-color="#ff6347" color:border-color="#000000" color:color="#000000" name="end">
    </bpmn2:endEvent>
    
  </bpmn2:process>
  
</bpmn2:definitions>
