<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<objectListWrapper>
    <objects>
        <objectContainer>
            <compositeWorkSetting>
                <category>
                    <automation>false</automation>
                    <description>Data Collection</description>
                    <enabled>true</enabled>
                    <executingType>HUMAN</executingType>
                    <name>Data Collection</name>
                    <private>false</private>
                    <publicId>2772d602-31bd-4435-add8-b3c86de9656c</publicId>
                </category>
                <contentType>NORMAL</contentType>
                <description></description>
                <enabled>true</enabled>
                <name>ODF OCR v1.0</name>
                <publicId>6d220553-9040-429d-b98a-a0d08a150175</publicId>
                <version>
                    <componentUuid>9dc15766-bcec-49cc-9538-fe8adb6bceee</componentUuid>
                    <incrementalVersion>1.0</incrementalVersion>
                    <lastInChain>true</lastInChain>
                    <lastModified>2019-09-02T06:51:52Z</lastModified>
                    <versionUuid>965b7d54-291a-4ae9-bc06-cb2f274e5b5c</versionUuid>
                </version>
                <automationQualityThreshold>80</automationQualityThreshold>
                <campaign>
                    <active>true</active>
                    <businessRules/>
                    <campaignMaps>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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":"Yes","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"_sys_doc_id","operator":"IS_NOT_EMPTY"}],"customConditions":[]}
rule "1. Send records to 'Yes' when _sys_doc_id IS_NOT_EMPTY ''"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("_sys_doc_id", "IS_NOT_EMPTY", ""));

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



# RuleOutcome.Definition={"outcomeId":"No","conditional":false,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[],"customConditions":[]}
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>Any Docs</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>a5859559-31cb-444f-be55-dd07f905a75a</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>true</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
                                        &lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
                                        scriptlang="groovy"&gt;

                                        &lt;script&gt;&lt;![CDATA[
                                        import com.workfusion.odf.core.Intake;
                                        import com.workfusion.odf.service.SplitJoinService;

                                        def intake = Intake.init(binding).get();
                                        def splitJoinService = intake.getInstance(SplitJoinService.class);

                                        String transactionId = _sys_transaction_id.toString();
                                        def docs = splitJoinService.splitTransactionForOCR(transactionId);

                                        result = []
                                        docs.each {
                                        result &lt;&lt; [
                                        '_sys_doc_id' : it.id,
                                        'original_document_url': it.originalDocumentLink
                                        ]
                                        }
                                        ]]&gt;&lt;/script&gt;


                                        &lt;export include-original-data="true"&gt;
                                        &lt;multi-column list="${result}" split-results="true"&gt;
                                        &lt;put-to-column-getter name="_sys_doc_id" property="_sys_doc_id" /&gt;
                                        &lt;put-to-column-getter name="original_document_url" property="original_document_url" /&gt;
                                        &lt;/multi-column&gt;
                                        &lt;/export&gt;

                                        &lt;/config&gt;</content>
                                    <gavc>com.workfusion.odf:odf-bcb:1.0:main:Split Documents for OCR</gavc>
                                    <includedConfigs/>
                                    <inclusionCode>com.workfusion.odf:odf-bcb:1.0:main:Split Documents for OCR</inclusionCode>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>ODF Bots v1.0 (Split Documents for OCR)</name>
                                    <machineConfigOptions/>
                                    <sourceType>BUNDLE</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>6acfa5ea-50bf-41ff-94a6-a5283bd747e9</uuid>
                                    <version>
                                        <componentUuid>e45723a7-f573-46af-b3f6-d73278875d8e</componentUuid>
                                        <incrementalVersion>1.10</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-04-16T06:02:26Z</lastModified>
                                        <versionUuid>3eef7a92-ef71-4df4-89ad-0fb1489b467e</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>ODF Bots v1.0 (Split Documents for OCR)</title>
                                <type>SINGLE</type>
                                <uuid>c362ac2a-285a-4dba-aaf8-991bcd2876df</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>235c3029-2aa9-4798-8fb5-08366c2a8be9</componentUuid>
                                    <incrementalVersion>1.1</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>f09214e2-afb1-4e3a-8ec3-ffda26173a8a</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>1</stepIndex>
                            <stepPosition>START</stepPosition>
                            <streamed>false</streamed>
                            <uuid>a46480a2-7186-4bab-b774-380beb5029e9</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>36b186f1-7a6e-4a40-9ef3-8409d7a2d58d</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;

    &lt;var-def name="exportType"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_type")}'&gt;
                &lt;template&gt;${_sys_export_type}&lt;/template&gt;
            &lt;/if&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="exportColumns"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_columns")}'&gt;
                &lt;template&gt;${_sys_export_columns}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="columnNameCase"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_column_name_case")}'&gt;
                &lt;template&gt;${_sys_column_name_case}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;keep&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="dataOnly"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_data_only")}'&gt;
                &lt;template&gt;${_sys_data_only}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;true&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="datastoreName"&gt;
        &lt;script return="item.getWrappedObject().getRun().getDatastoreName()" /&gt;
    &lt;/var-def&gt;
    &lt;case&gt;
        &lt;if condition="${!datastoreName.isEmpty()}"&gt;
            &lt;insert-datastore   datastore-name="${datastoreName}" create="true"&gt;
                &lt;script return="hit_submission_data_item.getWrappedObject().getItemValueMap()"/&gt;
            &lt;/insert-datastore&gt;
        &lt;/if&gt;
    &lt;/case&gt;

    &lt;export include-original-data="true"
            export-type="${exportType}"
            export-columns="${exportColumns}"
            column-name-case="${columnNameCase}"
            data-only="${dataOnly}"&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                    <description>Default machine campaign for end step.</description>
                                    <includedConfigs/>
                                    <inclusionCode>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</inclusionCode>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <name>Final Results</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</uuid>
                                    <version>
                                        <componentUuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</componentUuid>
                                        <incrementalVersion>1.1</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-04-22T10:20:40Z</lastModified>
                                        <versionUuid>552d9fa4-ef1b-436d-a72b-e4b0ef988204</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>100</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Percents</streamValueType>
                                <title>Final Results</title>
                                <type>SINGLE</type>
                                <uuid>af4c8905-26dd-4120-b208-39ad3530ffc6</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>d2e7c7c3-18ea-11e9-85ab-0a109913a13e</componentUuid>
                                    <incrementalVersion>1.1</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-04-22T10:20:40Z</lastModified>
                                    <versionUuid>438ea8d2-a64c-4bfc-8da2-a0e751c19657</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>2</stepIndex>
                            <stepPosition>SUBEND</stepPosition>
                            <streamed>false</streamed>
                            <uuid>525ee0b4-8772-49b9-9a2b-f0997ee0f6c5</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>0733f2a9-fc30-4a6f-af83-c41c9b24eb60</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to split document into PNG pages. Then we get json of pages urls for used it in "[TOOD} XSLT XML Enrichment with WORD and DIV tags" step.

