<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<objectListWrapper>
    <objects>
        <objectContainer>
            <businessRule>
                <content># Rule.Definition={"moderationRule":false,"approveAllRule":false,"splitData":false,"splitRule":false,"splitRuleSuffix":"","joinRule":false,"joinRuleSuffix":"","streamingRule":false,"streamingRuleSuffix":"","namedRule":false,"namedRuleName":""}
package com.freedomoss.requester;

# list any import classes here.
import java.util.Map;
import java.util.ArrayList;
import com.freedomoss.objective.model.CompositeRuleContext;
import com.freedomoss.objective.model.CompositeRuleDataItemContext;
import org.slf4j.Logger;


# declare any global variables here
global CompositeRuleContext source
global Logger log
global Map params


rule "Rule context initialization"
auto-focus true
no-loop
agenda-group "initialization-group"
    when
        $ctx:CompositeRuleContext(initialized == false);
    then
        # insert processed facts into memory
        $ctx.updateWorkingMemory();
        # move to business rules
        kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup("calculation").setFocus();
end

# RuleOutcome.Definition={"outcomeId":"Joined Transaction","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"_sys_transaction_id","operator":"IS_NOT_EMPTY"}],"customConditions":[]}
rule "1. Send records to 'Joined Transaction' when _sys_transaction_id IS_NOT_EMPTY ''"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("_sys_transaction_id", "IS_NOT_EMPTY", ""));

    then
        $ctx.sendResultTo("Joined Transaction", $item);
end



rule "Send unprocessed result to unconditional outcome(s)"
agenda-group "calculation"
dialect "mvel"
salience 80
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
    then
        $ctx.sendResultToUnconditionalOutcomes($item, true);
end</content>
                <name>Join Documents</name>
                <ruleType>COMPOSITE_RULE</ruleType>
                <ruleTypeUI>Composite</ruleTypeUI>
                <uuid>9a84bd83-0ab8-48b4-898f-5aabc112e282</uuid>
            </businessRule>
            <hashCode>1426595682</hashCode>
        </objectContainer>
        <objectContainer>
            <businessRule>
                <content># Rule.Definition={"moderationRule":false,"approveAllRule":false,"splitData":false,"splitRule":false,"splitRuleSuffix":"","joinRule":false,"joinRuleSuffix":"","streamingRule":false,"streamingRuleSuffix":"","namedRule":false,"namedRuleName":""}
package com.freedomoss.requester;

# list any import classes here.
import java.util.Map;
import java.util.ArrayList;
import com.freedomoss.objective.model.CompositeRuleContext;
import com.freedomoss.objective.model.CompositeRuleDataItemContext;
import org.slf4j.Logger;


# declare any global variables here
global CompositeRuleContext source
global Logger log
global Map params


rule "Rule context initialization"
auto-focus true
no-loop
agenda-group "initialization-group"
    when
        $ctx:CompositeRuleContext(initialized == false);
    then
        # insert processed facts into memory
        $ctx.updateWorkingMemory();
        # move to business rules
        kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup("calculation").setFocus();
end

# RuleOutcome.Definition={"outcomeId":"All Transactions","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"_sys_transaction_ids","operator":"IS_NOT_EMPTY"}],"customConditions":[]}
rule "1. Send records to 'All Transactions' when _sys_transaction_ids IS_NOT_EMPTY ''"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("_sys_transaction_ids", "IS_NOT_EMPTY", ""));

    then
        $ctx.sendResultTo("All Transactions", $item);
end



rule "Send unprocessed result to unconditional outcome(s)"
agenda-group "calculation"
dialect "mvel"
salience 80
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
    then
        $ctx.sendResultToUnconditionalOutcomes($item, true);
end</content>
                <name>Wait for All Transactions</name>
                <ruleType>COMPOSITE_RULE</ruleType>
                <ruleTypeUI>Composite</ruleTypeUI>
                <uuid>4149c209-88a2-477a-a3fc-10981d04b956</uuid>
            </businessRule>
            <hashCode>578206829</hashCode>
        </objectContainer>
    </objects>
</objectListWrapper>