@Author: Alexey Shalak
@Version: 1.0
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config charset="UTF-8"&gt;

    &lt;var-def name="document_link"&gt;
     	 &lt;template&gt;${original_document_url.toString()}&lt;/template&gt;
    &lt;/var-def&gt; 
  
  	&lt;var-def name="convert_lib_path"&gt;
  		&lt;var-global name="convert_lib_path"/&gt;
  	&lt;/var-def&gt;
  
	&lt;var-def name="fileList"&gt;
		&lt;script return="convert(document_link.toString())"&gt;&lt;![CDATA[
			import java.io.BufferedReader;
			import java.io.File;
			import java.io.IOException;
			import java.io.InputStreamReader;
			import java.net.URL;
			import com.itextpdf.text.Image;

			import com.google.common.io.Files;
			import org.apache.commons.io.FileUtils;
			import org.apache.commons.io.FilenameUtils;
			import com.freedomoss.workfusion.utils.gson.GsonUtils;
			import org.webharvest.runtime.variables.ListVariable;
			import org.webharvest.runtime.variables.Variable;

			static Integer counter;
			static File outputFolder;
			static Integer size;
			static ListVariable lv;

			static int getSize(){
				return size;
			}

   			static Variable staticGetVariable(Object i){
				return lv.get((Integer)i);
			}

			static boolean getOS(){
				return ((String)System.getProperties().get("os.name")).contains("Windows");
			}

			boolean isWindows=getOS();


			static ListVariable convert(String documentLink) throws IOException, InterruptedException {
				File baseDir = Files.createTempDir();

				File inputFolder = new File(baseDir, "input");

				URL documentUrl = new URL(documentLink);
				String inputFileName = FilenameUtils.getName(documentUrl.getPath());

				if (inputFileName == null || inputFileName.isEmpty()) {
					inputFileName = "input.pdf";
				}

				File inputFile = new File(inputFolder, inputFileName);
				FileUtils.copyURLToFile(documentUrl, inputFile);

				outputFolder = new File(baseDir, "output");
				FileUtils.forceMkdir(outputFolder);

				File result = new File(outputFolder, "output.png");
				File resultTiff = new File(outputFolder, "output.tiff");

				if (isWindows){
				invoke(new ProcessBuilder(new String[] {
					"magick",
					"convert",
					"-density","288",
					inputFile.getAbsolutePath(),
					// "-resize", "25%",
					result.getAbsolutePath()}
				));
				} else {
				invoke(new ProcessBuilder(new String[] {
					convert_lib_path.toString(),
					"-density","288",
					inputFile.getAbsolutePath(),
					// "-resize", "25%",
					result.getAbsolutePath()}
				));
    			}

				List list=new ArrayList();
				counter=0;
				File created=new File(outputFolder, "output-"+counter.toString()+".png");
				while (created.exists()){
					counter++;
					list.add(created);
					created=new File(outputFolder, "output-"+counter.toString()+".png");
				}
				if (counter==0){
					created=new File(outputFolder, "output.png");
					if (created.exists()){
						File updated=new File(outputFolder, "output-0.png");
						created.renameTo(updated);
						counter++;
						list.add(updated);
					}
				}
				size=list.size();
				counter=0;
				lv=new ListVariable(list);
				return lv;
			}

			static void invoke(ProcessBuilder builder) throws IOException, InterruptedException {
				builder.redirectErrorStream(true);

				System.err.println(builder.command());
				Process process = builder.start();

				BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
				String line;
				while ((line = in.readLine()) != null) {
					System.out.println(line);
				}
				in.close();

				int code = process.waitFor();
				if (code != 0) {
					throw new RuntimeException("Failed to invoke process: " + builder.command() + ". Return code: " + code);
				}
			}
		]]&gt;&lt;/script&gt;
	&lt;/var-def&gt;
	
	&lt;var-def name="numberOfPages"&gt;
		&lt;script return="getSize()" /&gt;
	&lt;/var-def&gt;

	&lt;loop item="fileJavaObject" index="i" filter="unique"&gt;
		&lt;list&gt;
			&lt;var name="fileList" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;log&gt;
				&lt;template&gt;File: ${fileJavaObject}&lt;/template&gt;
			&lt;/log&gt;
			&lt;var-def name="key"&gt;
				&lt;script return="staticGetVariable(i.toInt()-1)"&gt;&lt;/script&gt;
			&lt;/var-def&gt;
			&lt;var-def name="content-${i}"&gt;
		        &lt;file path="${key}" type="binary"/&gt;
			&lt;/var-def&gt;
			&lt;var-def name="content"&gt;
				&lt;var name="content-${i}" /&gt;
			&lt;/var-def&gt;

			&lt;var-def name="converted_link-${i}"&gt;
        		&lt;s3  bucket="${s3_bucket_name}"&gt;
         			&lt;s3-put-public path="${bp_run_id}/${document_uuid}/page-${i}.png" content="${content}" content-type="image/png" content-disposition="inline"/&gt;
        		&lt;/s3&gt;
			&lt;/var-def&gt;
		&lt;/body&gt;
	&lt;/loop&gt;
	
	&lt;var-def name="jsonFilesUrls"&gt;
		&lt;json&gt;
			&lt;loop item="fileJavaObject" index="i" filter="unique"&gt;
				&lt;list&gt;
					&lt;var name="fileList" /&gt;
				&lt;/list&gt;
				&lt;body&gt;
					&lt;json-put key="fileList-${i}"&gt;
						&lt;var name="converted_link-${i}" /&gt;
					&lt;/json-put&gt;
				&lt;/body&gt;
			&lt;/loop&gt;
		&lt;/json&gt;
	&lt;/var-def&gt;
     
	&lt;export include-original-data="true"&gt;
		&lt;single-column name="pages" value="${numberOfPages}" /&gt;
		&lt;single-column name="json_file_urls" value="${jsonFilesUrls}" /&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>ae6e5fce-4ccc-45f5-845f-e0c732939aba</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>[TOOD] Split document into PNG pages[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>ae6e5fce-4ccc-45f5-845f-e0c732939aba</uuid>
                                    <version>
                                        <componentUuid>0d025561-1fad-4bc7-8add-857cb36f8e8e</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>e5ad4a24-653c-467d-8e43-eaca254a4e74</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>[TOOD] Split document into PNG pages[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>1c195671-2731-435d-868f-289e09d5353f</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>2b8fc1d0-ceb7-4820-b4a1-770e441c4544</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>c23272e4-935e-4f14-b7c2-d1e9dc7f164c</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>3</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>f40be433-c81d-4e56-9268-3e5f7c708679</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>bde2c34c-4dc2-4468-8210-37df9b51bd2f</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to make request to the OCR api, with our input parameters , but before, get one OCR taskId for document and make valid OCR api URL.

@Author: Alexey Shalak
@Version: 1.0
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
	scriptlang="groovy"&gt;
  	  
  	&lt;var-def name="ocr_url"&gt;
  		&lt;var-global name="ocr_url"/&gt;
  	&lt;/var-def&gt;
  
    &lt;var-def name="ocr_username"&gt;
  		&lt;var-global name="ocr_username"/&gt;
  	&lt;/var-def&gt;
  
    &lt;var-def name="ocr_password"&gt;
  		&lt;var-global name="ocr_password"/&gt;
  	&lt;/var-def&gt;
  
  	&lt;var-def name="submitImage"&gt;
      	&lt;case&gt;
			&lt;if condition='${ocr_username.toString().isEmpty() || ocr_password.toString().isEmpty()}'&gt;
				&lt;http url="${ocr_url}/submitImage" method="post" multipart="true"&gt;
					&lt;http-param name="file" isfile="true"&gt;
						&lt;http url="${original_document_url}" /&gt;
					&lt;/http-param&gt;
				&lt;/http&gt;
			&lt;/if&gt;
          	&lt;else&gt;
            	&lt;http url="${ocr_url}/submitImage" method="post" multipart="true" username="${ocr_username.toString()}" password="${ocr_password.toString()}"&gt;
					&lt;http-param name="file" isfile="true"&gt;
						&lt;http url="${original_document_url}" /&gt;
					&lt;/http-param&gt;
				&lt;/http&gt;
          	&lt;/else&gt;
		&lt;/case&gt;
	&lt;/var-def&gt;
  	
	&lt;var-def name="taskId"&gt;
		&lt;xpath expression="string(//response/task/@id)"&gt;
			&lt;var name="submitImage" /&gt;
		&lt;/xpath&gt;
	&lt;/var-def&gt;
  
  	&lt;script&gt;&lt;![CDATA[
		//-------------------------------------------------------making processDocument url-------------------------------------------------------
		String url = ocr_url.toString() + "/processDocument?taskId=" + taskId.toString() + "&amp;exportFormat=" + no_cached_export_format.toString() + "&amp;language=" + document_language.toString() + "&amp;xml:writeRecognitionVariants=" + ocr_xml_char_recognition.toString() + "&amp;correctSkew=true&amp;correctOrientation=true&amp;allowedRegionTypes=" + allowed_region_types.toString() + "&amp;invertImage=" + invert_image.toString() + "&amp;discardColorImage=" + discard_color_image.toString() + "&amp;removeColorObjectsType=" + remove_color_objects_type.toString();
		StringBuilder process_document_url = new StringBuilder(url.toString());
		
		log.error("OCR Response: " + submitImage.toString());

		if( !custom_regions.toString().isEmpty()) {
			process_document_url.append("&amp;customRegions=" + custom_regions.toString());
		}

		if( !change_dpi.toString().isEmpty()) {
			process_document_url.append("&amp;changeDPI=" + change_dpi.toString());
		}

		if( !remove_color_objects.toString().isEmpty()) {
			process_document_url.append("&amp;removeColorObjects=" + remove_color_objects.toString());
		}
		sys.defineVariable("processDocumentUrl", process_document_url)
	]]&gt;&lt;/script&gt;
  	&lt;log level="INFO" message="process document url: + ${processDocumentUrl.toString()}"/&gt;
	&lt;var-def name="processDocument"&gt;
      	&lt;case&gt;
			&lt;if condition='${ocr_username.toString().isEmpty() || ocr_password.toString().isEmpty()}'&gt;
				&lt;http url="${processDocumentUrl.toString()}" method="get" /&gt;
			&lt;/if&gt;
          	&lt;else&gt;
            	&lt;http url="${processDocumentUrl.toString()}" method="get" username="${ocr_username.toString()}" password="${ocr_password.toString()}" /&gt;
          	&lt;/else&gt;
		&lt;/case&gt;
	&lt;/var-def&gt;
  
	&lt;export include-original-data="true"&gt;
		&lt;single-column name="ocr_task_id" value="${taskId}"/&gt;      
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>ad0bc357-cd2f-404b-8624-35d503ab5aed</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>[Standard] OCR[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>ad0bc357-cd2f-404b-8624-35d503ab5aed</uuid>
                                    <version>
                                        <componentUuid>4f177861-e427-48bf-a10e-dc3988b3ec4a</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>5de4163f-35b0-4854-b70a-6379923c8242</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>[Standard] OCR[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>8cabeeca-cb90-47eb-a7bc-1a0c6ca00313</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>690138cc-6803-4033-b082-8257cb317aa7</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>4c313d9e-4115-425a-9919-67334de424fd</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>4</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>765e4fcb-b728-49da-af66-45e5e64d9604</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>43f146dc-4f98-4c7c-8772-d268cbef3152</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to get OCR result JSON and update it for comfortable using after.

@Author: Alexey Shalak
@Version: 1.0
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
	scriptlang="groovy"&gt;

	&lt;script&gt;&lt;![CDATA[
		import groovy.json.JsonSlurper;

		List&lt;Map&gt; cached_ocr_result_list = new JsonSlurper().parseText(cached_ocr_json.toString());
		sys.defineVariable("cached_ocr_result_list", cached_ocr_result_list);
		
		List&lt;Map&gt; ocr_result_list = new ArrayList();
		if( sys.isVariableDefined("ocr_json")) {
			ocr_result_list = new JsonSlurper().parseText(ocr_json.toString());
		}
		sys.defineVariable("ocr_result_list", ocr_result_list);

		Map&lt;String,Map&lt;String, String&gt;&gt; update_ocr_result_map = new HashMap();
		sys.defineVariable("update_ocr_result_map", update_ocr_result_map);
	]]&gt;&lt;/script&gt;
      
  	&lt;loop item="map"&gt;
		&lt;list&gt;
			&lt;var name="cached_ocr_result_list" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;script&gt;&lt;![CDATA[
				String ocr_export_format = map.getWrappedObject().get("ocr_export_format").toString();
				
				map.getWrappedObject().remove("original_document_name");
				map.getWrappedObject().remove("ocr_document_name");
				map.getWrappedObject().remove("ocr_raw_processed_document_name");
				map.getWrappedObject().remove("ocr_tood_document_name");
				
				update_ocr_result_map.getWrappedObject().put(ocr_export_format, map.getWrappedObject());
			]]&gt;&lt;/script&gt;
		&lt;/body&gt;
	&lt;/loop&gt;
  
	&lt;loop item="map"&gt;
		&lt;list&gt;
			&lt;var name="ocr_result_list" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;script&gt;&lt;![CDATA[
				String ocr_export_format = map.getWrappedObject().get("ocr_export_format").toString();
				
				map.getWrappedObject().remove("original_document_name");
				map.getWrappedObject().remove("ocr_document_name");
				map.getWrappedObject().remove("ocr_raw_processed_document_name");
				map.getWrappedObject().remove("ocr_tood_document_name");
				
				update_ocr_result_map.getWrappedObject().put(ocr_export_format, map.getWrappedObject());
			]]&gt;&lt;/script&gt;
		&lt;/body&gt;
	&lt;/loop&gt;

	&lt;script&gt;&lt;![CDATA[
		import com.google.gson.Gson;

		Gson gson = new Gson();
		String result_json = gson.toJson(update_ocr_result_map.getWrappedObject());
		sys.defineVariable("ocr_json", result_json);
	]]&gt;&lt;/script&gt;

	&lt;export include-original-data="true"&gt;
		&lt;single-column name="ocr_json" value="${ocr_json}" /&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>7614355a-8229-42ca-aaf3-5c565a2e56d5</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>Result JSON processing[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>7614355a-8229-42ca-aaf3-5c565a2e56d5</uuid>
                                    <version>
                                        <componentUuid>1185f663-1982-4f7e-a403-9c45d564abc5</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>5d5d29de-2d60-47f8-836f-33c22bbfa97b</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>Result JSON processing[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>179de67c-d954-40f5-9a6d-688e2d40cca5</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>1eded5a7-2f8c-46b3-a9ae-2d0c74467bf7</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>5c2daea3-5f25-4e28-a4fe-a936031fa16d</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>5</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>6cb1c74e-2c5a-433e-976e-7b5f24f85486</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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":"TOOD","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"ocr_type","value":"tood","operator":"EQ"}],"customConditions":[]}
rule "1. Send records to 'TOOD' when ocr_type EQ 'tood'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("ocr_type", "EQ", "tood"));

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

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

    then
        $ctx.sendResultTo("Standard", $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>OCR Type</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>fb804502-2f5f-4111-98e1-baca94ff33c5</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>0fd45f6f-54d1-44c6-b8e1-68dada0c0d5c</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>GoTo OCR[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>0fd45f6f-54d1-44c6-b8e1-68dada0c0d5c</uuid>
                                    <version>
                                        <componentUuid>c28e7453-5064-4e48-9337-349f6a284b59</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>54302a58-5927-444e-a877-70ceedb8cbb7</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>GoTo OCR[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>596efa8a-fe2c-4b39-9345-d452749d9e9b</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>2718ae2f-164a-459b-8086-e0f20c3cc1ce</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>cbb79ae1-51a2-42ee-8b3f-c4dfe5d1a38d</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>6</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>800c5340-2659-4169-a69d-93491291a5a0</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>31d4dc9b-55b5-405e-8d0c-9fd8b798ed8a</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to configure OCR parameters

@Author: Alexey Shalak
@Version: 1.1
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
	scriptlang="groovy"&gt;
  
    &lt;required name="original_document_url"/&gt;
  	&lt;required name="s3_bucket_name"/&gt;
  	&lt;required name="ocr_type"/&gt;
  	&lt;required name="cache_datastore"/&gt;
  
  	&lt;script&gt;&lt;![CDATA[
		if(ocr_type.toString().equals("tood")) {
			export_format = "xmlForCorrectedImage";
		} else if (ocr_type.toString().equals("standard")) {
  			if( !sys.isVariableDefined("export_format") || export_format == null || export_format.toString().isEmpty()) {
				export_format = "xmlForCorrectedImage";
			} else {
				export_format = export_format.toString().replace("|", ",");
			}
		}
		sys.defineVariable("exportFormat", export_format);

		if( !sys.isVariableDefined("document_language") || document_language == null || document_language.toString().isEmpty()) {
			document_language = "English";
		} else {
			document_language = document_language.toString().replace(" ", "");
		}
		sys.defineVariable("documentLanguage", document_language);

		if( !sys.isVariableDefined("ocr_xml_char_recognition") || ocr_xml_char_recognition == null || ocr_xml_char_recognition.toString().isEmpty()) {
			ocr_xml_char_recognition = "false";
		}
		sys.defineVariable("ocrXmlCharRecognition", ocr_xml_char_recognition);

		if( !sys.isVariableDefined("allowed_region_types") || allowed_region_types == null || allowed_region_types.toString().isEmpty()) {
			allowed_region_types = "BT_Text,BT_Table,BT_VectorPicture";
		} else {
			allowed_region_types = allowed_region_types.toString().replace("|", ",");
		}
		sys.defineVariable("allowed_region_types", allowed_region_types)

		if( !sys.isVariableDefined("custom_regions") || custom_regions == null) {
			custom_regions = "";
		}
		sys.defineVariable("custom_regions", custom_regions);

		if( !sys.isVariableDefined("change_dpi") || change_dpi == null) {
			change_dpi = "";
		}	
 		sys.defineVariable("change_dpi", change_dpi);

		if( !sys.isVariableDefined("invert_image") || invert_image == null || invert_image.toString().isEmpty()) {
			invert_image = "false";
		}
		sys.defineVariable("invertImage", invert_image)

		if( !sys.isVariableDefined("discard_color_image") || discard_color_image == null || discard_color_image.toString().isEmpty()) {
			discard_color_image = "false";
		}
		sys.defineVariable("discardColorImage", discard_color_image);
		
		if( !sys.isVariableDefined("remove_color_objects") || remove_color_objects == null) {
			remove_color_objects = "";
		}	
 		sys.defineVariable("remove_color_objects", remove_color_objects);

		if( !sys.isVariableDefined("remove_color_objects_type") || remove_color_objects_type == null || remove_color_objects_type.toString().isEmpty()) {
			remove_color_objects_type = "Background";
		}
		sys.defineVariable("removeColorObjectsType", remove_color_objects_type);
	]]&gt;&lt;/script&gt;
  
	&lt;var-def name="document_uuid"&gt;
		&lt;script language="java" return="uuid"&gt;&lt;![CDATA[
			String uuid = UUID.randomUUID().toString();
		]]&gt;&lt;/script&gt;
	&lt;/var-def&gt;
  
  	&lt;var-def name="bp_run_id"&gt;
		&lt;template&gt;
			${item.getWrappedObject().getRun().getRootRunUuid()}
		&lt;/template&gt;
	&lt;/var-def&gt;
  
	&lt;export include-original-data="true"&gt;
      	&lt;single-column name="cache_datastore" value="${cache_datastore}"/&gt;
    	&lt;single-column name="export_format" value="${exportFormat}"/&gt;
        &lt;single-column name="document_language" value="${documentLanguage}"/&gt;
        &lt;single-column name="ocr_xml_char_recognition" value="${ocrXmlCharRecognition}"/&gt;
      	&lt;single-column name="allowed_region_types" value="${allowed_region_types}"/&gt;
      	&lt;single-column name="custom_regions" value="${custom_regions}"/&gt;
      	&lt;single-column name="change_dpi" value="${change_dpi}"/&gt;
        &lt;single-column name="invert_image" value="${invertImage}"/&gt;
        &lt;single-column name="discard_color_image" value="${discardColorImage}"/&gt;
      	&lt;single-column name="remove_color_objects" value="${remove_color_objects}"/&gt;
      	&lt;single-column name="remove_color_objects_type" value="${removeColorObjectsType}"/&gt;
      
      	&lt;single-column name="bp_run_id" value="${bp_run_id}"/&gt;
      	&lt;single-column name="document_uuid" value="${document_uuid}"/&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>efd97844-b568-4953-8b8f-761d2a72bb93</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>Input data processing[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>efd97844-b568-4953-8b8f-761d2a72bb93</uuid>
                                    <version>
                                        <componentUuid>4e0e85aa-fee8-40f0-9ed3-3c0c495a4b64</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>e6c8c111-42ac-4b8a-8c32-20bd639e038b</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>Input data processing[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>f3314c30-8af8-44e3-b34a-edd0878e710b</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>ac22b51c-16d4-4874-8ecc-7778ddf14b1e</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>f2cf3a78-e0cc-41f1-9e68-ac4c911e28c2</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>7</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>cc8d2520-2a99-4c4c-9938-884504103caf</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>7e994aa6-95ed-47cc-8400-4c30bf97fdae</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to make request to the OCR api, with our input parameters , but before, get one OCR taskId for all pages of document and make valid OCR api URL.

@Author: Alexey Shalak
@Author: Sergey Emelianov
@Version: 2.5
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
    scriptlang="java"&gt;

    &lt;!-- reading pNG from S3 --&gt;
    &lt;script&gt;&lt;![CDATA[
        import org.json.XML;
        import java.util.List;
        import java.util.ArrayList;
        import org.json.JSONObject;
        import org.json.JSONArray;
        import com.freedomoss.workfusion.utils.gson.GsonUtils;
		import org.apache.commons.lang.StringEscapeUtils;

        static String getJSONValue(String jsonString, String key) {
            try{
                JSONObject json = new JSONObject(jsonString);
                return json.get(key).get("directUrl").toString();
            } catch (Exception e){
                return "";
            }
        }
    ]]&gt;&lt;/script&gt;
  
    &lt;var-def name="jsonSize"&gt;
        &lt;var name="pages" /&gt;
    &lt;/var-def&gt;
  
    &lt;while condition="true" maxloops="${jsonSize.toInt()}" index="i"&gt;
        &lt;var-def name="jsonKey"&gt;
            &lt;template&gt;fileList-${i.toInt()}&lt;/template&gt;
        &lt;/var-def&gt;
        &lt;!-- reading pNG from S3 --&gt;
        &lt;var-def name="jsonValue-${i}"&gt;
            &lt;script return="getJSONValue(json_file_urls.toString(), jsonKey.toString())" /&gt;
        &lt;/var-def&gt;
    &lt;/while&gt;

    &lt;var-def name="pagesList"&gt;
        &lt;while condition="true" maxloops="${jsonSize.toInt()}" index="i"&gt;
            &lt;var name="jsonValue-${i}" /&gt;
        &lt;/while&gt;
    &lt;/var-def&gt;

    &lt;var-def name="ocr_url"&gt;
        &lt;var-global name="ocr_url"/&gt;
    &lt;/var-def&gt;
  
    &lt;var-def name="ocr_username"&gt;
        &lt;var-global name="ocr_username"/&gt;
    &lt;/var-def&gt;
  
    &lt;var-def name="ocr_password"&gt;
        &lt;var-global name="ocr_password"/&gt;
    &lt;/var-def&gt;
  
     &lt;case&gt;
        &lt;if condition="${pagesList.toList().size() &amp;gt;= 1}"&gt;
          &lt;log level="INFO" message="begin ocr multipage document...."/&gt;
            &lt;loop item="pagesListElement"&gt;
                &lt;list&gt;
                    &lt;var name="pagesList" /&gt;
                &lt;/list&gt;
                &lt;body&gt;
                    &lt;var-def name="submitImageResponse"&gt;
                        &lt;http url="${ocr_url}/submitImage" method="post" multipart="true"&gt;
                            &lt;http-param name="file" isfile="true"&gt;
                                &lt;http url="${pagesListElement}" /&gt;
                            &lt;/http-param&gt;
                          	&lt;case&gt;
                              &lt;if condition='${sys.isVariableDefined("taskId")}'&gt;
                                &lt;http-param name="taskId"&gt;&lt;template&gt;${taskId.toString()}&lt;/template&gt;&lt;/http-param&gt;
                                &lt;log level="INFO" message="task ID already assigned - ${taskId}"/&gt;
                              &lt;/if&gt;
                            &lt;/case&gt;
                        &lt;/http&gt;
                     &lt;/var-def&gt;
                  	 &lt;log level="INFO" message="response from OCR ${submitImageResponse.toString()}"/&gt; 
                      &lt;var-def name="taskId"&gt;
                        &lt;xpath expression="string(//response/task/@id)"&gt;
                            &lt;var name="submitImageResponse" /&gt;
                        &lt;/xpath&gt;
    				 &lt;/var-def&gt;                     
                     &lt;log level="info" message="sending out ${pagesListElement} for task ${taskId}, pages ${pages}"/&gt;                    
                  &lt;/body&gt;
            &lt;/loop&gt;
        &lt;/if&gt;
    &lt;/case&gt;
      
    &lt;script&gt;&lt;![CDATA[
        //-------------------------------------------------------making processDocument url-------------------------------------------------------
        String url = ocr_url.toString() + "/processDocument?taskId=" + taskId.toString() + "&amp;exportFormat=" + no_cached_export_format.toString() + "&amp;language=" + document_language.toString() + "&amp;xml:writeRecognitionVariants=" + ocr_xml_char_recognition.toString() + "&amp;correctSkew=true&amp;correctOrientation=true&amp;allowedRegionTypes=" + allowed_region_types.toString() + "&amp;invertImage=" + invert_image.toString() + "&amp;discardColorImage=" + discard_color_image.toString() + "&amp;removeColorObjectsType=" + remove_color_objects_type.toString();
        StringBuilder process_document_url = new StringBuilder(url.toString());
        
        if( !custom_regions.toString().isEmpty()) {
            process_document_url.append("&amp;customRegions=" + custom_regions.toString());
        }

        if( !change_dpi.toString().isEmpty()) {
            process_document_url.append("&amp;changeDPI=" + change_dpi.toString());
        }

        if( !remove_color_objects.toString().isEmpty()) {
            process_document_url.append("&amp;removeColorObjects=" + remove_color_objects.toString());
        }
		//sys.defineVariable("processDocumentUrl", StringEscapeUtils.escapeHtml(process_document_url.toString()));
        sys.defineVariable("processDocumentUrl", process_document_url);
    ]]&gt;&lt;/script&gt;
  	&lt;log level="INFO" message="process document url: + ${processDocumentUrl.toString()}"/&gt;
  
    &lt;var-def name="processDocument"&gt;
        &lt;case&gt;
            &lt;if condition='${ocr_username.toString().isEmpty() || ocr_password.toString().isEmpty()}'&gt;
                &lt;http url="${processDocumentUrl.toString()}" method="get" /&gt;
            &lt;/if&gt;
            &lt;else&gt;
                &lt;http url="${processDocumentUrl.toString()}" method="get" username="${ocr_username.toString()}" password="${ocr_password.toString()}" /&gt;
            &lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;
  
    &lt;export include-original-data="true"&gt;
        &lt;single-column name="ocr_task_id" value="${taskId}"/&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>b2feae70-56bd-4e1b-a236-6464d123b33c</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>[TOOD] OCR[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>b2feae70-56bd-4e1b-a236-6464d123b33c</uuid>
                                    <version>
                                        <componentUuid>042d7515-b513-430c-a6ec-80666640cd27</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>8e81850d-4874-4d74-861f-58df3ba80695</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>[TOOD] OCR[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>3444a655-432b-4a7e-a997-0a7a04591048</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>38d4e0b7-58da-4167-a809-5274f904a8f0</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>ad1dca27-618d-43b3-9932-6873361cdc8d</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>8</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>cd329dad-bf94-46b3-aa01-af3bd907a81f</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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":"Yes","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"cache_hit","value":"full","operator":"EQ"}],"customConditions":[]}
rule "1. Send records to 'Yes' when cache_hit EQ 'full'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("cache_hit", "EQ", "full"));

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



# RuleOutcome.Definition={"outcomeId":"No","conditional":false,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[],"customConditions":[]}
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>Cache hit?</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>de12e01a-cb53-4ec9-ae72-9e550d0eda15</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"	scriptlang="groovy"&gt;
	&lt;var-def name="document"/&gt;
  
	&lt;var-def name="document_link"&gt;
		&lt;template&gt;${sys.getVar("original_document_url")}&lt;/template&gt;
	&lt;/var-def&gt;

	&lt;script&gt;&lt;![CDATA[
		isUnsuccessfulStatusCode = {statusCode -&gt; return statusCode.toString().matches('^[45]\\d{2}')};
	]]&gt;&lt;/script&gt;
    
    &lt;var-def name="custom_regions"&gt;
      &lt;template&gt;${import org.apache.commons.lang.StringEscapeUtils; sys.isVariableDefined("custom_regions") ? StringEscapeUtils.escapeSql(custom_regions.toString()) : "" }&lt;/template&gt;
    &lt;/var-def&gt;

	&lt;try&gt;
		&lt;body&gt;
			&lt;var-def name="document"&gt;
				&lt;http url="${document_link}" /&gt;
			&lt;/var-def&gt;
		&lt;/body&gt;
		&lt;catch&gt;
		&lt;/catch&gt;
	&lt;/try&gt;

	&lt;case&gt;
		&lt;if condition="${isUnsuccessfulStatusCode(http.statusCode)}"&gt;
			&lt;try&gt;
				&lt;body&gt;
					&lt;var-def name="document_link"&gt;
						&lt;template&gt;${org.apache.commons.httpclient.util.URIUtil.encodeQuery(document_link.toString())}
						&lt;/template&gt;
					&lt;/var-def&gt;
					&lt;var-def name="document"&gt;
						&lt;http url="${document_link}" /&gt;
					&lt;/var-def&gt;
				&lt;/body&gt;
				&lt;catch&gt;
				&lt;/catch&gt;
			&lt;/try&gt;
		&lt;/if&gt;
	&lt;/case&gt;

	&lt;case&gt;
		&lt;if condition="${isUnsuccessfulStatusCode(http.statusCode)}"&gt;
			&lt;script&gt;&lt;![CDATA[
				throw new RuntimeException("Failed to fetch url: " + document_link + " status code: " + http.statusCode);
			]]&gt;&lt;/script&gt;
		&lt;/if&gt;
	&lt;/case&gt;

	&lt;var-def name="document_hash"&gt;
		&lt;template&gt;${sys.getVar("document_hash")}&lt;/template&gt;
	&lt;/var-def&gt;
	&lt;case&gt;
		&lt;if condition="${document_hash.toString().length() == 0}"&gt;
			&lt;var-def name="document_hash"&gt;
				&lt;script
					return="UUID.nameUUIDFromBytes(document_link.toString().getBytes()).toString()" /&gt;
			&lt;/var-def&gt;
		&lt;/if&gt;
	&lt;/case&gt;

	&lt;!-- If the datastore is missing --&gt;
	&lt;create-datastore name="${cache_datastore}"&gt;
		&lt;datastore-column name="key" /&gt;
		&lt;datastore-column name="ocr_type" /&gt;
		&lt;datastore-column name="export_format" /&gt;
		&lt;datastore-column name="document_language" /&gt;
		&lt;datastore-column name="ocr_xml_char_recognition" /&gt;
		&lt;datastore-column name="allowed_region_types" /&gt;
		&lt;datastore-column name="custom_regions" /&gt;
		&lt;datastore-column name="change_dpi" /&gt;
		&lt;datastore-column name="invert_image" /&gt;
		&lt;datastore-column name="discard_color_image" /&gt;
		&lt;datastore-column name="remove_color_objects" /&gt;
		&lt;datastore-column name="remove_color_objects_type" /&gt;
	&lt;/create-datastore&gt;

	&lt;script&gt;&lt;![CDATA[
		export_format_list = Arrays.asList(export_format.toString().split(","));
		sys.defineVariable("exportFormatList", export_format_list);

		no_cached_export_format_list = new ArrayList(export_format_list);

		List ocr_result_list = new ArrayList();
		sys.defineVariable("ocr_result_list", ocr_result_list);
	]]&gt;&lt;/script&gt;

	&lt;loop item="format"&gt;
		&lt;list&gt;
			&lt;var name="exportFormatList" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;var-def name="cachedRecord"&gt;
				&lt;datastore name="${cache_datastore}" max="1"&gt;
            		&lt;template&gt;
            			SELECT * FROM @this 
                       WHERE "key"='${document_hash}' 
                       AND "ocr_type"='${ocr_type}' 
                       AND "export_format"='${format}' 
                       AND "document_language"='${document_language}' 
                       AND "ocr_xml_char_recognition"='${ocr_xml_char_recognition}' 
                       AND "allowed_region_types"='${allowed_region_types}' 
                       AND "custom_regions"='${custom_regions}' 
                       AND "change_dpi"='${change_dpi}' 
                       AND "invert_image"='${invert_image}' 
                       AND "discard_color_image"='${discard_color_image}' 
                       AND "remove_color_objects"='${remove_color_objects}' 
                       AND "remove_color_objects_type"='${remove_color_objects_type}'    
          			&lt;/template&gt;
				&lt;/datastore&gt;
			&lt;/var-def&gt;
          
          	&lt;case&gt;
				&lt;if condition='${cachedRecord.toString().length() != 0}'&gt;
                  	&lt;var-def name="value"&gt;
                            &lt;xpath expression='/row/ocr_json/text()'&gt;
                                &lt;var name="cachedRecord"/&gt;
                            &lt;/xpath&gt;
                    &lt;/var-def&gt;
                  
					&lt;script&gt;&lt;![CDATA[
						no_cached_export_format_list.remove(format.toString());

						ocr_result_list.toList().add(new HashMap(new groovy.json.JsonSlurper().parseText(value.toString())));
					]]&gt;&lt;/script&gt;
				&lt;/if&gt;
			&lt;/case&gt;  
		&lt;/body&gt;
	&lt;/loop&gt;
  
  	&lt;script&gt;&lt;![CDATA[
		import com.google.gson.Gson;

		String no_cached_export_format = no_cached_export_format_list.toString().replaceAll("[\\[\\]\\s]","");
		sys.defineVariable("no_cached_export_format", no_cached_export_format);

		Gson gson = new Gson();
		String result_json = gson.toJson(ocr_result_list.toList());
		sys.defineVariable("cached_ocr_json", result_json);
	]]&gt;&lt;/script&gt;

	&lt;export include-original-data="true"&gt;
		&lt;single-column name="document_hash" value="${document_hash}" /&gt;
      	&lt;single-column name="no_cached_export_format" value="${no_cached_export_format}" /&gt;
      	&lt;case&gt; 
          	&lt;if condition='${no_cached_export_format_list.size() == export_format_list.size()}'&gt;
            	&lt;single-column name="cache_hit" value="none"/&gt;
            &lt;/if&gt;
          	&lt;if condition='${no_cached_export_format_list.size() == 0}'&gt;
            	&lt;single-column name="cache_hit" value="full"/&gt;
              	&lt;single-column name="ocr_failed" value="false"/&gt;
            &lt;/if&gt;
            &lt;else&gt;
                &lt;single-column name="cache_hit" value="half"/&gt;
            &lt;/else&gt;
        &lt;/case&gt;
      	&lt;single-column name="cached_ocr_json" value="${cached_ocr_json}" /&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>658cb291-8960-4501-b6ba-544c1825a48f</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>Look for OCR cache[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>658cb291-8960-4501-b6ba-544c1825a48f</uuid>
                                    <version>
                                        <componentUuid>d934033a-066a-4d13-87e6-f943f8c56e19</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>6994b802-0147-4db4-98ab-e9056cd0230e</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>Look for OCR cache[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>89d4afad-3323-4298-bc70-3d89161b2608</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>abeeb6a7-f78d-477f-8738-02b050df75f6</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>d006e8bd-096a-4b11-90ad-05ec4b22b239</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>9</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>c5df78a2-9e8c-462c-9db1-0ca38ada629d</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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":"TOOD","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"ocr_type","value":"tood","operator":"EQ"}],"customConditions":[]}
rule "1. Send records to 'TOOD' when ocr_type EQ 'tood'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("ocr_type", "EQ", "tood"));

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

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

    then
        $ctx.sendResultTo("Standard", $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>OCR Type</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>d31d2068-6757-4807-a6b3-1d32ee513f1a</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to make row processing for all OCR result documents with "xml" format from previous step, also put updated documents on S3 and update OCR JSON.

@Author: Alexey Shalak
@Author: Denis Uraev
@Version: 1.2
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
	scriptlang="groovy"&gt;

	&lt;script&gt;&lt;![CDATA[
		import groovy.json.JsonSlurper;

		List&lt;Map&gt; ocr_result_list = new JsonSlurper().parseText(ocr_json.toString());
		sys.defineVariable("ocr_result_list", ocr_result_list);

		List&lt;Map&gt; update_ocr_result_list = new ArrayList();
		sys.defineVariable("update_ocr_result_list", update_ocr_result_list);
	]]&gt;&lt;/script&gt;

	&lt;loop item="map"&gt;
		&lt;list&gt;
			&lt;var name="ocr_result_list" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;script&gt;&lt;![CDATA[
				sys.defineVariable("ocr_document_name", map.getWrappedObject().get("ocr_document_name").toString());
				sys.defineVariable("ocr_export_format", map.getWrappedObject().get("ocr_export_format").toString());
				sys.defineVariable("ocr_document_format", map.getWrappedObject().get("ocr_document_format").toString());
			]]&gt;&lt;/script&gt;
			&lt;case&gt;
				&lt;if condition='${ocr_document_format.toString().equals("xml")}'&gt;
					&lt;s3 bucket="${s3_bucket_name}"&gt;
						&lt;var-def name="xml_text"&gt;
							&lt;s3-get name="${bp_run_id}/${document_uuid}/${ocr_document_name}.${ocr_document_format}" /&gt;
						&lt;/var-def&gt;
					&lt;/s3&gt;

					&lt;var-def name="ocr_raw_processed_document"&gt;
						&lt;xslt&gt;
							&lt;xml&gt;
								&lt;var name="xml_text" /&gt;
							&lt;/xml&gt;                       
							&lt;stylesheet&gt;&lt;![CDATA[ &lt;?xml version="1.0" encoding="UTF-8"?&gt;
								&lt;xsl:stylesheet version="1.0"
								xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
								xmlns:wfocr="http://ocr.crowdcomputingsystems.com/xml/schema-v1.xml" xmlns:csl="http://www.w3.org/1999/XSL/Transform"&gt;

								&lt;xsl:template match="@*|node()"&gt;
								&lt;xsl:copy&gt;
								&lt;xsl:apply-templates select="@*|node()"/&gt;
								&lt;/xsl:copy&gt;
               					&lt;/xsl:template&gt;

								&lt;xsl:template match="wfocr:charRecVariants" /&gt;
								&lt;xsl:template match="wfocr:*/@serifProbability" /&gt;
								&lt;xsl:template match="wfocr:*/@wordFromDictionary" /&gt;
								&lt;xsl:template match="wfocr:*/@wordPenalty" /&gt;
								&lt;xsl:template match="wfocr:*/@wordNumeric" /&gt;
								&lt;xsl:template match="wfocr:*/@wordNormal" /&gt;
								&lt;xsl:template match="wfocr:*/@wordIdentifier" /&gt;
								&lt;/xsl:stylesheet&gt;
							]]&gt;&lt;/stylesheet&gt;
						&lt;/xslt&gt;
					&lt;/var-def&gt;

					&lt;var-def name="ocr_raw_processed_document_url"&gt;
						&lt;s3 bucket="${s3_bucket_name}"&gt;
							&lt;s3-put-public
								path="${bp_run_id}/${document_uuid}/${ocr_document_name}-raw_processed.${ocr_document_format}"
								content="${ocr_raw_processed_document}" content-type="text/html; charset=utf-8"
								content-disposition="inline" /&gt;
						&lt;/s3&gt;
					&lt;/var-def&gt;
                  
					&lt;script&gt;&lt;![CDATA[
						map.getWrappedObject().put("ocr_raw_processed_document_url", ocr_raw_processed_document_url.toString());
						map.getWrappedObject().put("ocr_raw_processed_document_name", ocr_raw_processed_document_url.toString().substring(ocr_raw_processed_document_url.toString().lastIndexOf("/") + 1, ocr_raw_processed_document_url.toString().lastIndexOf(".")));
					]]&gt;&lt;/script&gt;
				&lt;/if&gt;
			&lt;/case&gt;
			
			&lt;script&gt;&lt;![CDATA[
				update_ocr_result_list.toList().add(new HashMap(map.getWrappedObject()));
			]]&gt;&lt;/script&gt;
		&lt;/body&gt;
	&lt;/loop&gt;

	&lt;script&gt;&lt;![CDATA[
		import com.google.gson.Gson;

		Gson gson = new Gson();
		String result_json = gson.toJson(update_ocr_result_list.toList());
		sys.defineVariable("ocr_json", result_json);
	]]&gt;&lt;/script&gt;


	&lt;export include-original-data="true"&gt;
		&lt;single-column name="ocr_json" value="${ocr_json}" /&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>443fbe29-a1f8-45bb-ad96-d9fe819388f7</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Data Transformation</name>
                                            <private>false</private>
                                            <publicId>0a266968-31f6-41f7-a7d8-09d7aeb4f581</publicId>
                                        </category>
                                        <contentType>NORMAL</contentType>
                                        <description>applies XSLT transformation to ocred text</description>
                                        <enabled>true</enabled>
                                        <name>XSLT node beauty</name>
                                        <publicId>ea0061dc-90dc-4b4f-8b68-8cbe7e6288d3</publicId>
                                        <version>
                                            <componentUuid>2555349d-5e72-4894-8b1a-a14d5fe45757</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2017-11-03T09:20:28Z</lastModified>
                                            <versionUuid>2dfd83e1-49f4-4521-86d4-c50506455776</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
    
    &lt;var-def name="resultXmlWithCharParams"&gt;
        &lt;xslt&gt;
            &lt;xml&gt;
                &lt;var name="document_xml" /&gt;
            &lt;/xml&gt;
            &lt;stylesheet&gt;&lt;![CDATA[ &lt;?xml version="1.0" encoding="UTF-8"?&gt;
            &lt;xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:wfocr="http://ocr.crowdcomputingsystems.com/xml/schema-v1.xml" xmlns:csl="http://www.w3.org/1999/XSL/Transform"&gt;

                &lt;xsl:template match="@*|node()"&gt;
                  &lt;xsl:copy&gt;
                    &lt;xsl:apply-templates select="@*|node()"/&gt;
                  &lt;/xsl:copy&gt;
                &lt;/xsl:template&gt;

                &lt;xsl:template match="wfocr:charRecVariants" /&gt;
                &lt;xsl:template match="wfocr:*/@serifProbability" /&gt;
                &lt;xsl:template match="wfocr:*/@wordFromDictionary" /&gt;
                &lt;xsl:template match="wfocr:*/@wordPenalty" /&gt;
                &lt;xsl:template match="wfocr:*/@wordNumeric" /&gt;
                &lt;xsl:template match="wfocr:*/@wordNormal" /&gt;
                &lt;xsl:template match="wfocr:*/@wordIdentifier" /&gt;
            &lt;/xsl:stylesheet&gt;             
            ]]&gt;&lt;/stylesheet&gt;
        &lt;/xslt&gt;   
    &lt;/var-def&gt;

    &lt;var-def name="documentXmlWithCharParamsLink"&gt;
        &lt;s3 bucket="public"&gt;
            &lt;s3-put-public path="${document_uuid}-with-char-params.xml"
                content="${resultXmlWithCharParams}" content-type="text/html; charset=utf-8"
                content-disposition="inline" /&gt;
        &lt;/s3&gt;
    &lt;/var-def&gt;
    
    &lt;export include-original-data="true"&gt;
      &lt;single-column name="documentXmlWithCharParamsLink" value="${documentXmlWithCharParamsLink}"/&gt;
      &lt;single-column name="resultXmlWithCharParams" value="${resultXmlWithCharParams}"/&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>XSLT node ocr transformation1</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>60ebb917-c277-460b-bc36-95a402fcccb1</uuid>
                                            <version>
                                                <componentUuid>3d384ef2-8ca8-41f5-8c30-e08ce0e693b4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>true</lastInChain>
                                                <lastModified>2017-11-03T09:20:28Z</lastModified>
                                                <versionUuid>3dcdf194-b57e-418b-9011-8308743202ea</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>XSLT Cut off Raw OCR XML tags[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
  	
  	&lt;var-def name="resultXmlWithCharParams"&gt;
		&lt;xslt&gt;
			&lt;xml&gt;
				&lt;var name="document_xml" /&gt;
			&lt;/xml&gt;
			&lt;stylesheet&gt;&lt;![CDATA[ &lt;?xml version="1.0" encoding="UTF-8"?&gt;
			&lt;xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:wfocr="http://ocr.crowdcomputingsystems.com/xml/schema-v1.xml" xmlns:csl="http://www.w3.org/1999/XSL/Transform"&gt;

                &lt;xsl:template match="@*|node()"&gt;
                  &lt;xsl:copy&gt;
                    &lt;xsl:apply-templates select="@*|node()"/&gt;
                  &lt;/xsl:copy&gt;
                &lt;/xsl:template&gt;

                &lt;xsl:template match="wfocr:charRecVariants" /&gt;
                &lt;xsl:template match="wfocr:*/@serifProbability" /&gt;
                &lt;xsl:template match="wfocr:*/@wordFromDictionary" /&gt;
                &lt;xsl:template match="wfocr:*/@wordPenalty" /&gt;
                &lt;xsl:template match="wfocr:*/@wordNumeric" /&gt;
                &lt;xsl:template match="wfocr:*/@wordNormal" /&gt;
                &lt;xsl:template match="wfocr:*/@wordIdentifier" /&gt;
            &lt;/xsl:stylesheet&gt;				
			]]&gt;&lt;/stylesheet&gt;
		&lt;/xslt&gt;	
  	&lt;/var-def&gt;

	&lt;var-def name="documentXmlWithCharParamsLink"&gt;
		&lt;s3 bucket="public"&gt;
			&lt;s3-put-public path="${document_uuid}-with-char-params.xml"
				content="${resultXmlWithCharParams}" content-type="text/html; charset=utf-8"
				content-disposition="inline" /&gt;
		&lt;/s3&gt;
	&lt;/var-def&gt;
  	
	&lt;export include-original-data="true"&gt;
      &lt;single-column name="documentXmlWithCharParamsLink" value="${documentXmlWithCharParamsLink}"/&gt;
      &lt;single-column name="resultXmlWithCharParams" value="${resultXmlWithCharParams}"/&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>XSLT node ocr transformation1</name>
                                        <origination>CREATED_AUTOMATICALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>MACHINE</type>
                                        <uuid>948e53ca-0aec-49eb-8ba9-5f8875c9aa0b</uuid>
                                        <version>
                                            <componentUuid>dc177f17-00a3-41f2-8cb1-e9354f681c12</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <versionUuid>7601cf6f-f987-4847-b7c8-87214c691585</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>443fbe29-a1f8-45bb-ad96-d9fe819388f7</uuid>
                                    <version>
                                        <componentUuid>a9d7b705-d9a1-4fe2-8f7a-83c44a44e955</componentUuid>
                                        <incrementalVersion>1.0</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2018-12-03T07:54:51Z</lastModified>
                                        <versionUuid>25b4a707-2998-4058-beec-0c796100116a</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>XSLT Cut off Raw OCR XML tags[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>bff38b6d-0157-4a15-8b00-519c8bdde7ae</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>45ba1694-4848-4353-9755-d6688996446f</componentUuid>
                                    <incrementalVersion>1.0</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2018-12-03T07:54:51Z</lastModified>
                                    <versionUuid>acd3a701-3a16-4cab-8687-21572451a311</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>10</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>ac0a86af-cccd-4afa-87a4-2187575207dc</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>4f6adbf1-3d29-4c78-80fa-d169deafa185</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>true</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <description>OCR XML with variants to viewable XML</description>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to make XSLT XML Enrichment with WORD and DIV tags processing for "row processed documents" from previous step, to prepare them for valid view on the TOOD HT, also put updated documents on S3 and update OCR JSON.

@Author: Alexey Shalak
@Version: 1.0
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config"
	scriptlang="java" charset="UTF-8"&gt;
  	
	&lt;script language="groovy"&gt;&lt;![CDATA[
		import groovy.json.JsonSlurper;

		List&lt;Map&gt; ocr_result_list = new JsonSlurper().parseText(ocr_json.toString());
		sys.defineVariable("ocr_result_list", ocr_result_list);

		List&lt;Map&gt; update_ocr_result_list = new ArrayList();
		sys.defineVariable("update_ocr_result_list", update_ocr_result_list);

		String ocr_document_name = ocr_result_list.get(0).get("ocr_document_name").toString();
		sys.defineVariable("ocr_document_name", ocr_document_name);

		String ocr_raw_processed_document_name = ocr_result_list.get(0).get("ocr_raw_processed_document_name").toString();
		sys.defineVariable("ocr_raw_processed_document_name", ocr_raw_processed_document_name);

		String ocr_document_format = ocr_result_list.get(0).get("ocr_document_format").toString();
		sys.defineVariable("ocr_document_format", ocr_document_format);
	]]&gt;&lt;/script&gt;
  
	&lt;var-def name="placeholder"&gt;
		&lt;template&gt;converted_pdf_link_PLACEHOLDER&lt;/template&gt;
	&lt;/var-def&gt;

  	&lt;var-def name="jsonKey"&gt;
		&lt;template&gt;fileList-1&lt;/template&gt;
	&lt;/var-def&gt;

    &lt;var-def name="lineHeight"&gt;
		&lt;template&gt;${use_line_height}&lt;/template&gt;
	&lt;/var-def&gt;  

  &lt;s3 bucket="${s3_bucket_name}"&gt;
		&lt;var-def name="xmlWordsDocument"&gt;
			&lt;s3-get name="${bp_run_id}/${document_uuid}/${ocr_raw_processed_document_name}.${ocr_document_format}" /&gt;
		&lt;/var-def&gt;
	&lt;/s3&gt;
  
	&lt;var-def name="imageLink"&gt;
		&lt;script return="getJSONValue(json_file_urls.toString(), jsonKey.toString())"&gt;&lt;![CDATA[
			import org.json.XML;
			import java.util.List;
			import java.util.ArrayList;
			import org.json.JSONObject;
			import org.json.JSONArray;
			import com.freedomoss.workfusion.utils.gson.GsonUtils;


			static String getJSONValue(String jsonString, String key) {
				try{
					JSONObject json = new JSONObject(jsonString);
					return json.get(key).get("directUrl").toString();
				} catch (Exception e){
					return "";
				}
			}

			public static String addImgTag(String xml, String placeholder, String fileUrl){
				return xml.replace(placeholder, fileUrl.substring(0, fileUrl.length()-5));
			}

		]]&gt;&lt;/script&gt;
	&lt;/var-def&gt;

&lt;!-- XSLT transformation
@date: 07/17/2018
@Author: Mikalai Yatskevich mikalai_yatskevich@epam.com
 v3
--&gt;
	&lt;var-def name="htmlWordsDocumentRaw"&gt;
		&lt;xslt&gt;
			&lt;xml&gt;
				&lt;var name="xmlWordsDocument" /&gt;
			&lt;/xml&gt;
			&lt;stylesheet&gt;&lt;template&gt;&lt;![CDATA[ 
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfocr="http://ocr.crowdcomputingsystems.com/xml/schema-v1.xml"&gt;
    &lt;xsl:output method="html" omit-xml-declaration="yes" media-type="text/html" indent="no"/&gt;
    &lt;xsl:variable name="currentHeight"&gt;
        &lt;xsl:value-of select="sum(//page/@height)"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="isLineHeight"&gt;
        &lt;xsl:value-of select="true()"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="minimalFontHeight"&gt;
        &lt;xsl:value-of select="15"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="stopChars"&gt;
        &lt;xsl:value-of select='"&amp;apos;&amp;gt;&amp;lt;`&#8217;~!@#$%^\*()_-=+[]{}&#172;;:,./?|&#8220;&#174;&#171;&#187;&#8212;&#176;| "'/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="stopCharsFirstWordInLine"&gt;
        &lt;xsl:value-of select='"&amp;apos;&amp;gt;&amp;lt;`&#8217;~!@#$%^\/*()_-=+[]{}&#172;;:?|&#8220;&#174;&#171;&#187;&#8212;&#176;|"'/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="numberChars"&gt;
        &lt;xsl:value-of select="'-1234567890'"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="numberSeparators"&gt;
        &lt;xsl:value-of select="'., '"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="dateSeparators"&gt;
        &lt;xsl:value-of select="'./-'"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:variable name="space"&gt;
        &lt;xsl:value-of select="' '"/&gt;
    &lt;/xsl:variable&gt;
    &lt;xsl:template match="wfocr:document"&gt;
        &lt;html&gt;
            &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;!-- Version 1.7 --&amp;gt;&lt;/xsl:text&gt;
            &lt;head&gt;
                &lt;style type="text/css"&gt;div.n {position:absolute;white-space:nowrap;text-align:left;vertical-align:bottom;letter-spacing:0px;word-spacing:0px;} div.rc {position:absolute;-ms-layout-flow: vertical-ideographic;writing-mode: vertical-lr;white-space:nowrap;} div.rcc {position:absolute;-ms-layout-flow: vertical-ideographic;writing-mode: vertical-rl;transform: rotate(180deg);white-space:nowrap;} div.t {position:absolute;white-space:nowrap;}&lt;/style&gt;
            &lt;/head&gt;
            &lt;body&gt;
                &lt;xsl:attribute name="style"&gt;width:&lt;xsl:value-of select="./page/@width"/&gt;px; height:&lt;xsl:value-of select="$currentHeight"/&gt;px; border: 1px solid black; background-repeat: no-repeat; font-family: 'Helvetica', 'Arial', sans-serif; padding: 0;
                &lt;/xsl:attribute&gt;
                &lt;document id="TOOD"&gt;
                    &lt;xsl:copy-of select="./@*"/&gt;
                    &lt;xsl:apply-templates select="./wfocr:page"/&gt;
                &lt;/document&gt;
            &lt;/body&gt;
        &lt;/html&gt;
    &lt;/xsl:template&gt;

    &lt;xsl:template match="wfocr:page"&gt;
        &lt;page&gt;
            &lt;xsl:copy-of select="./@*"/&gt;
            &lt;xsl:variable name="pageHeight"&gt;
                &lt;xsl:value-of select="sum(preceding::*[@resolution]/@height)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="previousPagesCount"&gt;
                &lt;xsl:value-of select="count(preceding::*[@resolution])+1"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="src"&gt;
                &lt;xsl:value-of select="concat('converted_pdf_link_PLACEHOLDER',$previousPagesCount,'.png')"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;img src="&lt;/xsl:text&gt;
            &lt;xsl:value-of select="$src"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;" style="&lt;/xsl:text&gt;position:absolute;top:&lt;xsl:value-of select="$pageHeight"/&gt;px;width:&lt;xsl:value-of select="@width"/&gt;px; height:&lt;xsl:value-of select="@height"/&gt;px; opacity:0.1; margin-left: 0px; margin-top: 0px;
            &lt;xsl:text disable-output-escaping="yes"&gt;" &amp;gt;&amp;lt;/img&amp;gt;&lt;/xsl:text&gt;
            &lt;xsl:apply-templates select="./wfocr:block"/&gt;
        &lt;/page&gt;
    &lt;/xsl:template&gt;

    &lt;xsl:template match="wfocr:block"&gt;
        &lt;xsl:choose&gt;
            &lt;xsl:when test="@blockType='Table'"&gt;
                &lt;table&gt;
                    &lt;tbody&gt;
                        &lt;xsl:apply-templates select="./wfocr:row"/&gt;
                    &lt;/tbody&gt;
                &lt;/table&gt;
            &lt;/xsl:when&gt;
            &lt;xsl:when test="@blockType='Text'"&gt;
                &lt;block&gt;
                    &lt;xsl:copy-of select="./@*"/&gt;
                    &lt;p&gt;
                        &lt;xsl:apply-templates select="./wfocr:text"/&gt;
                    &lt;/p&gt;
                &lt;/block&gt;
            &lt;/xsl:when&gt;
        &lt;/xsl:choose&gt;
        &lt;xsl:copy-of select="./separator"/&gt;
        &lt;xsl:copy-of select="./region"/&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="wfocr:row"&gt;

        &lt;tr&gt;
            &lt;xsl:apply-templates select="./wfocr:cell"/&gt;
        &lt;/tr&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="wfocr:cell"&gt;

        &lt;xsl:variable name="cellHeight"&gt;
            &lt;xsl:value-of select="@height"/&gt;
        &lt;/xsl:variable&gt;

        &lt;xsl:variable name="cellWidth"&gt;
            &lt;xsl:value-of select="@width"/&gt;
        &lt;/xsl:variable&gt;
        &lt;td&gt;
            &lt;xsl:attribute name="style"&gt;height:&lt;xsl:value-of select="$cellHeight"/&gt;px;width:&lt;xsl:value-of select="$cellWidth"/&gt;px;
            &lt;/xsl:attribute&gt;
            &lt;xsl:apply-templates select="./wfocr:text"/&gt;
        &lt;/td&gt;
    &lt;/xsl:template&gt;

    &lt;xsl:template match="wfocr:text"&gt;
        &lt;text&gt;
            &lt;xsl:copy-of select="./@*"/&gt;
            &lt;xsl:apply-templates select="./wfocr:par"/&gt;
        &lt;/text&gt;
    &lt;/xsl:template&gt;

    &lt;xsl:template match="wfocr:par"&gt;
        &lt;par&gt;
            &lt;xsl:copy-of select="./@*"/&gt;

            &lt;xsl:apply-templates select="./wfocr:line"/&gt;
        &lt;/par&gt;
    &lt;/xsl:template&gt;

    &lt;xsl:template match="wfocr:line"&gt;

        &lt;line&gt;
            &lt;xsl:copy-of select="./@*"/&gt;

            &lt;xsl:variable name="pageHeight"&gt;
                &lt;xsl:value-of select="number(sum(preceding::*[@resolution]/@height))"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineId"&gt;
                &lt;xsl:value-of select="generate-id(.)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineTop"&gt;
                &lt;xsl:value-of select="number(@t)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineBottom"&gt;
                &lt;xsl:value-of select="number(@b)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineRight"&gt;
                &lt;xsl:value-of select="number(@r)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineLeft"&gt;
                &lt;xsl:value-of select="number(@l)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineFirstCharacterLeft"&gt;
                &lt;xsl:value-of select="number(descendant::wfocr:charParams[@l][1]/@l)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="rotatedFontHeight"&gt;
                &lt;xsl:value-of select="number($lineRight - $lineLeft)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineHeightOld"&gt;
                &lt;xsl:value-of select="number($lineBottom - $lineTop)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="charBottoms"&gt;
                &lt;xsl:value-of select="number(sum(descendant::wfocr:charParams[string-length(normalize-space(text()))&gt;0]/@b))"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="charTops"&gt;
                &lt;xsl:value-of select="number(sum(descendant::wfocr:charParams[string-length(normalize-space(text()))&gt;0]/@t))"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="countElements"&gt;
                &lt;xsl:value-of select="number(count(descendant::wfocr:charParams[@b]))"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="middle"&gt;
                &lt;xsl:value-of select="ceiling($countElements div 2)"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="even"&gt;
                &lt;xsl:value-of select="not($countElements mod 2)"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="chosenElement"&gt;
                &lt;xsl:value-of select="count(descendant::wfocr:charParams[@b][@t]) div 10+1"/&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="lineHeightChar"&gt;
                &lt;xsl:for-each select="descendant::wfocr:charParams[@b][@t]"&gt;
                    &lt;xsl:sort data-type="number" select="string(number(./@b)-number(./@t))" order="descending"/&gt;
                    &lt;xsl:if test="position() = $middle"&gt;
                        &lt;xsl:value-of select="number(./@b)-number(./@t)"/&gt;
                    &lt;/xsl:if&gt;
                &lt;/xsl:for-each&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="totalCharHeight"&gt;
                &lt;xsl:value-of select="number($charBottoms)-number($charTops)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="charCount"&gt;
                &lt;xsl:value-of select="number(count(descendant::wfocr:charParams[string-length(normalize-space(text()))&gt;0]))"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineHeightComputed"&gt;
                &lt;xsl:choose&gt;
                    &lt;xsl:when test="number($lineHeightOld) div 2 &amp;gt; number($lineHeightChar)"&gt;
                        &lt;xsl:value-of select="number($lineHeightChar)"/&gt;
                    &lt;/xsl:when&gt;
                    &lt;xsl:otherwise&gt;
                        &lt;xsl:value-of select="number($lineHeightOld)"/&gt;
                    &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
            &lt;/xsl:variable&gt;
            &lt;xsl:variable name="lineHeight"&gt;
                &lt;xsl:choose&gt;
                    &lt;xsl:when test="$isLineHeight"&gt;
                        &lt;xsl:value-of select="$lineHeightOld"/&gt;
                    &lt;/xsl:when&gt;
                    &lt;xsl:otherwise&gt;
                        &lt;xsl:choose&gt;
                            &lt;xsl:when test="number($lineHeightComputed) &amp;lt; number($minimalFontHeight)"&gt;
                                &lt;xsl:value-of select="number($minimalFontHeight)"/&gt;
                            &lt;/xsl:when&gt;
                            &lt;xsl:otherwise&gt;
                                &lt;xsl:value-of select="number($lineHeightComputed)"/&gt;
                            &lt;/xsl:otherwise&gt;
                        &lt;/xsl:choose&gt;
                    &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="fontHeight"&gt;
                &lt;xsl:value-of select="number($lineHeight)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="rotatedLineHeight"&gt;
                &lt;xsl:value-of select="number($lineRight) - number($lineLeft)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineRightValue"&gt;
                &lt;xsl:choose&gt;
                    &lt;xsl:when test="normalize-space(descendant::wfocr:charParams[not(@charConfidence)][1]/@r)!=NaN"&gt;
                        &lt;xsl:value-of select="number(descendant::wfocr:charParams[not(@charConfidence)][1]/@r)"/&gt;
                    &lt;/xsl:when&gt;
                    &lt;xsl:otherwise&gt;
                        &lt;xsl:value-of select="number($lineRight)"/&gt;
                    &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="lineWidth"&gt;
                &lt;xsl:value-of select="number($lineRightValue) - number(@l)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;xsl:variable name="orientation"&gt;
                &lt;xsl:value-of disable-output-escaping="yes" select="normalize-space(ancestor::wfocr:text[@orientation]/@orientation)"/&gt;
            &lt;/xsl:variable&gt;

            &lt;formatting&gt;
                &lt;xsl:copy-of select="./@*"/&gt;

                &lt;xsl:variable name="sumConfidence"&gt;
                    &lt;xsl:value-of select="number(sum(descendant::wfocr:charParams[@charConfidence]/@charConfidence))"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="numNodes"&gt;
                    &lt;xsl:value-of select="number(count(descendant::wfocr:charParams[@charConfidence]/@charConfidence))"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="charConfidence"&gt;
                    &lt;xsl:value-of select="number($sumConfidence div $numNodes)"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="firstCharInLine"&gt;
                    &lt;xsl:value-of select="normalize-space(descendant::wfocr:charParams[1]/text())"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="secondCharInLine"&gt;
                    &lt;xsl:value-of select="normalize-space(descendant::wfocr:charParams[2]/text())"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="preFirstSymbolLeft"&gt;
                    &lt;xsl:value-of select="descendant::wfocr:charParams[not(contains($numberSeparators,normalize-space(self::*/text()))) and
                    not(contains($dateSeparators,normalize-space(self::*/text()))) and
                    not(contains($numberChars,normalize-space(self::*/text()))) and
                    string-length(normalize-space(self::*/text())) &amp;gt; 0][1]/@l[1]"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="firstSymbolLeft"&gt;
                    &lt;xsl:choose&gt;
                        &lt;xsl:when test="string-length($preFirstSymbolLeft) &amp;gt; 0"&gt;
                            &lt;xsl:value-of select="number($preFirstSymbolLeft)"/&gt;
                        &lt;/xsl:when&gt;
                        &lt;xsl:otherwise&gt;
                            &lt;xsl:value-of select="0"/&gt;
                        &lt;/xsl:otherwise&gt;
                    &lt;/xsl:choose&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="preFirstSpaceLeft"&gt;
                    &lt;xsl:value-of select="normalize-space(descendant::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1])"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="firstSpaceLeft"&gt;
                    &lt;xsl:choose&gt;
                        &lt;xsl:when test="string-length($preFirstSpaceLeft) &amp;gt; 0"&gt;
                            &lt;xsl:value-of select="number($preFirstSpaceLeft)"/&gt;
                        &lt;/xsl:when&gt;
                        &lt;xsl:otherwise&gt;
                            &lt;xsl:value-of select="0"/&gt;
                        &lt;/xsl:otherwise&gt;
                    &lt;/xsl:choose&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="preFirstStopCharLeft"&gt;
                    &lt;xsl:value-of select="normalize-space(descendant::wfocr:charParams[contains($stopCharsFirstWordInLine,normalize-space(self::*/text()))][1]/@l[1])"/&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:variable name="firstStopCharLeft"&gt;
                    &lt;xsl:choose&gt;
                        &lt;xsl:when test="string-length($preFirstStopCharLeft) &amp;gt; 0"&gt;
                            &lt;xsl:value-of select="$preFirstStopCharLeft"/&gt;
                        &lt;/xsl:when&gt;
                        &lt;xsl:otherwise&gt;
                            &lt;xsl:value-of select="0"/&gt;
                        &lt;/xsl:otherwise&gt;
                    &lt;/xsl:choose&gt;
                &lt;/xsl:variable&gt;
                &lt;xsl:choose&gt;
                    &lt;xsl:when test="string-length(normalize-space($orientation))=0"&gt;
                        &lt;xsl:variable name="followingSpaceFirstWordInLine"&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="string-length($preFirstSymbolLeft) = 0"&gt;
                                    &lt;xsl:value-of select="$lineRightValue"/&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:choose&gt;
                                        &lt;xsl:when test="((string-length(normalize-space(descendant::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1])) &amp;gt; 0) and
                                (not(contains($numberChars, $firstCharInLine))))"&gt;
                                            &lt;xsl:value-of select="$firstSpaceLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:when test="contains($numberChars, $firstCharInLine) and ($firstSpaceLeft &amp;gt; $firstSymbolLeft)"&gt;
                                            &lt;xsl:value-of select="$firstSpaceLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:when test="contains($numberChars, $firstCharInLine) and ($firstSpaceLeft &amp;lt; $firstSymbolLeft)"&gt;
                                            &lt;xsl:value-of select="$firstSymbolLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:otherwise&gt;
                                            &lt;xsl:value-of select="$lineRightValue"/&gt;
                                        &lt;/xsl:otherwise&gt;
                                    &lt;/xsl:choose&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="followingStopCharFirstWordInLine"&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="string-length($preFirstSymbolLeft) = 0"&gt;
                                    &lt;xsl:value-of select="$lineRightValue"/&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:choose&gt;
                                        &lt;xsl:when test="(string-length(normalize-space(descendant::wfocr:charParams[contains($stopCharsFirstWordInLine,normalize-space(self::*/text()))][1]/@l[1])) &amp;gt; 0) and
                                (not(contains($numberChars, $firstCharInLine)))"&gt;
                                            &lt;xsl:value-of select="$firstStopCharLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:when test="contains($numberChars, $firstCharInLine) and ($firstStopCharLeft &amp;gt; $firstSymbolLeft)"&gt;
                                            &lt;xsl:value-of select="$firstStopCharLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:when test="contains($numberChars, $firstCharInLine) and ($firstStopCharLeft &amp;lt; $firstSymbolLeft)"&gt;
                                            &lt;xsl:value-of select="$firstSymbolLeft"/&gt;
                                        &lt;/xsl:when&gt;
                                        &lt;xsl:otherwise&gt;
                                            &lt;xsl:value-of select="$lineRightValue"/&gt;
                                        &lt;/xsl:otherwise&gt;
                                    &lt;/xsl:choose&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="rightFirstWordInLine"&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="number($followingSpaceFirstWordInLine) &amp;lt; number($followingStopCharFirstWordInLine)"&gt;
                                    &lt;xsl:value-of select="number($followingSpaceFirstWordInLine)"/&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="number($followingStopCharFirstWordInLine)"/&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="leftFirstWordInLine"&gt;
                            &lt;xsl:value-of select="$lineLeft"/&gt;
                        &lt;/xsl:variable&gt;

                        &lt;xsl:variable name="widthFirstWordInLine"&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="string-length(normalize-space($rightFirstWordInLine))=0"&gt;
                                    &lt;xsl:value-of select="number($lineRight)-number($leftFirstWordInLine)"/&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="number($rightFirstWordInLine)-number($leftFirstWordInLine)"/&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:variable&gt;

                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)+number($lineHeight)"/&gt;" l="&lt;xsl:value-of select="number($lineFirstCharacterLeft)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                        &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineFirstCharacterLeft)"/&gt;px; width:&lt;xsl:value-of select="number($widthFirstWordInLine)"/&gt;px; height:&lt;xsl:value-of select="number($lineHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($fontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($fontHeight)"/&gt;px;"&lt;xsl:text disable-output-escaping="yes"&gt; class="n"&amp;gt;&lt;/xsl:text&gt;
                        &lt;xsl:for-each select="descendant::wfocr:charParams"&gt;
                            &lt;xsl:variable name="charValue"&gt;
                                &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="rightCharValueThatCanBeEmpty"&gt;
                                &lt;xsl:value-of select="normalize-space(./following::wfocr:charParams[1]/text()[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingTagId"&gt;
                                &lt;xsl:value-of select="generate-id(./following::wfocr:*[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingCharParamsTagId"&gt;
                                &lt;xsl:value-of select="generate-id(./following::wfocr:charParams[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="precedingTagId"&gt;
                                &lt;xsl:value-of select="generate-id(./preceding::wfocr:*[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="precedingCharParamsTagId"&gt;
                                &lt;xsl:value-of select="generate-id(./preceding-sibling::wfocr:charParams[1])"/&gt;
                            &lt;/xsl:variable&gt;

                            &lt;xsl:variable name="isLastCharInLine"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="($followingTagId &amp;lt; $followingCharParamsTagId) or ($followingTagId &amp;gt; $followingCharParamsTagId)"&gt;
                                        &lt;xsl:value-of select="true()"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="false()"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isFirstCharInLineNew"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="($precedingTagId &amp;lt; $precedingCharParamsTagId) or ($precedingTagId &amp;gt; $precedingCharParamsTagId)"&gt;
                                        &lt;xsl:value-of select="true()"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="false()"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="rightCharValue"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($rightCharValueThatCanBeEmpty)&gt;0"&gt;
                                        &lt;xsl:value-of select="$rightCharValueThatCanBeEmpty"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="'1'"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingNumberChar"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][contains($numberChars,normalize-space(self::*/text()))][1]/@l[1])) &amp;gt; 0"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][contains($numberChars,normalize-space(self::*/text()))][1]/@l[1]))"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingLetter"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][not(contains($numberChars,normalize-space(self::*/text()))) and not(contains($stopChars,normalize-space(self::*/text())))][1]/@l[1])) &amp;gt; 0"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][not(contains($numberChars,normalize-space(self::*/text()))) and not(contains($stopChars,normalize-space(self::*/text())))][1]/@l[1]))"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isNumberChar"&gt;
                                &lt;xsl:value-of select="contains($numberChars,$charValue)"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isLetterChar"&gt;
                                &lt;xsl:value-of select="not(contains($numberChars,$charValue)) and not(contains($stopChars,$charValue))"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isRightNumberChar"&gt;
                                &lt;xsl:choose&gt;
                                &lt;xsl:when test="string-length($rightCharValueThatCanBeEmpty)&gt;0"&gt;
                                &lt;xsl:value-of select="contains($numberChars,$rightCharValue)"/&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="false()"/&gt;
                                &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isRightLetterChar"&gt;
                                &lt;xsl:value-of select="not(contains($numberChars,$rightCharValue)) and not(contains($stopChars,$rightCharValue))"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingNumberLetterFirst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="$isNumberChar"&gt;
                                        &lt;xsl:value-of select="$followingLetter"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:when test="$isLetterChar"&gt;
                                        &lt;xsl:value-of select="$followingNumberChar"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;


                            &lt;xsl:variable name="preFstSymbolLeft"&gt;
                                &lt;xsl:value-of select="following::wfocr:charParams[not(contains($numberSeparators,normalize-space(self::*/text()))) and
                    (not(contains($numberChars, $charValue)) or (contains($numberChars, $charValue) and  not(contains($dateSeparators,normalize-space(self::*/text()))))) and
                    not(contains($numberChars,normalize-space(self::*/text()))) and
                    string-length(normalize-space(self::*/text())) &amp;gt; 0][1]/@l[1]"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="fstSymbolLeft"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($preFstSymbolLeft) &amp;gt; 0"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="number($preFstSymbolLeft) &amp;gt; number(./@l[1])"&gt;
                                                &lt;xsl:value-of select="number($preFstSymbolLeft)"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="0"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="preFstSpaceLeft"&gt;
                                &lt;xsl:value-of select="normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="fstSpaceLeft"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($preFstSpaceLeft) &amp;gt; 0"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="number($preFstSpaceLeft) &amp;gt; number(./@l[1])"&gt;
                                                &lt;xsl:choose&gt;
                                                    &lt;xsl:when test="number($preFstSpaceLeft) &amp;lt; number($fstSymbolLeft)"&gt;
                                                        &lt;xsl:value-of select="number($fstSymbolLeft)"/&gt;
                                                    &lt;/xsl:when&gt;
                                                    &lt;xsl:otherwise&gt;
                                                        &lt;xsl:value-of select="number($preFstSpaceLeft)"/&gt;
                                                    &lt;/xsl:otherwise&gt;
                                                &lt;/xsl:choose&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="0"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="preFstStopCharLeft"&gt;
                                &lt;xsl:value-of select="normalize-space(following::wfocr:charParams[contains($stopCharsFirstWordInLine,normalize-space(self::*/text()))][1]/@l[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="fstStopCharLeft"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($preFstStopCharLeft) &amp;gt; 0"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="number($preFstStopCharLeft) &amp;gt; number(./@l[1])"&gt;
                                                &lt;xsl:value-of select="$preFstStopCharLeft"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="0"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;


                            &lt;xsl:variable name="followingSpaceFst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($preFstSymbolLeft) = 0"&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="(string-length(normalize-space(following-sibling::*[not(self::*[@charConfidence])][1]/@l[1])) &amp;gt; 0) and (not(contains($numberChars, $rightCharValue))) and (not(contains($numberSeparators, $rightCharValue))) and (not(contains($dateSeparators, $rightCharValue)))"&gt;
                                                &lt;xsl:value-of select="number(normalize-space(following-sibling::*[not(self::*[@charConfidence])][1]/@l[1]))"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="contains($numberChars, $rightCharValue) and ($fstSpaceLeft &amp;gt; $fstSymbolLeft)"&gt;
                                                &lt;xsl:value-of select="$fstSpaceLeft"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="contains($numberChars, $rightCharValue) and ($fstSpaceLeft &amp;lt;= $fstSymbolLeft)"&gt;
                                                &lt;xsl:value-of select="$fstSymbolLeft"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingStopCharFst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($preFstSymbolLeft) = 0"&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="(string-length(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][1]/@l[1])) &amp;gt; 0) and (not(contains($numberChars, $rightCharValue))) and (not(contains($numberSeparators, $rightCharValue))) and (not(contains($dateSeparators, $rightCharValue)))"&gt;
                                                &lt;xsl:value-of select="number(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][1]/@l[1]))"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="contains($numberChars, $rightCharValue) and ($fstSpaceLeft &amp;gt; $fstSymbolLeft)"&gt;
                                                &lt;xsl:value-of select="$fstSpaceLeft"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="contains($numberChars, $rightCharValue) and ($fstSpaceLeft &amp;lt;= $fstSymbolLeft)"&gt;
                                                &lt;xsl:value-of select="$fstSymbolLeft"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingSpaceFirst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="(string-length(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1])) &amp;gt; 0) and (not(contains($numberChars, $rightCharValue))) "&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="not
                                            ((number(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1])) &amp;lt; $lineRightValue) and
                                            ((number(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][1]/@t[1]))) &amp;gt; number(./@b)))"&gt;
                                                &lt;xsl:value-of select="number(normalize-space(following::wfocr:charParams[not(self::*[@charConfidence])][1]/@l[1]))"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineRightValue"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingStopCharFirst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="(string-length(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][not(contains($dateSeparators,normalize-space(self::*/text())))][1]/@l[1])) &amp;gt; 0)"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][not(contains($dateSeparators,normalize-space(self::*/text())))][1]/@l[1]))"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="$lineRightValue"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="right"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="(number($followingSpaceFst) &amp;lt;= number($followingStopCharFst)) and (number($followingSpaceFst) &amp;lt;= number($followingNumberLetterFirst))"&gt;
                                        &lt;xsl:value-of select="number($followingSpaceFst)"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:when test="(number($followingStopCharFst) &amp;lt;= number($followingSpaceFst)) and (number($followingStopCharFst) &amp;lt;= number($followingNumberLetterFirst))"&gt;
                                        &lt;xsl:value-of select="$followingStopCharFst"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:when test="(number($followingNumberLetterFirst) &amp;lt;= number($followingSpaceFst)) and (number($followingNumberLetterFirst) &amp;lt;= number($followingStopCharFst))"&gt;
                                        &lt;xsl:value-of select="$followingNumberLetterFirst"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="number($followingStopCharFst)"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="rightFst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="number($followingSpaceFirst) &amp;lt; number($followingStopCharFst)"&gt;
                                        &lt;xsl:value-of select="number($followingSpaceFirst)"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="number($followingStopCharFst)"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isTab"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length(normalize-space(./@isTab)) &amp;gt; 0"&gt;
                                        &lt;xsl:value-of select="number(./@isTab)"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="0"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="left"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="$isTab = 0"&gt;
                                        &lt;xsl:value-of select="number(./@r[1])"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="number(following-sibling::wfocr:charParams[not(self::*[@isTab])][1]/@r[1])"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;

                            &lt;xsl:variable name="width"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length(normalize-space($right))=0"&gt;
                                        &lt;xsl:value-of select="number($lineRight)-number($left)"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="number($right)-number($left)"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="widthFst"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length(normalize-space($rightFst))=0"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="number($lineRight)-number($left) &amp;gt; 1"&gt;
                                                &lt;xsl:value-of select="number($lineRight)-number($left)"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$width"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="number($rightFst)-number($left) &amp;gt; 0"&gt;
                                                &lt;xsl:value-of select="number($rightFst)-number($left)"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$width"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isFirstCharInLine"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="number($lineFirstCharacterLeft) = number(./@l[1])"&gt;
                                        &lt;xsl:value-of select="1"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="0"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="leftCharValueThatCanBeEmpty"&gt;
                                &lt;xsl:value-of select="normalize-space(./preceding::wfocr:charParams[1]/text()[1])"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="leftCharValue"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($leftCharValueThatCanBeEmpty)&gt;0"&gt;
                                        &lt;xsl:value-of select="$leftCharValueThatCanBeEmpty"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="'1'"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isLeftCharNumber"&gt;
                                &lt;xsl:choose&gt;
                                    &lt;xsl:when test="string-length($leftCharValueThatCanBeEmpty)&gt;0"&gt;
                                        &lt;xsl:value-of select="contains($numberChars,$leftCharValue)"/&gt;
                                    &lt;/xsl:when&gt;
                                    &lt;xsl:otherwise&gt;
                                        &lt;xsl:value-of select="false()"/&gt;
                                    &lt;/xsl:otherwise&gt;
                                &lt;/xsl:choose&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="isLeftLetterChar"&gt;
                                &lt;xsl:value-of select="not(contains($numberChars,$leftCharValue)) and not(contains($stopChars,$leftCharValue))"/&gt;
                            &lt;/xsl:variable&gt;

                            &lt;xsl:variable name="charRight"&gt;
                                &lt;xsl:value-of select="./following-sibling::wfocr:charParams[1]/@l[1]"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="charLength"&gt;
                                &lt;xsl:value-of select="string-length(normalize-space($charValue))"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="textValue"&gt;
                                &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:variable name="followingSibling"&gt;
                                &lt;xsl:value-of select="normalize-space(following-sibling::wfocr:charParams[1]/text()[1])"/&gt;
                            &lt;/xsl:variable&gt;

                                                        &lt;xsl:choose&gt;
                                                            &lt;xsl:when test="((((not($charValue) or contains($stopChars, $charValue)) ) or
                                                        (contains($isLetterChar,'true') and contains($isLeftCharNumber, 'true') and contains($isFirstCharInLineNew, 'false')) or (contains($isNumberChar,'true') and contains($isLeftLetterChar,'true') and contains($isFirstCharInLineNew, 'false') ) or
                                                            (contains($numberChars, $leftCharValue) and not(contains($numberChars, $charValue)) and contains($numberChars, $rightCharValue) and not(contains($stopChars, $charValue)) and not($isFirstCharInLine='1'))) ) and
                                                        (($charLength &amp;gt; 0 and not(contains($numberSeparators, $charValue))) or
                                                        ($charLength=0 and not(contains($numberChars, $leftCharValue) and contains($numberChars, $rightCharValue))) or
                                                        (($charLength &amp;gt; 0) and not(contains($numberSeparators, $charValue) and contains($numberChars, $leftCharValue) and contains($numberChars, $rightCharValue)))) and
                                                        (($charLength &amp;gt; 0 and not(contains($dateSeparators, $charValue))) or
                                                        ($charLength=0 and not(contains($numberChars, $leftCharValue) and contains($numberChars, $rightCharValue))) or
                                                        (($charLength &amp;gt; 0) and not(contains($dateSeparators, $charValue) and contains($numberChars, $leftCharValue) and contains($numberChars, $rightCharValue))))"&gt;

                                                                &lt;xsl:variable name="followingSpace"&gt;
                                                                    &lt;xsl:choose&gt;
                                                                        &lt;xsl:when test="string-length(normalize-space(following-sibling::*[not(self::*[@charConfidence])][1]/@l[1])) &amp;gt; 0"&gt;
                                                                            &lt;xsl:value-of select="number(normalize-space(following-sibling::*[not(self::*[@charConfidence])][1]/@l[1]))"/&gt;
                                                                        &lt;/xsl:when&gt;
                                                                        &lt;xsl:otherwise&gt;
                                                                            &lt;xsl:value-of select="$lineRightValue"/&gt;
                                                                        &lt;/xsl:otherwise&gt;
                                                                    &lt;/xsl:choose&gt;
                                                                &lt;/xsl:variable&gt;
                                                                &lt;xsl:variable name="followingStopChar"&gt;
                                                                    &lt;xsl:choose&gt;
                                                                        &lt;xsl:when test="string-length(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][1]/@l[1])) &amp;gt; 0"&gt;
                                                                            &lt;xsl:value-of select="number(normalize-space(following-sibling::wfocr:charParams[contains($stopChars,normalize-space(self::*/text()))][1]/@l[1]))"/&gt;
                                                                        &lt;/xsl:when&gt;
                                                                        &lt;xsl:otherwise&gt;
                                                                            &lt;xsl:value-of select="$lineRightValue"/&gt;
                                                                        &lt;/xsl:otherwise&gt;
                                                                    &lt;/xsl:choose&gt;
                                                                &lt;/xsl:variable&gt;
                                                                &lt;xsl:if test="number($width) &amp;gt; -1"&gt;
                                                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;
                                                                    &lt;xsl:if test="(string-length(normalize-space($charValue)) &amp;gt; 0)"&gt;

                                                                        &lt;word&gt;
                                                                            &lt;xsl:attribute name="t"&gt;
                                                                                &lt;xsl:value-of select="number(./@t[1])"/&gt;
                                                                            &lt;/xsl:attribute&gt;
                                                                            &lt;xsl:attribute name="b"&gt;
                                                                                &lt;xsl:value-of select="number(./@b[1])"/&gt;
                                                                            &lt;/xsl:attribute&gt;
                                                                            &lt;xsl:attribute name="l"&gt;
                                                                                &lt;xsl:value-of select="number(./@l[1])"/&gt;
                                                                            &lt;/xsl:attribute&gt;
                                                                            &lt;xsl:attribute name="r"&gt;
                                                                                &lt;xsl:value-of select="number(./@r[1])"/&gt;
                                                                            &lt;/xsl:attribute&gt;
                                                                            &lt;xsl:attribute name="isTab"&gt;
                                                                                &lt;xsl:value-of select="'1'"/&gt;
                                                                            &lt;/xsl:attribute&gt;
                                                                            &lt;div&gt;
                                                                                &lt;xsl:attribute name="style"&gt;top:&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number(./@l[1])"/&gt;px; width:&lt;xsl:value-of select="number(./@r[1])-number(./@l[1])"/&gt;px; height:&lt;xsl:value-of select="number($lineHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($fontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($fontHeight)"/&gt;px;&lt;/xsl:attribute&gt;
                                                                                &lt;xsl:attribute name="class"&gt;n&lt;/xsl:attribute&gt;
                                                                                &lt;xsl:value-of select="./text()"/&gt;
                                                                            &lt;/div&gt;
                                                                        &lt;/word&gt;
                                                                    &lt;/xsl:if&gt;
                                                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)+number($lineHeight)"/&gt;" r="&lt;xsl:value-of select="number(./@r)+number($width)"/&gt;" l="&lt;xsl:value-of select="$left"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                                                                    &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($lineTop+$pageHeight)"/&gt;px;left:&lt;xsl:value-of select="$left"/&gt;px; width:&lt;xsl:value-of select="number($widthFst)"/&gt;px; height:&lt;xsl:value-of select="number($lineHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($fontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($fontHeight)"/&gt;px;" &lt;xsl:text disable-output-escaping="yes"&gt; class="n"&amp;gt;&lt;/xsl:text&gt;
                                                                &lt;/xsl:if&gt;
                                                            &lt;/xsl:when&gt;
                                                            &lt;xsl:otherwise&gt;
                                                                &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                                                            &lt;/xsl:otherwise&gt;
                                                        &lt;/xsl:choose&gt;
                                                        &lt;!--                            &lt;/xsl:if&gt;--&gt;
                        &lt;/xsl:for-each&gt;
                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;
                    &lt;/xsl:when&gt;
                    &lt;xsl:when test="$orientation='RotatedClockwise'"&gt;
                        &lt;xsl:variable name="startBottom"&gt;
                            &lt;xsl:value-of select="number(descendant::*[not(self::*[@charConfidence])][1]/@t)"/&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="startTop"&gt;
                            &lt;xsl:value-of select="number(descendant::*[1]/@t)"/&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="startHeight"&gt;
                            &lt;xsl:value-of select="number($startBottom)-number($startTop)"/&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($startTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($pageHeight)+number($startBottom)"/&gt;" l="&lt;xsl:value-of select="number($lineLeft)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                        &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($startTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineLeft)"/&gt;px; width:&lt;xsl:value-of select="number($lineWidth)"/&gt;px; height:&lt;xsl:value-of select="number($startHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;"&lt;xsl:text disable-output-escaping="yes"&gt;class="rc"&amp;gt;&lt;/xsl:text&gt;
                        &lt;xsl:for-each select="descendant::wfocr:charParams"&gt;
                            &lt;xsl:variable name="charValue"&gt;
                                &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                            &lt;/xsl:variable&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="not($charValue) or contains($stopChars, $charValue)"&gt;

                                    &lt;xsl:variable name="followingSpace"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following-sibling::*[not(self::wfocr:charParams[@charConfidence])][1]/@b))"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="followingStopChar"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following-sibling::*[contains($stopChars,normalize-space(self::wfocr:charParams/text()))][1]/@b))"/&gt;
                                    &lt;/xsl:variable&gt;

                                    &lt;xsl:variable name="top"&gt;
                                        &lt;xsl:value-of select="number(./@b)"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="bottom"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)=0) and (string-length($followingStopChar)=0) and string-length(normalize-space(following-sibling::wfocr:charParams[last()]/@b))=0"&gt;
                                                &lt;xsl:value-of select="$lineBottom"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)=0) and (string-length($followingStopChar)=0)"&gt;
                                                &lt;xsl:value-of select="normalize-space(following-sibling::wfocr:charParams[last()]/@b)"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingStopChar)=0)"&gt;
                                                &lt;xsl:value-of select="$followingSpace"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)=0)"&gt;
                                                &lt;xsl:value-of select="$followingStopChar"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="number($followingSpace) &amp;lt; number($followingStopChar)"&gt;
                                                &lt;xsl:value-of select="$followingSpace"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="number($followingSpace) &amp;gt; number($followingStopChar)"&gt;
                                                &lt;xsl:value-of select="$followingStopChar"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="$lineBottom"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:variable&gt;

                                    &lt;xsl:variable name="height"&gt;
                                        &lt;xsl:value-of select="number($bottom)-number($top)"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;

                                    &lt;word&gt;
                                        &lt;xsl:attribute name="t"&gt;
                                            &lt;xsl:value-of select="number(./@t)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="b"&gt;
                                            &lt;xsl:value-of select="number(./@b)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="l"&gt;
                                            &lt;xsl:value-of select="number(./@l)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="r"&gt;
                                            &lt;xsl:value-of select="number(./@r)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="isTab"&gt;
                                            &lt;xsl:value-of select="'1'"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;div&gt;
                                            &lt;xsl:attribute name="style"&gt;top:&lt;xsl:value-of select="number(./@t)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number(./@l)"/&gt;px; width:&lt;xsl:value-of select="number(./@r)-number(./@l)"/&gt;px; height:&lt;xsl:value-of select="number(./@b)-number(./@t)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;
                                            &lt;/xsl:attribute&gt;
                                            &lt;xsl:attribute name="class"&gt;rc&lt;/xsl:attribute&gt;
                                            &lt;xsl:value-of select="$charValue"/&gt;
                                        &lt;/div&gt;
                                    &lt;/word&gt;

                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($top)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($top)+number($pageHeight)+number($height)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;" l="&lt;xsl:value-of select="number($lineLeft)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                                    &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div onload="divSize(this)" style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($top)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineLeft)"/&gt;px; width:&lt;xsl:value-of select="number($lineWidth)"/&gt;px; height:&lt;xsl:value-of select="number($height)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;"
                                    &lt;xsl:text disable-output-escaping="yes"&gt; class="rc"&amp;gt;&lt;/xsl:text&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;

                        &lt;/xsl:for-each&gt;
                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;

                    &lt;/xsl:when&gt;
                    &lt;xsl:when test="$orientation='RotatedCounterclockwise'"&gt;
                        &lt;xsl:variable name="startBottom"&gt;
                            &lt;xsl:value-of select="number(@b)"/&gt;
                        &lt;/xsl:variable&gt;
                        &lt;xsl:variable name="startTop"&gt;
                            &lt;xsl:value-of select="number(descendant::wfocr:charParams[1]/@b)"/&gt;
                        &lt;/xsl:variable&gt;

                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($startTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($pageHeight)+number($startBottom)"/&gt;" l="&lt;xsl:value-of select="number($lineLeft)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                        &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($startTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineLeft)"/&gt;px; width:&lt;xsl:value-of select="number($lineWidth)"/&gt;px; height:&lt;xsl:value-of select="number($startBottom)-number($startTop)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;"
                        &lt;xsl:text disable-output-escaping="yes"&gt;class="rcc"&amp;gt;&lt;/xsl:text&gt;
                        &lt;xsl:for-each select="descendant::wfocr:charParams"&gt;
                            &lt;xsl:variable name="charValue"&gt;
                                &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                            &lt;/xsl:variable&gt;

                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="not($charValue)or contains($stopChars, $charValue)"&gt;
                                    &lt;xsl:variable name="followingSpace"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following-sibling::*[not(self::*[@charConfidence])][1]/@t[1]))"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="followingStopChar"&gt;
                                        &lt;xsl:value-of select="number(normalize-space(following-sibling::*[contains($stopChars,normalize-space(self::*/text()))][1]/@t[1]))"/&gt;
                                    &lt;/xsl:variable&gt;

                                    &lt;xsl:variable name="top"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)=0) and (string-length($followingStopChar)=0) and (string-length(normalize-space(following-sibling::*[last()]/@t[1]))&gt;0)"&gt;
                                                &lt;xsl:value-of select="normalize-space(following-sibling::*[last()][@t]/@t[1])"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingStopChar)=0) and (string-length($followingSpace)&gt;0)"&gt;
                                                &lt;xsl:value-of select="$followingSpace"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)=0) and (string-length($followingStopChar)&gt;0)"&gt;
                                                &lt;xsl:value-of select="$followingStopChar"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="(string-length($followingSpace)&gt;0) and ($followingSpace &amp;lt; $followingStopChar)"&gt;
                                                &lt;xsl:value-of select="$followingSpace"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:when test="string-length($followingStopChar)&gt;0"&gt;
                                                &lt;xsl:value-of select="$followingStopChar"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="0"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:variable&gt;

                                    &lt;xsl:variable name="bottom"&gt;
                                        &lt;xsl:value-of select="number(./@b)"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="height"&gt;
                                        &lt;xsl:value-of select="number($bottom)-number($top)"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;

                                    &lt;word&gt;
                                        &lt;xsl:attribute name="t"&gt;
                                            &lt;xsl:value-of select="number(./@t)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="b"&gt;
                                            &lt;xsl:value-of select="number(./@b)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="l"&gt;
                                            &lt;xsl:value-of select="number(./@l)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;xsl:attribute name="r"&gt;
                                            &lt;xsl:value-of select="number(./@r)"/&gt;
                                        &lt;/xsl:attribute&gt;
                                        &lt;div&gt;
                                            &lt;xsl:attribute name="style"&gt;top:&lt;xsl:value-of select="number(./@t+$pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number(./@l)"/&gt;px; width:&lt;xsl:value-of select="number(./@r)-number(./@l)"/&gt;px; height:&lt;xsl:value-of select="number(./@b)-number(./@t)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;
                                            &lt;/xsl:attribute&gt;
                                            &lt;xsl:attribute name="class"&gt;rcc&lt;/xsl:attribute&gt;
                                            &lt;xsl:value-of select="$charValue"/&gt;
                                        &lt;/div&gt;
                                    &lt;/word&gt;

                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($top)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($top)+number($pageHeight)+number($height)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;" l="&lt;xsl:value-of select="number($lineLeft)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                                    &lt;xsl:value-of select="number($charConfidence)"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($top)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineLeft)"/&gt;px; width:&lt;xsl:value-of select="number($lineWidth)"/&gt;px; height:&lt;xsl:value-of select="number($height)"/&gt;px; font-size: &lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($rotatedFontHeight)"/&gt;px;"
                                    &lt;xsl:text disable-output-escaping="yes"&gt; class="rcc"&amp;gt;&lt;/xsl:text&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:for-each&gt;

                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;
                    &lt;/xsl:when&gt;

                    &lt;xsl:otherwise&gt;
                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)+number($lineHeight)"/&gt;" l="&lt;xsl:value-of select="number($lineLeft)"/&gt;" r="&lt;xsl:value-of select="number($lineLeft)+number($lineWidth)"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                        &lt;xsl:value-of select="$charConfidence"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number($lineLeft)"/&gt;px; width:&lt;xsl:value-of select="number($lineWidth)"/&gt;px; height:&lt;xsl:value-of select="number($lineHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($fontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($fontHeight)"/&gt;px;"
                        &lt;xsl:text disable-output-escaping="yes"&gt;class="t"&amp;gt;&lt;/xsl:text&gt;
                        &lt;xsl:for-each select="descendant::wfocr:charParams"&gt;
                            &lt;xsl:choose&gt;
                                &lt;xsl:when test="not(normalize-space(./text()))"&gt;
                                    &lt;xsl:variable name="right"&gt;
                                        &lt;xsl:value-of select="number(following-sibling::*[not(self::*[@charConfidence])][1]/@l[1])"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="left"&gt;
                                        &lt;xsl:value-of select="number(./@r)"/&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:variable name="width"&gt;
                                        &lt;xsl:choose&gt;
                                            &lt;xsl:when test="not(normalize-space($right))"&gt;
                                                &lt;xsl:value-of select="number($lineRight)-number($left)"/&gt;
                                            &lt;/xsl:when&gt;
                                            &lt;xsl:otherwise&gt;
                                                &lt;xsl:value-of select="number($right)-number($left)"/&gt;
                                            &lt;/xsl:otherwise&gt;
                                        &lt;/xsl:choose&gt;
                                    &lt;/xsl:variable&gt;
                                    &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt; &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;word t&lt;/xsl:text&gt;="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;" b="&lt;xsl:value-of select="number($lineTop)+number($pageHeight)+number($lineHeight)"/&gt;" r="&lt;xsl:value-of select="number(./@r[1])+number($width)"/&gt;" l="&lt;xsl:value-of select="number(./@r[1])"/&gt;"&lt;xsl:text disable-output-escaping="yes"&gt; charConfidence="&lt;/xsl:text&gt;
                                    &lt;xsl:value-of select="$charConfidence"/&gt; &lt;xsl:text disable-output-escaping="yes"&gt;"&amp;gt;&amp;lt;div style&lt;/xsl:text&gt;= "top:&lt;xsl:value-of select="number($lineTop)+number($pageHeight)"/&gt;px;left:&lt;xsl:value-of select="number(./@r[1])"/&gt;px; width:&lt;xsl:value-of select="number($width)"/&gt;px; height:&lt;xsl:value-of select="number($lineHeight)"/&gt;px; font-size: &lt;xsl:value-of select="number($fontHeight)"/&gt;px;line-height:&lt;xsl:value-of select="number($fontHeight)"/&gt;px;"
                                    &lt;xsl:text disable-output-escaping="yes"&gt;class="t"&amp;gt;&lt;/xsl:text&gt;
                                &lt;/xsl:when&gt;
                                &lt;xsl:otherwise&gt;
                                    &lt;xsl:value-of select="normalize-space(./text())"/&gt;
                                &lt;/xsl:otherwise&gt;
                            &lt;/xsl:choose&gt;
                        &lt;/xsl:for-each&gt;
                        &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;/div&amp;gt;&amp;lt;/word&amp;gt;&lt;/xsl:text&gt;
                    &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
            &lt;/formatting&gt;
        &lt;/line&gt;
    &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;

]]&gt;&lt;/template&gt;&lt;/stylesheet&gt;
		&lt;/xslt&gt;
	&lt;/var-def&gt;

	&lt;var-def name="htmlWordsDocument"&gt;
		&lt;script return="addImgTag(htmlWordsDocumentRaw.toString(), placeholder.toString(), imageLink.toString())"&gt;&lt;/script&gt;
	&lt;/var-def&gt;

	&lt;var-def name="ocr_tood_document_url"&gt;
        &lt;s3 bucket="${s3_bucket_name}"&gt;
            &lt;s3-put path="${bp_run_id}/${document_uuid}/${ocr_document_name}-tood.xml" acl="PublicRead" content-type="text/html; charset=utf-8" content-disposition="inline"&gt;
                &lt;var name="htmlWordsDocument" /&gt;
            &lt;/s3-put&gt;
        &lt;/s3&gt;
    &lt;/var-def&gt;
    
  	&lt;loop item="map" maxloops="1"&gt;
		&lt;list&gt;
			&lt;var name="ocr_result_list" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;script language="groovy"&gt;&lt;![CDATA[
				import com.google.gson.Gson;
				
				map.getWrappedObject().put("ocr_tood_document_url", ocr_tood_document_url.toString());
				map.getWrappedObject().put("ocr_tood_document_name", ocr_tood_document_url.toString().substring(ocr_tood_document_url.toString().lastIndexOf("/") + 1, ocr_tood_document_url.toString().lastIndexOf(".")));
				update_ocr_result_list.toList().add(new HashMap(map.getWrappedObject()));

				Gson gson = new Gson();
				String result_json = gson.toJson(update_ocr_result_list.toList());
				sys.defineVariable("ocr_json", result_json);
			]]&gt;&lt;/script&gt;
		&lt;/body&gt;
	&lt;/loop&gt;

    &lt;export include-original-data="true"&gt;
      	&lt;single-column name="ocr_json" value="${ocr_json}" /&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>3490f583-9431-4d5f-8938-878d92241b02</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>[TOOD] XSLT XML Enrichment with WORD and DIV tags[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <source>
                                        <availability></availability>
                                        <deleted>false</deleted>
                                        <description>100 local threads</description>
                                        <equallyDistributeLoad>false</equallyDistributeLoad>
                                        <name>100 local threads</name>
                                        <prioritizeEarlierRuns>true</prioritizeEarlierRuns>
                                        <proxySettings>
                                            <password></password>
                                            <server></server>
                                            <username></username>
                                            <validationEnabled>false</validationEnabled>
                                        </proxySettings>
                                        <threadCount>100</threadCount>
                                        <threadsPerNode>false</threadsPerNode>
                                        <timeZone>GMT</timeZone>
                                        <tps>0</tps>
                                        <url></url>
                                        <version>
                                            <componentUuid>5c9d7f49-7016-11e6-a889-22000b994623</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2010-01-01T00:00:00Z</lastModified>
                                            <versionUuid>bd5ce11b-7017-11e6-a889-22000b994623</versionUuid>
                                        </version>
                                    </source>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>3490f583-9431-4d5f-8938-878d92241b02</uuid>
                                    <version>
                                        <componentUuid>0f7d8f94-68d9-4af1-b40f-48d750b75424</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>750a3654-2248-4788-b246-d3d8f5bb6c5d</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_MANUALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>[TOOD] XSLT XML Enrichment with WORD and DIV tags[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>31c69509-8fbd-47d2-8533-1b9af44a029f</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>3cb80d97-9931-470e-b343-1814fb6fe268</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>f1b363b5-bd47-4996-898c-a0bd74dc5c5d</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>11</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>bc2be947-c286-4711-96f0-0c174b2d6141</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>c478035f-4283-4ab5-8999-ef20fc801d62</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;

    &lt;var-def name="exportType"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_type")}'&gt;
                &lt;template&gt;${_sys_export_type}&lt;/template&gt;
            &lt;/if&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="exportColumns"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_columns")}'&gt;
                &lt;template&gt;${_sys_export_columns}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="columnNameCase"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_column_name_case")}'&gt;
                &lt;template&gt;${_sys_column_name_case}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;keep&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="dataOnly"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_data_only")}'&gt;
                &lt;template&gt;${_sys_data_only}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;true&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="datastoreName"&gt;
        &lt;script return="item.getWrappedObject().getRun().getDatastoreName()" /&gt;
    &lt;/var-def&gt;
    &lt;case&gt;
        &lt;if condition="${!datastoreName.isEmpty()}"&gt;
            &lt;insert-datastore   datastore-name="${datastoreName}" create="true"&gt;
                &lt;script return="hit_submission_data_item.getWrappedObject().getItemValueMap()"/&gt;
            &lt;/insert-datastore&gt;
        &lt;/if&gt;
    &lt;/case&gt;

    &lt;export include-original-data="true"
            export-type="${exportType}"
            export-columns="${exportColumns}"
            column-name-case="${columnNameCase}"
            data-only="${dataOnly}"&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                    <description>Default machine campaign for end step.</description>
                                    <includedConfigs/>
                                    <inclusionCode>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</inclusionCode>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <name>Final Results</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</uuid>
                                    <version>
                                        <componentUuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</componentUuid>
                                        <incrementalVersion>1.1</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-04-22T10:20:40Z</lastModified>
                                        <versionUuid>552d9fa4-ef1b-436d-a72b-e4b0ef988204</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>100</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Percents</streamValueType>
                                <title>Final Results</title>
                                <type>SINGLE</type>
                                <uuid>af4c8905-26dd-4120-b208-39ad3530ffc6</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>d2e7c7c3-18ea-11e9-85ab-0a109913a13e</componentUuid>
                                    <incrementalVersion>1.1</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-04-22T10:20:40Z</lastModified>
                                    <versionUuid>438ea8d2-a64c-4bfc-8da2-a0e751c19657</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>12</stepIndex>
                            <stepPosition>SUBEND</stepPosition>
                            <streamed>false</streamed>
                            <uuid>34187509-eaf9-4730-afe9-077dc10a8c0d</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>37af7aaf-bbb0-431d-b9dc-abc14e383c44</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>S3 bucket</answer>
                                            <answerCode>s3_bucket_name</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                <code>FREE_TEXT</code>
                                                <description></description>
                                                <optionsAvailable>false</optionsAvailable>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Free Text</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>true</required>
                                            <sequenceNumber>1</sequenceNumber>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>OCR Type</answer>
                                            <answerCode>ocr_type</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <category></category>
                                            <constantable>false</constantable>
                                            <defaultValue></defaultValue>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <htmlClasses></htmlClasses>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>Standard=standard|TOOD=tood</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>true</required>
                                            <sequenceNumber>2</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>OCR cache datastore</answer>
                                            <answerCode>cache_datastore</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                <code>FREE_TEXT</code>
                                                <description></description>
                                                <optionsAvailable>false</optionsAvailable>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Free Text</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>true</required>
                                            <sequenceNumber>3</sequenceNumber>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Export Format</answer>
                                            <answerCode>export_format</answerCode>
                                            <answerHtml>For Standard OCR type only.&lt;br /&gt;You can use maximum 3 types at once.</answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_MULTI</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select Multi</title>
                                                <valueSeparator>PIPE</valueSeparator>
                                                <valueType>MULTIVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>html=html|pdfSearchable=pdfSearchable|txt=txt|xml=xml|xmlForCorrectedImage=xmlForCorrectedImage</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>4</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Document language</answer>
                                            <answerCode>document_language</answerCode>
                                            <answerHtml>English (default).&lt;br /&gt;This parameter can contain several language names separated with commas, for example "English,French,German".</answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                <code>FREE_TEXT</code>
                                                <description></description>
                                                <optionsAvailable>false</optionsAvailable>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Free Text</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>5</sequenceNumber>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Switch for CharPosition option</answer>
                                            <answerCode>ocr_xml_char_recognition</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>false=false|true=true</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>6</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Allowed Region Types</answer>
                                            <answerCode>allowed_region_types</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_MULTI</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select Multi</title>
                                                <valueSeparator>PIPE</valueSeparator>
                                                <valueType>MULTIVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>BT_AutoAnalysis=BT_AutoAnalysis|BT_Barcode=BT_Barcode|BT_Checkmark=BT_Checkmark|BT_CheckmarkGroup=BT_CheckmarkGroup|BT_RasterPicture=BT_RasterPicture|BT_Separator=BT_Separator|BT_SeparatorGroup=BT_SeparatorGroup|BT_Table=BT_Table|BT_Text=BT_Text|BT_VectorPicture=BT_VectorPicture</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>7</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Change DPI</answer>
                                            <answerCode>change_dpi</answerCode>
                                            <answerHtml>From 50 to 400</answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                <code>FREE_TEXT</code>
                                                <description></description>
                                                <optionsAvailable>false</optionsAvailable>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Free Text</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>8</sequenceNumber>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Invert Image</answer>
                                            <answerCode>invert_image</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>false=false|true=true</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>9</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Discard Color Image</answer>
                                            <answerCode>discard_color_image</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>false=false|true=true</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>10</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Remove Color Objects</answer>
                                            <answerCode>remove_color_objects</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>Blue=Blue|Green=Green|Red=Red|Yellow=Yellow</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>11</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Remove Color Objects Type</answer>
                                            <answerCode>remove_color_objects_type</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                <code>SELECT_ONE</code>
                                                <description></description>
                                                <optionsAvailable>true</optionsAvailable>
                                                <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Select One</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <options>Background=Background|Full=Full|Stamp=Stamp</options>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>12</sequenceNumber>
                                            <shuffle>false</shuffle>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                        <answer>
                                            <allowNA>false</allowNA>
                                            <answer>Custom Regions</answer>
                                            <answerCode>custom_regions</answerCode>
                                            <answerHtml></answerHtml>
                                            <answerTypeObject>
                                                <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                <code>FREE_TEXT</code>
                                                <description></description>
                                                <optionsAvailable>false</optionsAvailable>
                                                <showDefaultValue>true</showDefaultValue>
                                                <showForFieldScheme>true</showForFieldScheme>
                                                <showForHumanTask>true</showForHumanTask>
                                                <showForMachineConfig>true</showForMachineConfig>
                                                <title>Free Text</title>
                                                <valueType>SINGLEVALUE</valueType>
                                            </answerTypeObject>
                                            <appendDataStoreOptions>false</appendDataStoreOptions>
                                            <autocompleteField>false</autocompleteField>
                                            <constantable>false</constantable>
                                            <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                            <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                            <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                            <lastModified>2018-12-03T07:54:51Z</lastModified>
                                            <letCustomValues>false</letCustomValues>
                                            <manualField>false</manualField>
                                            <multiValue>false</multiValue>
                                            <percentRequired>false</percentRequired>
                                            <range>false</range>
                                            <required>false</required>
                                            <sequenceNumber>13</sequenceNumber>
                                            <useBlocks>false</useBlocks>
                                            <useEmptyCell>false</useEmptyCell>
                                        </answer>
                                    </answers>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
  	 &lt;export include-original-data="true"&gt;
       &lt;single-column name="s3_bucket_name" value="doc-upload"/&gt;
       &lt;single-column name="ocr_type" value="tood" /&gt; 
       &lt;single-column name="cache_datastore" value="ocr_cache_chubb" /&gt; 
       &lt;single-column name="export_format" value="xmlForCorrectedImage" /&gt;
       &lt;single-column name="document_language" value="English" /&gt;
       &lt;single-column name="ocr_xml_char_recognition" value="false" /&gt; 
       &lt;single-column name="allowed_region_types" value="BT_AutoAnalysis|BT_Checkmark|BT_CheckmarkGroup|BT_Table|BT_Text|BT_VectorPicture" /&gt; 
       &lt;single-column name="custom_regions" value="" /&gt; 
       &lt;single-column name="change_dpi" value="" /&gt; 
       &lt;single-column name="invert_image" value="" /&gt; 
       &lt;single-column name="discard_color_image" value="" /&gt; 
       &lt;single-column name="remove_color_objects" value="" /&gt; 
       &lt;single-column name="remove_color_objects_type" value="" /&gt; 
       &lt;single-column name="use_line_height" value="true" /&gt; 
  &lt;/export&gt;    
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>250e7191-904e-4083-8670-b7c509d12c8b</inclusionCode>
                                    <jsonParams>{"s3_bucket_name":"doc-upload","ocr_type":"tood","cache_datastore":"ocr_cache_chubb","export_format":"xmlForCorrectedImage","document_language":"English","ocr_xml_char_recognition":"false","allowed_region_types":"BT_AutoAnalysis|BT_Checkmark|BT_CheckmarkGroup|BT_Table|BT_Text|BT_VectorPicture","use_line_height":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>ETL</name>
                                            <private>false</private>
                                            <publicId>0ef23179-3fa8-4750-86ca-f6da84f6e16d</publicId>
                                        </category>
                                        <contentType>NORMAL</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>[TOOD+Standard] Settings Use Case</name>
                                        <publicId>256a4e85-9b3e-42d3-bad7-e4e262c1d1d6</publicId>
                                        <version>
                                            <componentUuid>e579f473-c4ea-45a4-923f-972b5e9da835</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2018-07-10T14:32:12Z</lastModified>
                                            <versionUuid>c8b5bcf5-7a6a-44f0-b908-ea4054335f19</versionUuid>
                                        </version>
                                        <answers>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>S3 bucket</answer>
                                                <answerCode>s3_bucket_name</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                    <code>FREE_TEXT</code>
                                                    <description></description>
                                                    <optionsAvailable>false</optionsAvailable>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Free Text</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-05-14T14:46:32Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>true</required>
                                                <sequenceNumber>1</sequenceNumber>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>OCR Type</answer>
                                                <answerCode>ocr_type</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <category></category>
                                                <constantable>false</constantable>
                                                <defaultValue></defaultValue>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <htmlClasses></htmlClasses>
                                                <lastModified>2018-05-29T12:12:05Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>Standard=standard|TOOD=tood</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>true</required>
                                                <sequenceNumber>2</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>OCR cache datastore</answer>
                                                <answerCode>cache_datastore</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                    <code>FREE_TEXT</code>
                                                    <description></description>
                                                    <optionsAvailable>false</optionsAvailable>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Free Text</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-05-29T12:12:05Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>true</required>
                                                <sequenceNumber>3</sequenceNumber>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Export Format</answer>
                                                <answerCode>export_format</answerCode>
                                                <answerHtml>For Standard OCR type only.&lt;br /&gt;You can use maximum 3 types at once.</answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_MULTI</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select Multi</title>
                                                    <valueSeparator>PIPE</valueSeparator>
                                                    <valueType>MULTIVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-05-29T12:12:05Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>html=html|pdfSearchable=pdfSearchable|txt=txt|xml=xml|xmlForCorrectedImage=xmlForCorrectedImage</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>4</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Document language</answer>
                                                <answerCode>document_language</answerCode>
                                                <answerHtml>English (default).&lt;br /&gt;This parameter can contain several language names separated with commas, for example "English,French,German".</answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                    <code>FREE_TEXT</code>
                                                    <description></description>
                                                    <optionsAvailable>false</optionsAvailable>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Free Text</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-05-29T12:12:05Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>5</sequenceNumber>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Switch for CharPosition option</answer>
                                                <answerCode>ocr_xml_char_recognition</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-05-29T12:12:05Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>false=false|true=true</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>6</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Change DPI</answer>
                                                <answerCode>change_dpi</answerCode>
                                                <answerHtml>From 50 to 400</answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                    <code>FREE_TEXT</code>
                                                    <description></description>
                                                    <optionsAvailable>false</optionsAvailable>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Free Text</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>7</sequenceNumber>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Invert Image</answer>
                                                <answerCode>invert_image</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>false=false|true=true</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>8</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Discard Color Image</answer>
                                                <answerCode>discard_color_image</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>false=false|true=true</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>9</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Remove Color Objects</answer>
                                                <answerCode>remove_color_objects</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>Blue=Blue|Green=Green|Red=Red|Yellow=Yellow</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>10</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Remove Color Objects Type</answer>
                                                <answerCode>remove_color_objects_type</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>Background=Background|Full=Full|Stamp=Stamp</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>11</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>Custom Regions</answer>
                                                <answerCode>custom_regions</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>UNCONSTRAINED_TEXT</answerTypeGroup>
                                                    <code>FREE_TEXT</code>
                                                    <description></description>
                                                    <optionsAvailable>false</optionsAvailable>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Free Text</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <constantable>false</constantable>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <lastModified>2018-06-08T14:47:59Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>false</required>
                                                <sequenceNumber>12</sequenceNumber>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                            <answer>
                                                <allowNA>false</allowNA>
                                                <answer>If use line height in letter size computation</answer>
                                                <answerCode>use_line_height</answerCode>
                                                <answerHtml></answerHtml>
                                                <answerTypeObject>
                                                    <answerTypeGroup>SELECT_FROM_LIST</answerTypeGroup>
                                                    <code>SELECT_ONE</code>
                                                    <description></description>
                                                    <optionsAvailable>true</optionsAvailable>
                                                    <optionsDescription>Provide options for the answer using key=value format. For example, Option Name1=value1 or Option Name2=value2.</optionsDescription>
                                                    <showDefaultValue>true</showDefaultValue>
                                                    <showForFieldScheme>true</showForFieldScheme>
                                                    <showForHumanTask>true</showForHumanTask>
                                                    <showForMachineConfig>true</showForMachineConfig>
                                                    <title>Select One</title>
                                                    <valueType>SINGLEVALUE</valueType>
                                                </answerTypeObject>
                                                <appendDataStoreOptions>false</appendDataStoreOptions>
                                                <autocompleteField>false</autocompleteField>
                                                <category></category>
                                                <constantable>false</constantable>
                                                <defaultValue>false</defaultValue>
                                                <doNotNormalizeTaggedText>false</doNotNormalizeTaggedText>
                                                <doNotUseInAdjudication>false</doNotUseInAdjudication>
                                                <findMajorityForAllAtomicValues>false</findMajorityForAllAtomicValues>
                                                <htmlClasses></htmlClasses>
                                                <lastModified>2018-07-10T14:14:38Z</lastModified>
                                                <letCustomValues>false</letCustomValues>
                                                <manualField>false</manualField>
                                                <multiValue>false</multiValue>
                                                <options>True=true|False=false</options>
                                                <percentRequired>false</percentRequired>
                                                <range>false</range>
                                                <required>true</required>
                                                <sequenceNumber>13</sequenceNumber>
                                                <shuffle>false</shuffle>
                                                <useBlocks>false</useBlocks>
                                                <useEmptyCell>false</useEmptyCell>
                                            </answer>
                                        </answers>
                                        <machineWorkSettingType>ETL</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
  	 &lt;export include-original-data="true"&gt;
       &lt;single-column name="s3_bucket_name" value="{{s3_bucket_name}}"/&gt;
       &lt;single-column name="ocr_type" value="{{ocr_type}}" /&gt; 
       &lt;single-column name="cache_datastore" value="{{cache_datastore}}" /&gt; 
       &lt;single-column name="export_format" value="{{export_format}}" /&gt;
       &lt;single-column name="document_language" value="{{document_language}}" /&gt;
       &lt;single-column name="ocr_xml_char_recognition" value="{{ocr_xml_char_recognition}}" /&gt; 
       &lt;single-column name="custom_regions" value="{{custom_regions}}" /&gt; 
       &lt;single-column name="change_dpi" value="{{change_dpi}}" /&gt; 
       &lt;single-column name="invert_image" value="{{invert_image}}" /&gt; 
       &lt;single-column name="discard_color_image" value="{{discard_color_image}}" /&gt; 
       &lt;single-column name="remove_color_objects" value="{{remove_color_objects}}" /&gt; 
       &lt;single-column name="remove_color_objects_type" value="{{remove_color_objects_type}}" /&gt; 
       &lt;single-column name="use_line_height" value="{{use_line_height}}" /&gt; 
  &lt;/export&gt;    
&lt;/config&gt;</content>
                                            <name>[TOOD+Standard] Settings Template</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>d485061a-4872-4a3f-91a6-b391e3d7774e</uuid>
                                            <version>
                                                <componentUuid>6c311f0d-988b-4163-9ec3-bf6e887bed53</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2018-07-10T14:17:51Z</lastModified>
                                                <versionUuid>2097f9d9-7a8c-423f-bb68-4b7470fe9daa</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>ETL</machineWorkSettingType>
                                    <name>OCR ODF v0.4 Settings</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
  	 &lt;export include-original-data="true"&gt;
       &lt;single-column name="s3_bucket_name" value="{{s3_bucket_name}}"/&gt;
       &lt;single-column name="ocr_type" value="{{ocr_type}}" /&gt; 
       &lt;single-column name="cache_datastore" value="{{cache_datastore}}" /&gt; 
       &lt;single-column name="export_format" value="{{export_format}}" /&gt;
       &lt;single-column name="document_language" value="{{document_language}}" /&gt;
       &lt;single-column name="ocr_xml_char_recognition" value="{{ocr_xml_char_recognition}}" /&gt; 
       &lt;single-column name="allowed_region_types" value="{{allowed_region_types}}" /&gt; 
       &lt;single-column name="custom_regions" value="{{custom_regions}}" /&gt; 
       &lt;single-column name="change_dpi" value="{{change_dpi}}" /&gt; 
       &lt;single-column name="invert_image" value="{{invert_image}}" /&gt; 
       &lt;single-column name="discard_color_image" value="{{discard_color_image}}" /&gt; 
       &lt;single-column name="remove_color_objects" value="{{remove_color_objects}}" /&gt; 
       &lt;single-column name="remove_color_objects_type" value="{{remove_color_objects_type}}" /&gt; 
       &lt;single-column name="use_line_height" value="{{use_line_height}}" /&gt; 
  &lt;/export&gt;    
&lt;/config&gt;</content>
                                        <name>[TOOD+Standard] Settings Template</name>
                                        <origination>CREATED_AUTOMATICALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>MACHINE</type>
                                        <uuid>a460f963-e32d-4a0a-92d1-90f186d9a3e7</uuid>
                                        <version>
                                            <componentUuid>46e9bfb8-5bc0-450f-9307-bcf41b3b2066</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2019-07-26T11:01:26Z</lastModified>
                                            <versionUuid>1b50da01-cf35-43c2-83ff-06f0025b88cc</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>250e7191-904e-4083-8670-b7c509d12c8b</uuid>
                                    <version>
                                        <componentUuid>0c39430d-0aff-4e20-af37-162154cf85c1</componentUuid>
                                        <incrementalVersion>1.6</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-07-26T11:05:00Z</lastModified>
                                        <versionUuid>81d69cac-ecb3-4756-8738-18a185d89658</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>OCR ODF v0.4 Settings</title>
                                <type>SINGLE</type>
                                <uuid>b1ac25b5-047f-44c5-8b9f-964a0764e0ac</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>0cc76a32-8902-42ae-9b4e-50ab785d6dea</componentUuid>
                                    <incrementalVersion>1.3</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-02-18T16:22:02Z</lastModified>
                                    <versionUuid>20468592-4e25-4dbc-a420-d3a5e08926ba</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>13</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>a37f9554-ba82-4766-a297-0fc9733a009a</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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":"OCR Failed","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"ocr_failed","value":"true","operator":"EQ"}],"customConditions":[]}
rule "1. Send records to 'OCR Failed' when ocr_failed EQ 'true'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("ocr_failed", "EQ", "true"));

    then
        $ctx.sendResultTo("OCR Failed", $item);
end

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

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

# RuleOutcome.Definition={"outcomeId":"Standard","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"ocr_failed","value":"false","operator":"EQ"},{"fieldName":"ocr_type","value":"standard","operator":"EQ"},{"fieldName":"xml_export_format_flag","value":"true","operator":"EQ"}],"customConditions":[]}
rule "3. Send records to 'Standard' when ocr_failed EQ 'false' AND ocr_type EQ 'standard' AND xml_export_format_flag EQ 'true'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("ocr_failed", "EQ", "false"));
        eval($item.checkValue("ocr_type", "EQ", "standard"));
        eval($item.checkValue("xml_export_format_flag", "EQ", "true"));

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

# RuleOutcome.Definition={"outcomeId":"Standard (without xml export format)","conditional":true,"reworkBySameWorker":false,"assignToSameWorker":false,"anableLogging":false,"sendRejectNotification":false,"assignToAnyWorker":false,"approveRelatedAssignments":false,"rejectRelatedAssignments":false,"renameAutomationAnswerItem":false,"conditions":[{"fieldName":"ocr_failed","value":"false","operator":"EQ"},{"fieldName":"ocr_type","value":"standard","operator":"EQ"},{"fieldName":"xml_export_format_flag","value":"false","operator":"EQ"}],"customConditions":[]}
rule "4. Send records to 'Standard (without xml export format)' when ocr_failed EQ 'false' AND ocr_type EQ 'standard' AND xml_export_format_flag EQ 'false'"
agenda-group "calculation"
dialect "mvel"
salience 100
    when
        $ctx:CompositeRuleContext(initialized == true);
        $item:CompositeRuleDataItemContext();
        eval($item.checkValue("ocr_failed", "EQ", "false"));
        eval($item.checkValue("ocr_type", "EQ", "standard"));
        eval($item.checkValue("xml_export_format_flag", "EQ", "false"));

    then
        $ctx.sendResultTo("Standard (without xml export format)", $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>OCR Router</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>6a0ae88f-e983-4aa6-8b39-341b575afcd1</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to get response from OCR api, and if OCR Process is "Completed", get OCRed document for each OCR export format parameter, put them on S3 and create OCR JSON with result OCR information.

@Author: Alexey Shalak
@Author: Denis Uraev
@Version: 1.1
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config charset="UTF-8"&gt;
  
  	&lt;var-def name="ocr_url"&gt;
  		&lt;var-global name="ocr_url"/&gt;
  	&lt;/var-def&gt;
    
    &lt;var-def name="ocr_username"&gt;
  		&lt;var-global name="ocr_username"/&gt;
  	&lt;/var-def&gt;
  
    &lt;var-def name="ocr_password"&gt;
  		&lt;var-global name="ocr_password"/&gt;
  	&lt;/var-def&gt;
  
	&lt;var-def name="ocr_failed"&gt;
		false
	&lt;/var-def&gt;

	&lt;var-def name="xml_export_format_flag"&gt;
		false
	&lt;/var-def&gt;
  
  	&lt;var-def name="statusResponse"&gt;
      	&lt;case&gt;
			&lt;if condition='${ocr_username.toString().isEmpty() || ocr_password.toString().isEmpty()}'&gt;
				&lt;http url="${ocr_url.toString()}/getTaskStatus?taskId=${ocr_task_id.toString()}" method="get" /&gt;
			&lt;/if&gt;
          	&lt;else&gt;
            	&lt;http url="${ocr_url.toString()}/getTaskStatus?taskId=${ocr_task_id.toString()}" method="get" username="${ocr_username.toString()}" password="${ocr_password.toString()}" /&gt;
          	&lt;/else&gt;
		&lt;/case&gt;
	&lt;/var-def&gt;

	&lt;var-def name="taskStatus"&gt;
      	&lt;xpath expression="string(//response/task/@status)"&gt;
			&lt;var name="statusResponse" /&gt;
		&lt;/xpath&gt;
	&lt;/var-def&gt;

	&lt;case&gt;
		&lt;if
			condition='${!"Completed".equals(taskStatus.toString()) @and !"ProcessingFailed".equals(taskStatus.toString())}'&gt;
			&lt;release time-in-seconds="30" /&gt;
			&lt;exit /&gt;
		&lt;/if&gt;

		&lt;if condition='${"ProcessingFailed".equals(taskStatus.toString())}'&gt;
			&lt;script&gt;&lt;![CDATA[
				sys.defineVariable("ocr_failed", true);
				sys.defineVariable("ocr_failed_response", statusResponse);
			]]&gt;&lt;/script&gt;
		&lt;/if&gt;

		&lt;if condition='${"Completed".equals(taskStatus.toString())}'&gt;

			&lt;script language="groovy"&gt;&lt;![CDATA[
				import groovy.json.JsonSlurper;

				List export_format_list = Arrays.asList(no_cached_export_format.toString().split(","));
				sys.defineVariable("export_format_list", export_format_list);

				List&lt;Map&gt; ocr_result_list = new ArrayList();
				sys.defineVariable("ocr_result_list", ocr_result_list);

				def original_document_url_object = new java.net.URI(original_document_url.toString())
				def original_document_name = original_document_url_object.getPath().tokenize('/').last().tokenize('.').first()
				
				sys.defineVariable("original_document_name", original_document_name);
			]]&gt;&lt;/script&gt;

			&lt;loop item="format"&gt;
				&lt;list&gt;
					&lt;var name="export_format_list" /&gt;
				&lt;/list&gt;
				&lt;body&gt;
					&lt;case&gt;
						&lt;if condition='${export_format_list.toList().indexOf(format) == 0}'&gt;
							&lt;var-def name="result_url"&gt;
								&lt;xpath expression="string(//response/task/@resultUrl)"&gt;
									&lt;var name="statusResponse" /&gt;
								&lt;/xpath&gt;
							&lt;/var-def&gt;
						&lt;/if&gt;

						&lt;if condition='${export_format_list.toList().indexOf(format) == 1}'&gt;
							&lt;var-def name="result_url"&gt;
								&lt;xpath expression="string(//response/task/@resultUrl2)"&gt;
									&lt;var name="statusResponse" /&gt;
								&lt;/xpath&gt;
							&lt;/var-def&gt;
						&lt;/if&gt;

						&lt;if condition='${export_format_list.toList().indexOf(format) == 2}'&gt;
							&lt;var-def name="result_url"&gt;
								&lt;xpath expression="string(//response/task/@resultUrl3)"&gt;
									&lt;var name="statusResponse" /&gt;
								&lt;/xpath&gt;
							&lt;/var-def&gt;
						&lt;/if&gt;
					&lt;/case&gt;

					&lt;case&gt;
						&lt;if condition='${export_format_list.toList().indexOf(format) @lt 3}'&gt;
							&lt;var-def name="result"&gt;
								&lt;http url="${result_url}" charset="UTF-8" /&gt;
							&lt;/var-def&gt;

							&lt;case&gt;
								&lt;if condition='${format.toString().equals("html")}'&gt;
									&lt;var-def name="path"&gt;
										&lt;template&gt;${bp_run_id}/${document_uuid}/${original_document_name}-html.html&lt;/template&gt;
									&lt;/var-def&gt;

									&lt;var-def name="type"&gt;
										&lt;template&gt;text/html&lt;/template&gt;
									&lt;/var-def&gt;
								&lt;/if&gt;
								&lt;if condition='${format.toString().equals("pdfSearchable")}'&gt;
									&lt;var-def name="path"&gt;
										&lt;template&gt;${bp_run_id}/${document_uuid}/${original_document_name}-pdf.pdf&lt;/template&gt;
									&lt;/var-def&gt;

									&lt;var-def name="type"&gt;
										&lt;template&gt;application/pdf&lt;/template&gt;
									&lt;/var-def&gt;
								&lt;/if&gt;
								&lt;if condition='${format.toString().equals("xml")}'&gt;
									&lt;var-def name="xml_export_format_flag"&gt;
										&lt;script return="flag"&gt;&lt;![CDATA[
											String flag = "true";
										]]&gt;&lt;/script&gt;
									&lt;/var-def&gt;

									&lt;var-def name="result"&gt;
										&lt;script return="res"&gt;&lt;![CDATA[
											// Removing BOM
											String res = result.toString().replaceAll("^\uFEFF", "");
										]]&gt;&lt;/script&gt;
									&lt;/var-def&gt;

									&lt;var-def name="path"&gt;
										&lt;template&gt;${bp_run_id}/${document_uuid}/${original_document_name}-xml.xml&lt;/template&gt;
									&lt;/var-def&gt;

									&lt;var-def name="type"&gt;
										&lt;template&gt;text/xml&lt;/template&gt;
									&lt;/var-def&gt;
								&lt;/if&gt;
								&lt;if condition='${format.toString().equals("xmlForCorrectedImage")}'&gt;
									&lt;var-def name="xml_export_format_flag"&gt;
										&lt;script return="flag"&gt;&lt;![CDATA[
											String flag = "true";
										]]&gt;&lt;/script&gt;
									&lt;/var-def&gt;

									&lt;var-def name="result"&gt;
										&lt;script return="res"&gt;&lt;![CDATA[
											// Removing BOM
											String res = result.toString().replaceAll("^\uFEFF", "");
										]]&gt;&lt;/script&gt;
									&lt;/var-def&gt;

									&lt;var-def name="path"&gt;
										&lt;template&gt;${bp_run_id}/${document_uuid}/${original_document_name}-xmlForCorrectedImage.xml&lt;/template&gt;
									&lt;/var-def&gt;

									&lt;var-def name="type"&gt;
										&lt;template&gt;text/xml&lt;/template&gt;
									&lt;/var-def&gt;
								&lt;/if&gt;
								&lt;if condition='${format.toString().equals("txt")}'&gt;
									&lt;var-def name="path"&gt;
										&lt;template&gt;${bp_run_id}/${document_uuid}/${original_document_name}-txt.txt&lt;/template&gt;
									&lt;/var-def&gt;

									&lt;var-def name="type"&gt;
										&lt;template&gt;text/plain&lt;/template&gt;
									&lt;/var-def&gt;
								&lt;/if&gt;
							&lt;/case&gt;

							&lt;var-def name="ocr_document_url"&gt;
								&lt;s3 bucket="${s3_bucket_name}"&gt;
									&lt;s3-put-public path="${path}" content="${result}"
										content-type="${type}" content-disposition="inline" /&gt;
								&lt;/s3&gt;
							&lt;/var-def&gt;

							&lt;script language="groovy"&gt;&lt;![CDATA[
								def ocr_document_name = ocr_document_url.toString().tokenize('/').last().tokenize('.').first()
							
								Map map = new HashMap();
								
								map.put("original_document_url", original_document_url.toString());
								map.put("original_document_name", original_document_name.toString());
								map.put("ocr_document_url", ocr_document_url.toString());
								map.put("ocr_document_name", ocr_document_name);
								map.put("ocr_export_format", format.toString());
								map.put("ocr_document_format", path.toString().substring(path.toString().lastIndexOf(".") + 1, path.toString().length()));

								ocr_result_list.toList().add(map);
							]]&gt;&lt;/script&gt;
						&lt;/if&gt;
					&lt;/case&gt;

				&lt;/body&gt;
			&lt;/loop&gt;

			&lt;script language="groovy"&gt;&lt;![CDATA[
				import com.google.gson.Gson;

				Gson gson = new Gson();
				String result_json = gson.toJson(ocr_result_list.toList());
				sys.defineVariable("ocr_json", result_json);
			]]&gt;&lt;/script&gt;
		&lt;/if&gt;
	&lt;/case&gt;

	&lt;export include-original-data="true"&gt;
		&lt;single-column name="xml_export_format_flag" value="${xml_export_format_flag}" /&gt;
		&lt;single-column name="ocr_failed" value="${ocr_failed}" /&gt;
		&lt;single-column name="ocr_failed_response" value="${ocr_failed_response}" /&gt;
		&lt;single-column name="ocr_json" value="${ocr_json}" /&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>380a6e3a-20f4-4021-b19b-a0eb9186cbed</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>Response from OCR[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>380a6e3a-20f4-4021-b19b-a0eb9186cbed</uuid>
                                    <version>
                                        <componentUuid>34b28930-f032-4a6c-9166-9ca94fd91a84</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>73345bef-c719-4b35-b8e7-c4902cdcde32</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>Response from OCR[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>fcd0321d-cfe1-48ea-890e-a93a40a04bda</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>7e704017-77ac-4563-80dd-ab504330d58a</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>aa5ff78d-8a6d-40f4-860d-fc1f50e41a86</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>14</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>c1655e78-b15d-42c8-81a6-ae8e7f681d1c</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <businessRule>
                                <content>#RuleContext.APPROVE_ALL_RULE</content>
                                <name>Approve All</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>7a1be1e6-bef2-4b3b-a5d7-a668f4a6d419</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!--
Step to save all new OCR result JSON members into cache data store. The special flag skip_ocr_cache can be set to 1 to force no cache for OCRed results

@Author: Alexey Shalak
@Author: Sergey Emelianov
@Version: 2.5
Workfusion 2018, RPA Express 2.0
--&gt;

&lt;config&gt;
	&lt;var-def name="key"&gt;
		&lt;template&gt;${document_hash}&lt;/template&gt;
	&lt;/var-def&gt;
	
	&lt;var-def name="skip_ocr_cache"&gt;
		&lt;template&gt;${skip_ocr_cache}&lt;/template&gt;
	&lt;/var-def&gt;
  
	&lt;script language="groovy"&gt;&lt;![CDATA[
		import groovy.json.JsonSlurper;

		List&lt;Map&gt; ocr_result_list = new JsonSlurper().parseText(ocr_json.toString());
		sys.defineVariable("ocr_result_list", ocr_result_list);
	]]&gt;&lt;/script&gt;

	&lt;loop item="map"&gt;
		&lt;list&gt;
			&lt;var name="ocr_result_list" /&gt;
		&lt;/list&gt;
		&lt;body&gt;
			&lt;script&gt;&lt;![CDATA[
				Map originalData = new LinkedHashMap();
				originalData.put("key", key.toString());
				originalData.put("cached_at", javax.xml.bind.DatatypeConverter.printDateTime(Calendar.getInstance()));

				originalData.put("ocr_type", ocr_type.toString());
				originalData.put("export_format", map.getWrappedObject().get("ocr_export_format").toString());
				originalData.put("document_language", document_language.toString());
				originalData.put("ocr_xml_char_recognition", ocr_xml_char_recognition.toString());
				originalData.put("allowed_region_types", allowed_region_types.toString());
				originalData.put("custom_regions", custom_regions.toString());
				originalData.put("change_dpi", change_dpi.toString());
				originalData.put("invert_image", invert_image.toString());
				originalData.put("discard_color_image", discard_color_image.toString());
				originalData.put("remove_color_objects", remove_color_objects.toString());
				originalData.put("remove_color_objects_type", remove_color_objects_type.toString());

				originalData.put("ocr_json", new com.google.gson.Gson().toJson(map.getWrappedObject()));
			]]&gt;&lt;/script&gt;

			&lt;var-def name="originalDataJson"&gt;
				&lt;script return="new com.google.gson.Gson().toJson(originalData)" /&gt;
			&lt;/var-def&gt;
			
			&lt;case&gt;
				&lt;if condition='${skip_ocr_cache.toString().length() &gt; 0 &amp;amp;&amp;amp; skip_ocr_cache.toString().equals("1") }'&gt;
					&lt;log level="WARN" message="Process running with SKIP CACHE variable set to 1. No caching."/&gt;
				&lt;/if&gt;
				&lt;else&gt;
					&lt;insert-datastore datastore-name="${cache_datastore}" json-value-map="${originalDataJson}" create="true" /&gt;
				&lt;/else&gt;
			&lt;/case&gt;
		&lt;/body&gt;
	&lt;/loop&gt;
	&lt;export include-original-data="true"/&gt;
&lt;/config&gt;</content>
                                    <description></description>
                                    <includedConfigs/>
                                    <inclusionCode>1d36dc3a-db16-481c-b0f8-83e9532ecd81</inclusionCode>
                                    <jsonParams>{"configXMLModified":"true"}</jsonParams>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>Cache OCR results[Standard+TOOD]</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>1d36dc3a-db16-481c-b0f8-83e9532ecd81</uuid>
                                    <version>
                                        <componentUuid>5c775a4c-1a98-4e24-8b7b-f25333d094d9</componentUuid>
                                        <incrementalVersion>1.2</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-05-20T07:09:08Z</lastModified>
                                        <versionUuid>19a3ea1a-41d7-43b7-b17f-1c7747c75c1b</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>Cache OCR results[Standard+TOOD]</title>
                                <type>SINGLE</type>
                                <uuid>e635b164-a4b4-4c32-ba2d-76d7454b3c91</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>9f728c2d-cbdd-47d5-abc3-f818fa6519a2</componentUuid>
                                    <incrementalVersion>1.2</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>fd4dc7a2-6222-4b35-b85f-d68298208fc5</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>15</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>60ba7184-80e1-45cf-8185-1fffe9af214f</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <blockSize>1</blockSize>
                            <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>WORKFLOW_RULE</ruleType>
                                <ruleTypeUI>Composite</ruleTypeUI>
                                <uuid>fef78d2c-3ad7-422c-85cb-15ffd604113b</uuid>
                                <workflowRuleMode>SIMPLE</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>true</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
                                        &lt;config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy"&gt;

                                        &lt;script&gt;&lt;![CDATA[
                                        poolKey = ['INTAKE_OCR_JOIN_DOC_POOL_KEY'];
                                        ]]&gt;&lt;/script&gt;

                                        &lt;pool key="intake_ocr_join_doc" convert-to-map="false"&gt;
                                        &lt;list&gt;
                                        &lt;script return="poolKey"/&gt;
                                        &lt;/list&gt;
                                        &lt;body&gt;
                                        &lt;script&gt;&lt;![CDATA[
                                        import com.workfusion.odf.core.Intake
                                        import com.workfusion.odf.impl.processor.DocumentOcrLinkProcessor;
                                        import com.workfusion.odf.service.SplitJoinService;


                                        String docId = _sys_doc_id.toString();
                                        Intake intake = Intake.init(binding).params(['_sys_doc_id': docId]).get();
                                        String transactionId = _sys_transaction_id.toString();
                                        intake.processTransaction(DocumentOcrLinkProcessor.class, transactionId);
                                        SplitJoinService splitJoinService = intake.getInstance(SplitJoinService.class);

                                        merged = splitJoinService.joinTransaction(transactionId, docId);
                                        ]]&gt;&lt;/script&gt;
                                        &lt;/body&gt;
                                        &lt;/pool&gt;

                                        &lt;export include-original-data="false"&gt;
                                        &lt;single-column name="_sys_transaction_id" value="${merged ? _sys_transaction_id : ''}"/&gt;
                                        &lt;/export&gt;

                                        &lt;/config&gt;</content>
                                    <gavc>com.workfusion.odf:odf-bcb:1.0:main:Join Documents after OCR</gavc>
                                    <includedConfigs/>
                                    <inclusionCode>com.workfusion.odf:odf-bcb:1.0:main:Join Documents after OCR</inclusionCode>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <machineWorkSettingType>BASIC</machineWorkSettingType>
                                    <name>ODF Bots v1.0 (Join Documents after OCR)</name>
                                    <machineConfigOptions/>
                                    <sourceType>BUNDLE</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>c87abb98-5099-4598-bb4e-abf68e47e05f</uuid>
                                    <version>
                                        <componentUuid>325c00a5-496c-4949-9487-4869f9996d53</componentUuid>
                                        <incrementalVersion>1.10</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-04-16T06:02:26Z</lastModified>
                                        <versionUuid>ea06e82d-8675-4b30-b630-faa613dcf6b2</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>1</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Tasks</streamValueType>
                                <title>ODF Bots v1.0 (Join Documents after OCR)</title>
                                <type>SINGLE</type>
                                <uuid>bca4212e-6824-48d1-8d0c-d75aa8e2fe81</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>2f3ace77-30cb-404d-8322-b910d290a4be</componentUuid>
                                    <incrementalVersion>1.1</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-05-20T07:09:08Z</lastModified>
                                    <versionUuid>993bb7f4-b002-4061-9984-de1326dd6a83</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>16</stepIndex>
                            <stepPosition>INTERMEDIATE</stepPosition>
                            <streamed>false</streamed>
                            <uuid>1d9d543d-7521-4ca7-ae0e-49e505d3f021</uuid>
                        </campaignMap>
                        <campaignMap>
                            <activateTracking>false</activateTracking>
                            <businessRule>
                                <content>package com.freedomoss.requester;

#list any import classes here.
import com.freedomoss.objective.model.CompositeRuleContext;
import com.freedomoss.objective.model.CompositeRuleDataItemContext;
import com.freedomoss.requester.model.AwsHitQuestionItem;
import com.freedomoss.requester.model.AwsHitQuestionAnswerItem;
import org.slf4j.Logger;
import java.util.Map;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.ArrayList;
import com.freedomoss.requester.dto.SubmissionResultDTO;

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



rule "Rule context initialization"
auto-focus true
no-loop
dialect "mvel"
agenda-group "initialization-group"
	when
		$ctx:CompositeRuleContext(initialized == false);
	then
		$ctx.updateWorkingMemory();
		# move to business rules
		$ctx.logExecutedRule(kcontext.getRule().getName());
		kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup("calculation").setFocus();
end</content>
                                <name>Business Process: End Rule</name>
                                <ruleType>WORKFLOW_RULE</ruleType>
                                <uuid>950199e3-546b-49dd-9b27-0d3fe5a32de9</uuid>
                                <workflowRuleMode>ADVANCED</workflowRuleMode>
                            </businessRule>
                            <campaign>
                                <active>false</active>
                                <businessRules/>
                                <campaignMaps/>
                                <campaigns/>
                                <createNewTrainingSet>false</createNewTrainingSet>
                                <executingType>MACHINE</executingType>
                                <goldBucketBlockSize>0</goldBucketBlockSize>
                                <goldRatio>0</goldRatio>
                                <goldSource>Empty</goldSource>
                                <goldType>Percentage</goldType>
                                <includeOriginalData>false</includeOriginalData>
                                <machineConfig>
                                    <answers/>
                                    <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;

    &lt;var-def name="exportType"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_type")}'&gt;
                &lt;template&gt;${_sys_export_type}&lt;/template&gt;
            &lt;/if&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="exportColumns"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_export_columns")}'&gt;
                &lt;template&gt;${_sys_export_columns}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="columnNameCase"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_column_name_case")}'&gt;
                &lt;template&gt;${_sys_column_name_case}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;keep&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="dataOnly"&gt;
        &lt;case&gt;
            &lt;if condition='${sys.isVariableDefined("_sys_data_only")}'&gt;
                &lt;template&gt;${_sys_data_only}&lt;/template&gt;
            &lt;/if&gt;
            &lt;else&gt;true&lt;/else&gt;
        &lt;/case&gt;
    &lt;/var-def&gt;

    &lt;var-def name="datastoreName"&gt;
        &lt;script return="item.getWrappedObject().getRun().getDatastoreName()" /&gt;
    &lt;/var-def&gt;
    &lt;case&gt;
        &lt;if condition="${!datastoreName.isEmpty()}"&gt;
            &lt;insert-datastore   datastore-name="${datastoreName}" create="true"&gt;
                &lt;script return="hit_submission_data_item.getWrappedObject().getItemValueMap()"/&gt;
            &lt;/insert-datastore&gt;
        &lt;/if&gt;
    &lt;/case&gt;

    &lt;export include-original-data="true"
            export-type="${exportType}"
            export-columns="${exportColumns}"
            column-name-case="${columnNameCase}"
            data-only="${dataOnly}"&gt;
    &lt;/export&gt;
&lt;/config&gt;</content>
                                    <description>Default machine campaign for end step.</description>
                                    <includedConfigs/>
                                    <inclusionCode>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</inclusionCode>
                                    <machineWorkSetting>
                                        <category>
                                            <automation>false</automation>
                                            <description></description>
                                            <enabled>true</enabled>
                                            <executingType>MACHINE</executingType>
                                            <name>Other</name>
                                            <private>false</private>
                                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1105</publicId>
                                        </category>
                                        <contentType>BLANK</contentType>
                                        <description></description>
                                        <enabled>true</enabled>
                                        <name>Miscellaneous Tasks</name>
                                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71ac9</publicId>
                                        <version>
                                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>true</lastInChain>
                                            <lastModified>2018-08-31T08:23:08Z</lastModified>
                                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71ac9</versionUuid>
                                        </version>
                                        <answers/>
                                        <machineWorkSettingType>BASIC</machineWorkSettingType>
                                        <template>
                                            <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                            <name>Blank</name>
                                            <origination>CREATED_MANUALLY</origination>
                                            <status>ACTIVE</status>
                                            <type>BASE_MACHINE</type>
                                            <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                            <version>
                                                <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                                <incrementalVersion>1.0</incrementalVersion>
                                                <lastInChain>false</lastInChain>
                                                <lastModified>2012-12-27T00:00:00Z</lastModified>
                                                <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                            </version>
                                        </template>
                                    </machineWorkSetting>
                                    <name>Final Results</name>
                                    <machineConfigOptions/>
                                    <sourceType>MANUAL</sourceType>
                                    <template>
                                        <content>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;config charset="UTF-8"&gt;
	&lt;export include-original-data="true"&gt;
	&lt;/export&gt;
&lt;/config&gt;</content>
                                        <name>Blank</name>
                                        <origination>CREATED_MANUALLY</origination>
                                        <status>ACTIVE</status>
                                        <type>BASE_MACHINE</type>
                                        <uuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</uuid>
                                        <version>
                                            <componentUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</componentUuid>
                                            <incrementalVersion>1.0</incrementalVersion>
                                            <lastInChain>false</lastInChain>
                                            <lastModified>2012-12-27T00:00:00Z</lastModified>
                                            <versionUuid>8f04bd99-7f51-4796-a528-d1a7c9ccfbc4</versionUuid>
                                        </version>
                                    </template>
                                    <uuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</uuid>
                                    <version>
                                        <componentUuid>9e5000e3-c243-42d3-b5ad-c6ac90dec35e</componentUuid>
                                        <incrementalVersion>1.1</incrementalVersion>
                                        <lastInChain>true</lastInChain>
                                        <lastModified>2019-04-22T10:20:40Z</lastModified>
                                        <versionUuid>552d9fa4-ef1b-436d-a72b-e4b0ef988204</versionUuid>
                                    </version>
                                </machineConfig>
                                <moderation>false</moderation>
                                <origination>CREATED_AUTOMATICALLY</origination>
                                <requiresData>true</requiresData>
                                <status>ACTIVE</status>
                                <streamComplexRunThreshold>100</streamComplexRunThreshold>
                                <streamTimeInterval>Immediately</streamTimeInterval>
                                <streamTimeIntervalValue>0</streamTimeIntervalValue>
                                <streamValueType>Percents</streamValueType>
                                <title>Final Results</title>
                                <type>SINGLE</type>
                                <uuid>af4c8905-26dd-4120-b208-39ad3530ffc6</uuid>
                                <validWorkflow>false</validWorkflow>
                                <version>
                                    <componentUuid>d2e7c7c3-18ea-11e9-85ab-0a109913a13e</componentUuid>
                                    <incrementalVersion>1.1</incrementalVersion>
                                    <lastInChain>true</lastInChain>
                                    <lastModified>2019-04-22T10:20:40Z</lastModified>
                                    <versionUuid>438ea8d2-a64c-4bfc-8da2-a0e751c19657</versionUuid>
                                </version>
                                <workSettingBase>false</workSettingBase>
                            </campaign>
                            <deleted>false</deleted>
                            <skipForSTPCalculation>false</skipForSTPCalculation>
                            <stepIndex>17</stepIndex>
                            <stepPosition>END</stepPosition>
                            <streamed>false</streamed>
                            <uuid>a35f0bcf-e930-4177-89c9-5d885d7745cc</uuid>
                        </campaignMap>
                    </campaignMaps>
                    <campaigns/>
                    <compositeCampaignVersion>NEW_WORKFLOW</compositeCampaignVersion>
                    <compositeStructureXml>&lt;mxGraphModel&gt;&lt;root&gt;&lt;mxCell id="0"/&gt;&lt;mxCell id="1" parent="0"/&gt;&lt;Start id="2" name="Start" type="start"&gt;&lt;mxCell parent="1" style="start" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="80.0" y="636.2333374023438"/&gt;&lt;/mxCell&gt;&lt;/Start&gt;&lt;BusinessProcess id="5" name="OCR v2.10.1" type="business_process"&gt;&lt;mxCell collapsed="1" parent="1" style="business_process" vertex="1"&gt;&lt;mxGeometry as="geometry" height="80.0" width="180.0" x="460.0" y="612.0"&gt;&lt;mxRectangle as="alternateBounds" height="190.0" width="563.0" x="460.0" y="640.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/BusinessProcess&gt;&lt;SubStart campaignMapUUID="b37c0503-6c6c-419c-a126-e4800d9c6315" id="6" name="Start" type="sub_start"&gt;&lt;mxCell parent="5" style="start" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="46.033355712890625" y="108.0"/&gt;&lt;/mxCell&gt;&lt;/SubStart&gt;&lt;Link id="7" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="37af7aaf-bbb0-431d-b9dc-abc14e383c44" type="link"&gt;&lt;mxCell edge="1" parent="5" source="101" style="link" target="48"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="349.0" y="179.6666717529297"/&gt;&lt;mxPoint as="targetPoint" x="500.0" y="135.6666717529297"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;BusinessProcess id="47" name="Workfusion OCR with cache (UseCase)[Standard+TOOD]" type="business_process"&gt;&lt;mxCell collapsed="1" parent="5" style="business_process" vertex="1"&gt;&lt;mxGeometry as="geometry" height="80.0" width="180.0" x="309.91668701171875" y="60.0"&gt;&lt;mxRectangle as="alternateBounds" height="712.0" width="910.1166687011719" x="259.0" y="240.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/BusinessProcess&gt;&lt;SubStart campaignMapUUID="9162269c-896d-4951-a93d-8c880260d5cf" id="48" name="Start" type="sub_start"&gt;&lt;mxCell collapsed="1" parent="47" style="start" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="84.0" y="54.0"/&gt;&lt;/mxCell&gt;&lt;/SubStart&gt;&lt;MachineTask campaignMapUUID="bc2be947-c286-4711-96f0-0c174b2d6141" id="49" name="[TOOD] XSLT XML Enrichment with WORD and DIV tags[Standard+TOOD]" taskUUID="31c69509-8fbd-47d2-8533-1b9af44a029f" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="560.0" y="484.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;SubEnd campaignMapUUID="34187509-eaf9-4730-afe9-077dc10a8c0d" id="50" name="End" type="sub_end"&gt;&lt;mxCell collapsed="1" parent="47" style="end" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="631.0" y="660.0"/&gt;&lt;/mxCell&gt;&lt;/SubEnd&gt;&lt;Link id="51" name="" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="48" style="link" target="65"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="targetPoint" x="265.0" y="36.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="52" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="0733f2a9-fc30-4a6f-af83-c41c9b24eb60" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="58" style="link" target="59"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="140.0" y="220.0"/&gt;&lt;mxPoint as="targetPoint" x="140.0" y="250.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Rule id="53" name="OCR Router" ruleUUID="6a0ae88f-e983-4aa6-8b39-341b575afcd1" type="rule"&gt;&lt;mxCell collapsed="1" parent="47" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="84.0" y="424.0"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;Rule id="54" name="OCR Type" ruleUUID="fb804502-2f5f-4111-98e1-baca94ff33c5" type="rule"&gt;&lt;mxCell collapsed="1" parent="47" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="264.0" y="139.0"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;MachineTask campaignMapUUID="765e4fcb-b728-49da-af66-45e5e64d9604" id="55" name="[Standard] OCR[Standard+TOOD]" taskUUID="8cabeeca-cb90-47eb-a7bc-1a0c6ca00313" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="380.1166687011719" y="263.53334045410156"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link conditional="true" id="56" label="Standard" name="" outcomeId="Standard" ruleUUID="fb804502-2f5f-4111-98e1-baca94ff33c5" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="54" style="link" target="55"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="394.0" y="220.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="280.0" y="214.0"/&gt;&lt;mxPoint x="460.0" y="214.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="-30.0" y="-3.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="ac0a86af-cccd-4afa-87a4-2187575207dc" id="57" name="XSLT Cut off Raw OCR XML tags[Standard+TOOD]" taskUUID="bff38b6d-0157-4a15-8b00-519c8bdde7ae" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="200.0" y="484.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;MachineTask campaignMapUUID="f40be433-c81d-4e56-9268-3e5f7c708679" id="58" label="[TOOD] Split document into PNG pages[Standard+TOOD]" name="[TOOD] Split document into PNG pages[Standard+TOOD]" taskUUID="1c195671-2731-435d-868f-289e09d5353f" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="20.0" y="184.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;MachineTask campaignMapUUID="cd329dad-bf94-46b3-aa01-af3bd907a81f" id="59" label="[TOOD] OCR[Standard+TOOD]" name="[TOOD] OCR[Standard+TOOD]" taskUUID="3444a655-432b-4a7e-a997-0a7a04591048" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="20.0" y="264.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link id="60" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="7e994aa6-95ed-47cc-8400-4c30bf97fdae" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="59" style="link" target="61"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="140.0" y="310.0"/&gt;&lt;mxPoint as="targetPoint" x="140.0" y="300.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="260.0" y="294.0"/&gt;&lt;/Array&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="c1655e78-b15d-42c8-81a6-ae8e7f681d1c" id="61" name="Response from OCR[Standard+TOOD]" taskUUID="fcd0321d-cfe1-48ea-890e-a93a40a04bda" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="200.0" y="344.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link id="62" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="bde2c34c-4dc2-4468-8210-37df9b51bd2f" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="55" style="link" target="61"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;Array as="points"&gt;&lt;mxPoint x="300.0" y="294.0"/&gt;&lt;/Array&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="63" name="" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="61" style="link" target="53"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;Array as="points"&gt;&lt;mxPoint x="100.0" y="374.0"/&gt;&lt;/Array&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="64" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="31d4dc9b-55b5-405e-8d0c-9fd8b798ed8a" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="65" style="link" target="76"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="320.0" y="47.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="cc8d2520-2a99-4c4c-9938-884504103caf" id="65" name="Input data processing[Standard+TOOD]" taskUUID="f3314c30-8af8-44e3-b34a-edd0878e710b" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="200.0" y="40.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;MachineTask campaignMapUUID="6cb1c74e-2c5a-433e-976e-7b5f24f85486" id="66" name="Result JSON processing[Standard+TOOD]" taskUUID="179de67c-d954-40f5-9a6d-688e2d40cca5" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="730.1166687011719" y="323.53334045410156"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link conditional="true" id="67" label="OCR Failed" name="" outcomeId="OCR Failed" ruleUUID="6a0ae88f-e983-4aa6-8b39-341b575afcd1" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="53" style="link" target="50"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="520.0" y="400.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="100.0" y="670.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="-210.0" y="-6.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="68" label="TOOD" name="" outcomeId="TOOD" ruleUUID="6a0ae88f-e983-4aa6-8b39-341b575afcd1" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="53" style="link" target="57"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="240.0" y="460.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="100.0" y="504.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" y="24.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="69" label="Standard" name="" outcomeId="Standard" ruleUUID="6a0ae88f-e983-4aa6-8b39-341b575afcd1" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="53" style="link" target="57"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="320.0" y="670.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="100.0" y="524.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" y="34.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="70" label="Standard (without xml export format)" name="" outcomeId="Standard (without xml export format)" ruleUUID="6a0ae88f-e983-4aa6-8b39-341b575afcd1" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="53" style="link" target="77"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="80.0" y="660.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="100.0" y="604.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="-120.0" y="74.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Rule id="71" name="OCR Type" ruleUUID="d31d2068-6757-4807-a6b3-1d32ee513f1a" type="rule"&gt;&lt;mxCell collapsed="1" parent="47" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="444.0" y="498.0"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;Link conditional="true" id="72" label="TOOD" name="" outcomeId="TOOD" ruleUUID="d31d2068-6757-4807-a6b3-1d32ee513f1a" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="71" style="link" target="49"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="610.0" y="543.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="73" label="Standard" name="" outcomeId="Standard" ruleUUID="d31d2068-6757-4807-a6b3-1d32ee513f1a" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="71" style="link" target="77"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="540.0" y="590.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="460.0" y="584.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="10.0" y="27.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="74" name="" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="57" style="link" target="71"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"/&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="75" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="4f6adbf1-3d29-4c78-80fa-d169deafa185" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="49" style="link" target="77"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="c5df78a2-9e8c-462c-9db1-0ca38ada629d" id="76" label="Look for OCR cache[Standard+TOOD]" name="Look for OCR cache[Standard+TOOD]" taskUUID="89d4afad-3323-4298-bc70-3d89161b2608" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="380.1166687011719" y="40.23333740234375"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;MachineTask campaignMapUUID="60ba7184-80e1-45cf-8185-1fffe9af214f" id="77" label="Cache OCR results[Standard+TOOD]" name="Cache OCR results[Standard+TOOD]" taskUUID="e635b164-a4b4-4c32-ba2d-76d7454b3c91" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="560.1166687011719" y="564.2333374023438"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Rule id="78" name="Cache hit?" ruleUUID="de12e01a-cb53-4ec9-ae72-9e550d0eda15" type="rule"&gt;&lt;mxCell collapsed="1" parent="47" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="624.0" y="54.0"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;Link id="79" name="" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="76" style="link" target="78"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"/&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="80" label="Yes" name="" outcomeId="Yes" ruleUUID="de12e01a-cb53-4ec9-ae72-9e550d0eda15" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="78" style="link" target="66"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="750.0" y="21.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="810.0" y="70.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="-38.0" y="-183.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="false" id="81" label="No" name="" outcomeId="No" ruleUUID="de12e01a-cb53-4ec9-ae72-9e550d0eda15" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="78" style="link" target="83"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="563.0" y="120.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="640.0" y="154.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="59.0" y="4.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="82" name="" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="83" style="link" target="54"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="437.0" y="120.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="800c5340-2659-4169-a69d-93491291a5a0" id="83" label="" name="GoTo OCR[Standard+TOOD]" streamed="false" taskUUID="596efa8a-fe2c-4b39-9345-d452749d9e9b" type="machine_task"&gt;&lt;mxCell collapsed="1" parent="47" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="41.0" width="126.0" x="397.0" y="134.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link conditional="true" id="84" label="TOOD" name="" outcomeId="TOOD" ruleUUID="fb804502-2f5f-4111-98e1-baca94ff33c5" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="54" style="link" target="58"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="424.0" y="105.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="280.0" y="214.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" y="22.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="85" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="7a1be1e6-bef2-4b3b-a5d7-a668f4a6d419" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="77" style="link" target="66"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"/&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="86" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="43f146dc-4f98-4c7c-8772-d268cbef3152" type="link"&gt;&lt;mxCell collapsed="1" edge="1" parent="47" source="66" style="link" target="50"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;Array as="points"&gt;&lt;mxPoint x="851.0" y="676.0"/&gt;&lt;/Array&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;SubEnd campaignMapUUID="525ee0b4-8772-49b9-9a2b-f0997ee0f6c5" id="97" name="End" type="sub_end"&gt;&lt;mxCell parent="5" style="end" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="520.0333557128906" y="108.0"/&gt;&lt;/mxCell&gt;&lt;/SubEnd&gt;&lt;Link id="100" name="" type="link"&gt;&lt;mxCell edge="1" parent="5" source="6" style="link" target="101"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="targetPoint" x="349.1166687011719" y="119.66667175292969"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="a37f9554-ba82-4766-a297-0fc9733a009a" id="101" label="OCR ODF v0.3 Settings" name="OCR Intake v0.3 Settings" originalLabel="OCR Intake v0.3 Settings" taskUUID="b1ac25b5-047f-44c5-8b9f-964a0764e0ac" type="machine_task"&gt;&lt;mxCell parent="5" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="110.00001525878906" y="80.0"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;Link id="113" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="c478035f-4283-4ab5-8999-ef20fc801d62" type="link"&gt;&lt;mxCell edge="1" parent="5" source="50" style="link" target="97"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"/&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Rule id="102" name="Join Documents" ruleUUID="fef78d2c-3ad7-422c-85cb-15ffd604113b" type="rule"&gt;&lt;mxCell parent="1" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="930.1166687011719" y="636.2333374023438"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;Link conditional="false" id="103" label="Joined Transaction" name="" outcomeId="Joined Transaction" ruleUUID="fef78d2c-3ad7-422c-85cb-15ffd604113b" type="link"&gt;&lt;mxCell edge="1" parent="1" source="102" style="link" target="104"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="721.0" y="337.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;End campaignMapUUID="a35f0bcf-e930-4177-89c9-5d885d7745cc" id="104" name="End" type="end"&gt;&lt;mxCell parent="1" style="end" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="1090.1166687011719" y="636.2333374023438"/&gt;&lt;/mxCell&gt;&lt;/End&gt;&lt;Link id="105" name="" type="link"&gt;&lt;mxCell edge="1" parent="1" source="117" style="link" target="102"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="860.1111068725586" y="652.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="106" name="" outcome="ApproveAll" outcomeId="ApproveAll" ruleUUID="36b186f1-7a6e-4a40-9ef3-8409d7a2d58d" type="link"&gt;&lt;mxCell edge="1" parent="1" source="97" style="link" target="117"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="targetPoint" x="700.1111068725586" y="652.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link id="108" name="" type="link"&gt;&lt;mxCell edge="1" parent="1" source="2" style="link" target="118"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="targetPoint" x="140.1111068725586" y="652.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="true" id="110" label="Yes" name="" outcomeId="Yes" ruleUUID="a5859559-31cb-444f-be55-dd07f905a75a" type="link"&gt;&lt;mxCell edge="1" parent="1" source="109" style="link" target="6"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="310.0" y="211.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Link conditional="false" id="111" label="No" name="" outcomeId="No" ruleUUID="a5859559-31cb-444f-be55-dd07f905a75a" type="link"&gt;&lt;mxCell edge="1" parent="1" source="109" style="link" target="104"&gt;&lt;mxGeometry as="geometry"&gt;&lt;mxPoint as="targetPoint" x="310.0" y="241.0"/&gt;&lt;Array as="points"&gt;&lt;mxPoint x="346.0" y="571.0"/&gt;&lt;mxPoint x="1106.0" y="571.0"/&gt;&lt;/Array&gt;&lt;mxPoint as="offset" x="4.0" y="-56.0"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;Rule id="109" name="Any Docs" ruleUUID="a5859559-31cb-444f-be55-dd07f905a75a" type="rule"&gt;&lt;mxCell parent="1" style="rule" vertex="1"&gt;&lt;mxGeometry as="geometry" height="32.0" width="32.0" x="330.0" y="636.2333374023438"/&gt;&lt;/mxCell&gt;&lt;/Rule&gt;&lt;Link id="112" name="" outcomeId="ApproveAll" ruleUUID="ba4fca6f-6155-4bda-d7a8-8946e408bbb7" type="link"&gt;&lt;mxCell edge="1" parent="1" source="118" style="link" target="109"&gt;&lt;mxGeometry as="geometry" relative="1" x="0.5" y="10.0"&gt;&lt;mxPoint as="sourcePoint" x="300.1111068725586" y="652.0"/&gt;&lt;mxPoint as="targetPoint" x="400.0" y="96.0"/&gt;&lt;Array as="points"/&gt;&lt;/mxGeometry&gt;&lt;/mxCell&gt;&lt;/Link&gt;&lt;MachineTask campaignMapUUID="1d9d543d-7521-4ca7-ae0e-49e505d3f021" id="117" name="Intake Bots v1.0 (Join Documents after OCR)" taskUUID="bca4212e-6824-48d1-8d0c-d75aa8e2fe81" type="machine_task"&gt;&lt;mxCell parent="1" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="699.5555419921875" y="622.2083320617676"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;MachineTask campaignMapUUID="a46480a2-7186-4bab-b774-380beb5029e9" id="118" name="Intake Bots v1.0 (Split Documents for OCR)" taskUUID="c362ac2a-285a-4dba-aaf8-991bcd2876df" type="machine_task"&gt;&lt;mxCell parent="1" style="machine_task" vertex="1"&gt;&lt;mxGeometry as="geometry" height="60.0" width="160.0" x="139.5555419921875" y="622.2083320617676"/&gt;&lt;/mxCell&gt;&lt;/MachineTask&gt;&lt;/root&gt;&lt;/mxGraphModel&gt;</compositeStructureXml>
                    <compositeWorkSetting>
                        <category>
                            <automation>false</automation>
                            <description></description>
                            <enabled>true</enabled>
                            <executingType>HUMAN</executingType>
                            <name>Other</name>
                            <private>false</private>
                            <publicId>dd92f240-144b-4fef-8476-4ec0acbc1104</publicId>
                        </category>
                        <contentType>BLANK</contentType>
                        <description></description>
                        <enabled>true</enabled>
                        <name>Miscellaneous Tasks</name>
                        <publicId>26e6e095-00bb-43fa-8c34-af0b18e71a66</publicId>
                        <version>
                            <componentUuid>26e6e095-00bb-43fa-8c34-af0b18e71a66</componentUuid>
                            <incrementalVersion>1.0</incrementalVersion>
                            <lastInChain>true</lastInChain>
                            <lastModified>2019-01-15T17:27:11Z</lastModified>
                            <versionUuid>26e6e095-00bb-43fa-8c34-af0b18e71a66</versionUuid>
                        </version>
                        <automationQualityThreshold>80</automationQualityThreshold>
                    </compositeWorkSetting>
                    <createNewTrainingSet>false</createNewTrainingSet>
                    <description>Business Process description</description>
                    <executingType>COMPOSITE</executingType>
                    <goldBucketBlockSize>0</goldBucketBlockSize>
                    <goldRatio>0</goldRatio>
                    <goldSource>Empty</goldSource>
                    <goldType>Percentage</goldType>
                    <includeOriginalData>false</includeOriginalData>
                    <moderation>false</moderation>
                    <origination>CREATED_AUTOMATICALLY</origination>
                    <requiresData>false</requiresData>
                    <status>ACTIVE</status>
                    <streamComplexRunThreshold>1</streamComplexRunThreshold>
                    <streamTimeInterval>Immediately</streamTimeInterval>
                    <streamTimeIntervalValue>0</streamTimeIntervalValue>
                    <streamValueType>Tasks</streamValueType>
                    <title>ODF OCR v1.0</title>
                    <type>COMPOSITE</type>
                    <uuid>fe17432a-1544-41b4-8a89-43881188281c</uuid>
                    <validWorkflow>true</validWorkflow>
                    <version>
                        <componentUuid>2a8add2f-c2d2-4591-af47-98d4a5952ea5</componentUuid>
                        <incrementalVersion>1.1</incrementalVersion>
                        <lastInChain>true</lastInChain>
                        <lastModified>2019-09-02T06:52:23Z</lastModified>
                        <versionUuid>eefd3a31-c25f-4a4d-be37-7ab9324fafe7</versionUuid>
                    </version>
                    <workSettingBase>true</workSettingBase>
                </campaign>
            </compositeWorkSetting>
            <hashCode>-1236840242</hashCode>
        </objectContainer>
    </objects>
</objectListWrapper>
