As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<?xml version="1.0" encoding="UTF-8"?><br><definitions xmlns="<a href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer">http://www.omg.org/spec/BPMN/20100524/MODEL</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow noopener noreferrer">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns:activiti="<a href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer">http://activiti.org/bpmn</a>" xmlns:bpmndi="<a href="http://www.omg.org/spec/BPMN/20100524/DI" rel="nofollow noopener noreferrer">http://www.omg.org/spec/BPMN/20100524/DI</a>" xmlns:smileysurprised:mgdc="<a href="http://www.omg.org/spec/DD/20100524/DC" rel="nofollow noopener noreferrer">http://www.omg.org/spec/DD/20100524/DC</a>" xmlns:smileysurprised:mgdi="<a href="http://www.omg.org/spec/DD/20100524/DI" rel="nofollow noopener noreferrer">http://www.omg.org/spec/DD/20100524/DI</a>" typeLanguage="<a href="http://www.w3.org/2001/XMLSchema" rel="nofollow noopener noreferrer">http://www.w3.org/2001/XMLSchema</a>" expressionLanguage="<a href="http://www.w3.org/1999/XPath" rel="nofollow noopener noreferrer">http://www.w3.org/1999/XPath</a>" targetNamespace="<a href="http://www.activiti.org/test" rel="nofollow noopener noreferrer">http://www.activiti.org/test</a>"><br> <process id="DartProcess" name="DartProcess"><br> <documentation>Process definition for Dart BI process.</documentation><br> <startEvent id="DartWorkflowStart" name="DartWorkflowStart"><br> <extensionElements><br> <activiti:formProperty id="ShellScriptRoot" name="Shell Script Root Directory" type="string" value="${ShellScriptRoot}" variable="ShellScriptRoot" required="true" readable="true" writable="true"></activiti:formProperty><br> <activiti:formProperty id="ShellScriptSuffix" name="Shell Script Suffix" type="string" value="${ShellScriptSuffix}" variable="ShellScriptSuffix" required="true" readable="true" writable="true"></activiti:formProperty><br> <activiti:formProperty id="DartRunDate" name="DartRunDate (mm\/dd\/yyyy)" type="string" value="${DartRunDate}" variable="DartRunDate" required="true" readable="true" writable="true"></activiti:formProperty><br> </extensionElements><br> </startEvent><br> <serviceTask id="NetGStageServiceTask" name="NetGStageService Task" activiti:async="true" activiti:class="com.scrippsnetworks.ibi.revenueWorkflows.serviceTasks.ShellServiceTask"><br> <extensionElements><br> <activiti:field name="command"><br> <activiti:expression>${ShellScriptRoot}/ADSD/adsd_staging${ShellScriptSuffix}</activiti:expression><br> </activiti:field><br> <activiti:field name="wait"><br> <activiti:string>true</activiti:string><br> </activiti:field><br> <activiti:field name="outputVariable"><br> <activiti:string>netGStageStatus</activiti:string><br> </activiti:field><br> <activiti:field name="errorCodeVariable"><br> <activiti:string>netGStageReturnCode</activiti:string><br> </activiti:field><br> <activiti:field name="arg1"><br> <activiti:expression>${DartRunDate}</activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway><br> <serviceTask id="InfaProcessServiceTask" name="InfaProcessService Task" activiti:async="true" activiti:class="com.scrippsnetworks.ibi.revenueWorkflows.serviceTasks.ShellServiceTask"><br> <extensionElements><br> <activiti:field name="command"><br> <activiti:expression>${ShellScriptRoot}/ADSD/adsd_infa${ShellScriptSuffix}</activiti:expression><br> </activiti:field><br> <activiti:field name="wait"><br> <activiti:string>true</activiti:string><br> </activiti:field><br> <activiti:field name="outputVariable"><br> <activiti:string>infaProcessStatus</activiti:string><br> </activiti:field><br> <activiti:field name="errorCodeVariable"><br> <activiti:string>infaProcessReturnCode</activiti:string><br> </activiti:field><br> <activiti:field name="arg1"><br> <activiti:expression>${DartRunDate}</activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway><br> <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway><br> <endEvent id="DartWorkflowEnd" name="DartWorkflowEnd"></endEvent><br> <userTask id="FixInfaProcessUserTask" name="FixInfaProcessUserTask" activiti:candidateGroups="InfaGroup, WFGroup"><br> <documentation>DART Informatica Processes failed with status:<br><br>${infaProcessStatus}</documentation><br> <extensionElements><br> <activiti:formProperty id="infaProcessContinueWorkflow" name="Continue Workflow?" type="enum" variable="infaProcessContinueWorkflow" default="true" required="true" readable="true" writable="true"><br> <activiti:value id="true" name="Yes"></activiti:value><br> <activiti:value id="false" name="No"></activiti:value><br> </activiti:formProperty><br> </extensionElements><br> </userTask><br> <serviceTask id="FixInfaProcessEmailNotification" name="FixInfaProcessEmailNotification" activiti:type="mail"><br> <extensionElements><br> <activiti:field name="to" expression="aoliver@scrippsnetworks.com,jjohnston@scrippsnetworks.com,mlugonjic@scrippsnetworks.com,cwoodall@scrippsnetworks.com"></activiti:field><br> <activiti:field name="from" expression="ibiWorkflowEngine@scrippsnetworks.com"></activiti:field><br> <activiti:field name="subject" expression="DART Infa Process Failure - TEST"></activiti:field><br> <activiti:field name="html"><br> <activiti:expression><![CDATA[This is a test of the DART Infa Process Task workflow. This is only a test. In the event of a real DART Infa Process failure, you will receive an email similar to this one.<br><p /><br>Status is: <br /><br>${infaProcessStatus}<br><p /><br>Sincerely,<br /><br>Your friendly, neighborhood IBI workflow engine]]></activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <serviceTask id="FixBOReportPrepEmailNotification" name="FixBOReportPrepEmailNotification" activiti:type="mail"><br> <extensionElements><br> <activiti:field name="to" expression="aoliver@scrippsnetworks.com,jjohnston@scrippsnetworks.com,mlugonjic@scrippsnetworks.com,cwoodall@scrippsnetworks.com"></activiti:field><br> <activiti:field name="from" expression="ibiWorkflowEngine@scrippsnetworks.com"></activiti:field><br> <activiti:field name="subject" expression="DART BO Report Prep Failure - TEST"></activiti:field><br> <activiti:field name="html"><br> <activiti:expression><![CDATA[This is a test of the DART BO Report Prep Task workflow. This is only a test. In the event of a real DART BO Report Prep failure, you will receive an email similar to this one.<br><p /><br>Status is:<br /><br>${boReportPrepStatus}<br><p /><br>Sincerely,<br /><br>Your friendly, neighborhood IBI workflow engine]]></activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <userTask id="FixBOReportPrepUserTask" name="FixBOReportPrepUserTask" activiti:candidateGroups="InfaGroup, WFGroup"><br> <documentation>DART BO Report Prep failed with status:<br><br>${boReportPrepStatus}</documentation><br> <extensionElements><br> <activiti:formProperty id="boReportPrepContinueWorkflow" name="Continue Workflow?" type="enum" variable="boReportPrepContinueWorkflow" default="true" required="true" readable="true" writable="true"><br> <activiti:value id="true" name="Yes"></activiti:value><br> <activiti:value id="false" name="No"></activiti:value><br> </activiti:formProperty><br> </extensionElements><br> </userTask><br> <serviceTask id="NetGStageFailureEmailNotification" name="Email Notification of NetG Stage Failure" activiti:type="mail"><br> <extensionElements><br> <activiti:field name="to" expression="aoliver@scrippsnetworks.com,jjohnston@scrippsnetworks.com,mlugonjic@scrippsnetworks.com,cwoodall@scrippsnetworks.com"></activiti:field><br> <activiti:field name="from" expression="ibiWorkflowEngine@scrippsnetworks.com"></activiti:field><br> <activiti:field name="subject" expression="NetG Stage Service Failure - TEST"></activiti:field><br> <activiti:field name="html"><br> <activiti:expression><![CDATA[This is a test of the NetGStage Service Task workflow. This is only a test. In the event of a real NetGStage Service Task failure, you will receive an email similar to this one.<br><p /><br>Status is:<br /><br>${netGStageStatus}<br><p /><br>Sincerely,<br /><br>Your friendly, neighborhood IBI workflow engine]]></activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <endEvent id="NetGStageFailureEnd" name="NetGStageFailureEnd"></endEvent><br> <exclusiveGateway id="exclusivegateway4" name="Exclusive Gateway"></exclusiveGateway><br> <endEvent id="InfaProcessFailureEnd" name="InfaProcessFailureEnd"></endEvent><br> <exclusiveGateway id="exclusivegateway5" name="Exclusive Gateway"></exclusiveGateway><br> <endEvent id="BOReportPrepFailureEnd" name="BOReportPrepFailureEnd"></endEvent><br> <serviceTask id="ImpressionVerification" name="ImpressionVerification" activiti:async="true" activiti:class="com.scrippsnetworks.ibi.revenueWorkflows.serviceTasks.ShellServiceTask"><br> <extensionElements><br> <activiti:field name="command"><br> <activiti:expression>${ShellScriptRoot}/ADSD/adsd_validate${ShellScriptSuffix}</activiti:expression><br> </activiti:field><br> <activiti:field name="wait"><br> <activiti:string>true</activiti:string><br> </activiti:field><br> <activiti:field name="outputVariable"><br> <activiti:string>impressionVerificationStatus</activiti:string><br> </activiti:field><br> <activiti:field name="errorCodeVariable"><br> <activiti:string>impressionVerificationReturnCode</activiti:string><br> </activiti:field><br> <activiti:field name="arg1"><br> <activiti:expression>${DartRunDate}</activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <exclusiveGateway id="exclusivegateway6" name="Exclusive Gateway"></exclusiveGateway><br> <serviceTask id="ImpressionVerificationEmailNotification" name="ImpressionVerificationEmailNotification" activiti:type="mail"><br> <extensionElements><br> <activiti:field name="to" expression="aoliver@scrippsnetworks.com,jjohnston@scrippsnetworks.com,mlugonjic@scrippsnetworks.com,cwoodall@scrippsnetworks.com"></activiti:field><br> <activiti:field name="from" expression="ibiWorkflowEngine@scrippsnetworks.com"></activiti:field><br> <activiti:field name="subject" expression="DART Impression Verification Warning - TEST"></activiti:field><br> <activiti:field name="html"><br> <activiti:expression><![CDATA[This is a test of the DART Impression Verification Task workflow. This is only a test. In the event of a real DART Impression Verification failure, you will receive an email similar to this one.<br><p /><br>Status is:<br /><br>${impressionVerificationStatus}<br><p><br>Sincerely,<br /><br>Your friendly, neighborhood IBI workflow engine]]></activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <userTask id="ImpressionVerificationUserTask" name="ImpressionVerificationUserTask" activiti:candidateGroups="InfaGroup, WFGroup"><br> <documentation>DART Impression Verification failed with status:<br><br>${impressionVerificationStatus}</documentation><br> <extensionElements><br> <activiti:formProperty id="impressionVerificationContinueWorkflow" name="Continue Workflow?" type="enum" variable="impressionVerificationContinueWorkflow" default="true" required="true" readable="true" writable="true"><br> <activiti:value id="true" name="Yes"></activiti:value><br> <activiti:value id="false" name="No"></activiti:value><br> </activiti:formProperty><br> </extensionElements><br> </userTask><br> <exclusiveGateway id="exclusivegateway7" name="Exclusive Gateway"></exclusiveGateway><br> <endEvent id="ImpressionVerificationFailureEnd" name="ImpressionVerificationFailureEnd"></endEvent><br> <serviceTask id="BOReportPrepServiceTask" name="BOReportPrepServiceTask" activiti:async="true" activiti:class="com.scrippsnetworks.ibi.revenueWorkflows.serviceTasks.ShellServiceTask"><br> <extensionElements><br> <activiti:field name="command"><br> <activiti:expression>${ShellScriptRoot}/ADSD/adsd_reportprep${ShellScriptSuffix}</activiti:expression><br> </activiti:field><br> <activiti:field name="wait"><br> <activiti:string>true</activiti:string><br> </activiti:field><br> <activiti:field name="outputVariable"><br> <activiti:string>boReportPrepStatus</activiti:string><br> </activiti:field><br> <activiti:field name="errorCodeVariable"><br> <activiti:string>boReportPrepReturnCode</activiti:string><br> </activiti:field><br> <activiti:field name="arg1"><br> <activiti:expression>${DartRunDate}</activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <serviceTask id="DartSetup" name="DartSetup" activiti:async="true" activiti:class="com.scrippsnetworks.ibi.revenueWorkflows.serviceTasks.ShellServiceTask"><br> <extensionElements><br> <activiti:field name="command"><br> <activiti:expression>${ShellScriptRoot}/ADSD/adsd_setup${ShellScriptSuffix}</activiti:expression><br> </activiti:field><br> <activiti:field name="wait"><br> <activiti:string>true</activiti:string><br> </activiti:field><br> <activiti:field name="outputVariable"><br> <activiti:string>dartSetupStatus</activiti:string><br> </activiti:field><br> <activiti:field name="errorCodeVariable"><br> <activiti:string>dartSetupReturnCode</activiti:string><br> </activiti:field><br> <activiti:field name="arg1"><br> <activiti:expression>${DartRunDate}</activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <serviceTask id="DartSetupEmailNotification" name="DartSetupEmailNotification" activiti:type="mail"><br> <extensionElements><br> <activiti:field name="to" expression="aoliver@scrippsnetworks.com,jjohnston@scrippsnetworks.com,mlugonjic@scrippsnetworks.com,cwoodall@scrippsnetworks.com"></activiti:field><br> <activiti:field name="from" expression="ibiWorkflowEngine@scrippsnetworks.com"></activiti:field><br> <activiti:field name="subject" expression="DART Setup Service Failure - TEST"></activiti:field><br> <activiti:field name="html"><br> <activiti:expression><![CDATA[This is a test of the DART Setup Service Task workflow. This is only a test. In the event of a real DART Setup Service Task failure, you will receive an email similar to this one.<br><p /><br>Status is:<br /><br>${dartSetupStatus}<br><p /><br>Sincerely,<br /><br>Your friendly, neighborhood IBI workflow engine]]></activiti:expression><br> </activiti:field><br> </extensionElements><br> </serviceTask><br> <exclusiveGateway id="exclusivegateway8" name="Exclusive Gateway"></exclusiveGateway><br> <endEvent id="DartSetupFailureEnd" name="DartSetupFailureEnd"></endEvent><br> <sequenceFlow id="flow2" name="" sourceRef="NetGStageServiceTask" targetRef="exclusivegateway1"></sequenceFlow><br> <sequenceFlow id="flow3" name="" sourceRef="exclusivegateway1" targetRef="InfaProcessServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${netGStageReturnCode=="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow5" name="" sourceRef="InfaProcessServiceTask" targetRef="exclusivegateway2"></sequenceFlow><br> <sequenceFlow id="flow9" name="" sourceRef="exclusivegateway3" targetRef="DartWorkflowEnd"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${boReportPrepReturnCode=="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow17" name="" sourceRef="exclusivegateway2" targetRef="FixInfaProcessEmailNotification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${infaProcessReturnCode!="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow18" name="" sourceRef="FixInfaProcessEmailNotification" targetRef="FixInfaProcessUserTask"></sequenceFlow><br> <sequenceFlow id="flow20" name="" sourceRef="exclusivegateway3" targetRef="FixBOReportPrepEmailNotification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${boReportPrepReturnCode!="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow21" name="" sourceRef="FixBOReportPrepEmailNotification" targetRef="FixBOReportPrepUserTask"></sequenceFlow><br> <sequenceFlow id="flow24" name="" sourceRef="exclusivegateway1" targetRef="NetGStageFailureEmailNotification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${netGStageReturnCode!="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow25" name="" sourceRef="NetGStageFailureEmailNotification" targetRef="NetGStageFailureEnd"></sequenceFlow><br> <sequenceFlow id="flow26" name="" sourceRef="FixInfaProcessUserTask" targetRef="exclusivegateway4"></sequenceFlow><br> <sequenceFlow id="flow27" name="" sourceRef="exclusivegateway4" targetRef="InfaProcessServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${infaProcessContinueWorkflow=="true"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow28" name="" sourceRef="exclusivegateway4" targetRef="InfaProcessFailureEnd"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${infaProcessContinueWorkflow=="false"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow29" name="" sourceRef="FixBOReportPrepUserTask" targetRef="exclusivegateway5"></sequenceFlow><br> <sequenceFlow id="flow31" name="" sourceRef="exclusivegateway5" targetRef="BOReportPrepFailureEnd"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${boReportPrepContinueWorkflow=="false"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow32" name="" sourceRef="exclusivegateway2" targetRef="ImpressionVerification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${infaProcessReturnCode=="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow33" name="" sourceRef="ImpressionVerification" targetRef="exclusivegateway6"></sequenceFlow><br> <sequenceFlow id="flow35" name="" sourceRef="exclusivegateway6" targetRef="ImpressionVerificationEmailNotification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${impressionVerificationReturnCode!="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow36" name="" sourceRef="ImpressionVerificationEmailNotification" targetRef="ImpressionVerificationUserTask"></sequenceFlow><br> <sequenceFlow id="flow37" name="" sourceRef="ImpressionVerificationUserTask" targetRef="exclusivegateway7"></sequenceFlow><br> <sequenceFlow id="flow39" name="" sourceRef="exclusivegateway7" targetRef="ImpressionVerificationFailureEnd"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${impressionVerificationContinueWorkflow=="false"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow40" name="" sourceRef="exclusivegateway6" targetRef="BOReportPrepServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${impressionVerificationReturnCode=="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow41" name="" sourceRef="BOReportPrepServiceTask" targetRef="exclusivegateway3"></sequenceFlow><br> <sequenceFlow id="flow42" name="" sourceRef="exclusivegateway5" targetRef="BOReportPrepServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${boReportPrepContinueWorkflow=="true"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow43" name="" sourceRef="exclusivegateway7" targetRef="BOReportPrepServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${impressionVerificationContinueWorkflow=="true"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow44" name="" sourceRef="DartWorkflowStart" targetRef="DartSetup"></sequenceFlow><br> <sequenceFlow id="flow46" name="" sourceRef="DartSetup" targetRef="exclusivegateway8"></sequenceFlow><br> <sequenceFlow id="flow47" name="" sourceRef="exclusivegateway8" targetRef="NetGStageServiceTask"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${dartSetupReturnCode=="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow48" name="" sourceRef="exclusivegateway8" targetRef="DartSetupEmailNotification"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${dartSetupReturnCode!="0"}]]></conditionExpression><br> </sequenceFlow><br> <sequenceFlow id="flow49" name="" sourceRef="DartSetupEmailNotification" targetRef="DartSetupFailureEnd"></sequenceFlow><br> </process><br> <bpmndi:BPMNDiagram id="BPMNDiagram_DartProcess"><br> <bpmndi:BPMNPlane bpmnElement="DartProcess" id="BPMNPlane_DartProcess"><br> <bpmndi:BPMNShape bpmnElement="DartWorkflowStart" id="BPMNShape_DartWorkflowStart"><br> <omgdc:Bounds height="35" width="35" x="100" y="90"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="NetGStageServiceTask" id="BPMNShape_NetGStageServiceTask"><br> <omgdc:Bounds height="55" width="105" x="440" y="80"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1"><br> <omgdc:Bounds height="40" width="40" x="600" y="87"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="InfaProcessServiceTask" id="BPMNShape_InfaProcessServiceTask"><br> <omgdc:Bounds height="55" width="105" x="700" y="80"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2"><br> <omgdc:Bounds height="40" width="40" x="860" y="87"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3"><br> <omgdc:Bounds height="40" width="40" x="1438" y="87"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="DartWorkflowEnd" id="BPMNShape_DartWorkflowEnd"><br> <omgdc:Bounds height="35" width="35" x="1523" y="90"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="FixInfaProcessUserTask" id="BPMNShape_FixInfaProcessUserTask"><br> <omgdc:Bounds height="55" width="105" x="828" y="280"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="FixInfaProcessEmailNotification" id="BPMNShape_FixInfaProcessEmailNotification"><br> <omgdc:Bounds height="55" width="105" x="828" y="181"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="FixBOReportPrepEmailNotification" id="BPMNShape_FixBOReportPrepEmailNotification"><br> <omgdc:Bounds height="57" width="105" x="1406" y="183"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="FixBOReportPrepUserTask" id="BPMNShape_FixBOReportPrepUserTask"><br> <omgdc:Bounds height="55" width="105" x="1406" y="280"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="NetGStageFailureEmailNotification" id="BPMNShape_NetGStageFailureEmailNotification"><br> <omgdc:Bounds height="55" width="105" x="568" y="181"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="NetGStageFailureEnd" id="BPMNShape_NetGStageFailureEnd"><br> <omgdc:Bounds height="35" width="35" x="603" y="280"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway4" id="BPMNShape_exclusivegateway4"><br> <omgdc:Bounds height="40" width="40" x="732" y="287"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="InfaProcessFailureEnd" id="BPMNShape_InfaProcessFailureEnd"><br> <omgdc:Bounds height="35" width="35" x="735" y="361"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway5" id="BPMNShape_exclusivegateway5"><br> <omgdc:Bounds height="40" width="40" x="1310" y="287"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="BOReportPrepFailureEnd" id="BPMNShape_BOReportPrepFailureEnd"><br> <omgdc:Bounds height="35" width="35" x="1313" y="361"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="ImpressionVerification" id="BPMNShape_ImpressionVerification"><br> <omgdc:Bounds height="55" width="105" x="960" y="80"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway6" id="BPMNShape_exclusivegateway6"><br> <omgdc:Bounds height="40" width="40" x="1120" y="87"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="ImpressionVerificationEmailNotification" id="BPMNShape_ImpressionVerificationEmailNotification"><br> <omgdc:Bounds height="55" width="105" x="1088" y="181"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="ImpressionVerificationUserTask" id="BPMNShape_ImpressionVerificationUserTask"><br> <omgdc:Bounds height="55" width="105" x="1088" y="280"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway7" id="BPMNShape_exclusivegateway7"><br> <omgdc:Bounds height="40" width="40" x="1230" y="287"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="ImpressionVerificationFailureEnd" id="BPMNShape_ImpressionVerificationFailureEnd"><br> <omgdc:Bounds height="35" width="35" x="1233" y="361"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="BOReportPrepServiceTask" id="BPMNShape_BOReportPrepServiceTask"><br> <omgdc:Bounds height="55" width="105" x="1278" y="80"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="DartSetup" id="BPMNShape_DartSetup"><br> <omgdc:Bounds height="55" width="105" x="180" y="80"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="DartSetupEmailNotification" id="BPMNShape_DartSetupEmailNotification"><br> <omgdc:Bounds height="55" width="105" x="308" y="184"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="exclusivegateway8" id="BPMNShape_exclusivegateway8"><br> <omgdc:Bounds height="40" width="40" x="340" y="87"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNShape bpmnElement="DartSetupFailureEnd" id="BPMNShape_DartSetupFailureEnd"><br> <omgdc:Bounds height="35" width="35" x="343" y="280"></omgdc:Bounds><br> </bpmndi:BPMNShape><br> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"><br> <omgdi:waypoint x="545" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="600" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3"><br> <omgdi:waypoint x="640" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="700" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5"><br> <omgdi:waypoint x="805" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="860" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9"><br> <omgdi:waypoint x="1478" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="1523" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow17" id="BPMNEdge_flow17"><br> <omgdi:waypoint x="880" y="127"></omgdi:waypoint><br> <omgdi:waypoint x="880" y="181"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow18" id="BPMNEdge_flow18"><br> <omgdi:waypoint x="880" y="236"></omgdi:waypoint><br> <omgdi:waypoint x="880" y="280"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow20" id="BPMNEdge_flow20"><br> <omgdi:waypoint x="1458" y="127"></omgdi:waypoint><br> <omgdi:waypoint x="1458" y="183"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow21" id="BPMNEdge_flow21"><br> <omgdi:waypoint x="1458" y="240"></omgdi:waypoint><br> <omgdi:waypoint x="1458" y="280"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow24" id="BPMNEdge_flow24"><br> <omgdi:waypoint x="620" y="127"></omgdi:waypoint><br> <omgdi:waypoint x="620" y="181"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow25" id="BPMNEdge_flow25"><br> <omgdi:waypoint x="620" y="236"></omgdi:waypoint><br> <omgdi:waypoint x="620" y="280"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow26" id="BPMNEdge_flow26"><br> <omgdi:waypoint x="828" y="307"></omgdi:waypoint><br> <omgdi:waypoint x="772" y="307"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow27" id="BPMNEdge_flow27"><br> <omgdi:waypoint x="752" y="287"></omgdi:waypoint><br> <omgdi:waypoint x="752" y="135"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow28" id="BPMNEdge_flow28"><br> <omgdi:waypoint x="752" y="327"></omgdi:waypoint><br> <omgdi:waypoint x="752" y="361"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow29" id="BPMNEdge_flow29"><br> <omgdi:waypoint x="1406" y="307"></omgdi:waypoint><br> <omgdi:waypoint x="1350" y="307"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow31" id="BPMNEdge_flow31"><br> <omgdi:waypoint x="1330" y="327"></omgdi:waypoint><br> <omgdi:waypoint x="1330" y="361"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow32" id="BPMNEdge_flow32"><br> <omgdi:waypoint x="900" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="960" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow33" id="BPMNEdge_flow33"><br> <omgdi:waypoint x="1065" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="1120" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow35" id="BPMNEdge_flow35"><br> <omgdi:waypoint x="1140" y="127"></omgdi:waypoint><br> <omgdi:waypoint x="1140" y="181"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow36" id="BPMNEdge_flow36"><br> <omgdi:waypoint x="1140" y="236"></omgdi:waypoint><br> <omgdi:waypoint x="1140" y="280"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow37" id="BPMNEdge_flow37"><br> <omgdi:waypoint x="1193" y="307"></omgdi:waypoint><br> <omgdi:waypoint x="1230" y="307"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow39" id="BPMNEdge_flow39"><br> <omgdi:waypoint x="1250" y="327"></omgdi:waypoint><br> <omgdi:waypoint x="1250" y="361"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow40" id="BPMNEdge_flow40"><br> <omgdi:waypoint x="1160" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="1278" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow41" id="BPMNEdge_flow41"><br> <omgdi:waypoint x="1383" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="1438" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow42" id="BPMNEdge_flow42"><br> <omgdi:waypoint x="1330" y="287"></omgdi:waypoint><br> <omgdi:waypoint x="1330" y="135"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow43" id="BPMNEdge_flow43"><br> <omgdi:waypoint x="1250" y="287"></omgdi:waypoint><br> <omgdi:waypoint x="1250" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="1278" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow44" id="BPMNEdge_flow44"><br> <omgdi:waypoint x="135" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="180" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow46" id="BPMNEdge_flow46"><br> <omgdi:waypoint x="285" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="340" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow47" id="BPMNEdge_flow47"><br> <omgdi:waypoint x="380" y="107"></omgdi:waypoint><br> <omgdi:waypoint x="440" y="107"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow48" id="BPMNEdge_flow48"><br> <omgdi:waypoint x="360" y="127"></omgdi:waypoint><br> <omgdi:waypoint x="360" y="184"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> <bpmndi:BPMNEdge bpmnElement="flow49" id="BPMNEdge_flow49"><br> <omgdi:waypoint x="360" y="239"></omgdi:waypoint><br> <omgdi:waypoint x="360" y="280"></omgdi:waypoint><br> </bpmndi:BPMNEdge><br> </bpmndi:BPMNPlane><br> </bpmndi:BPMNDiagram><br></definitions><br>
<br>public class ShellServiceTask implements JavaDelegate {<br><br> final static Logger logger = Logger.getLogger(ShellServiceTask.class.getName());<br><br> protected Expression command;<br> protected Expression wait;<br> protected Expression arg1;<br> protected Expression arg2;<br> protected Expression arg3;<br> protected Expression arg4;<br> protected Expression arg5;<br> protected Expression outputVariable;<br> protected Expression errorCodeVariable;<br> protected Expression redirectError;<br> protected Expression cleanEnv;<br> protected Expression directory;<br><br> String commandStr;<br> String arg1Str;<br> String arg2Str;<br> String arg3Str;<br> String arg4Str;<br> String arg5Str;<br> String waitStr;<br> String resultVariableStr;<br> String errorCodeVariableStr;<br> Boolean waitFlag;<br> Boolean redirectErrorFlag;<br> Boolean cleanEnvBoolan;<br> String directoryStr;<br><br> @Override<br> public void execute(DelegateExecution execution) throws Exception {<br> logger.info("In " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br> executeScript(execution);<br> // create a new value for execution<br> <br> logger.info("Leaving " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br><br> }<br><br> private void readFields(DelegateExecution execution) {<br> commandStr = getStringFromField(command, execution);<br> arg1Str = getStringFromField(arg1, execution);<br> arg2Str = getStringFromField(arg2, execution);<br> arg3Str = getStringFromField(arg3, execution);<br> arg4Str = getStringFromField(arg4, execution);<br> arg5Str = getStringFromField(arg5, execution);<br> waitStr = getStringFromField(wait, execution);<br> resultVariableStr = getStringFromField(outputVariable, execution);<br> errorCodeVariableStr = getStringFromField(errorCodeVariable, execution);<br><br> String redirectErrorStr = getStringFromField(redirectError, execution);<br> String cleanEnvStr = getStringFromField(cleanEnv, execution);<br><br> waitFlag = waitStr == null || waitStr.equals("true");<br> redirectErrorFlag = redirectErrorStr != null && redirectErrorStr.equals("true");<br> cleanEnvBoolan = cleanEnvStr != null && cleanEnvStr.equals("true");<br> directoryStr = getStringFromField(directory, execution);<br> }<br><br> public String toString() {<br> return "command="+command+", arg1="+arg1+", arg2="+arg2+", arg3="+arg3+", arg4="+arg4+", arg5="+arg5+<br> ", wait="+wait+", outputVariable="+outputVariable+", errorCodeVariable="+errorCodeVariable;<br> }<br> <br> public void executeScript(DelegateExecution execution) {<br> logger.info("starting execute");<br> <br> readFields(execution);<br> <br> List<String> argList = new ArrayList<String>();<br> argList.add(commandStr);<br> <br> if (arg1Str != null)<br> argList.add(arg1Str);<br> if (arg2Str != null)<br> argList.add(arg2Str);<br> if (arg3Str != null)<br> argList.add(arg3Str);<br> if (arg4Str != null)<br> argList.add(arg4Str);<br> if (arg5Str != null)<br> argList.add(arg5Str);<br> <br> ProcessBuilder processBuilder = new ProcessBuilder(argList);<br> <br> try {<br> processBuilder.redirectErrorStream(redirectErrorFlag);<br> if (cleanEnvBoolan) {<br> Map<String, String> env = processBuilder.environment();<br> env.clear();<br> }<br> <br> if (directoryStr != null && directoryStr.length() > 0)<br> processBuilder.directory(new File(directoryStr));<br> <br> Process process = processBuilder.start();<br> <br> if (waitFlag) {<br> int errorCode = process.waitFor();<br> <br> if (resultVariableStr != null) {<br> String result = convertStreamToStr(process.getInputStream());<br> execution.setVariable(resultVariableStr, result);<br> }<br> <br> if (errorCodeVariableStr != null) {<br> execution.setVariable(errorCodeVariableStr, Integer.toString(errorCode));<br> }<br><br> }<br> } catch (Exception e) {<br> logger.info("Could not execute shell command with error = " + e);<br> throw new ActivitiException("Could not execute shell command" , e);<br> }<br><br> }<br> <br> public static String convertStreamToStr(InputStream is) throws IOException {<br> if (is != null) {<br> Writer writer = new StringWriter();<br> char[] buffer = new char[1024];<br> try {<br> Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));<br> int n;<br> while ((n = reader.read(buffer)) != -1) {<br> writer.write(buffer, 0, n);<br> }<br> } finally {<br> is.close();<br> }<br> return writer.toString();<br> } else {<br> return "";<br> }<br> }<br><br> protected String getStringFromField(Expression expression, DelegateExecution execution) {<br> if (expression != null) {<br> Object value = expression.getValue(execution);<br> if (value != null) {<br> return value.toString();<br> }<br> }<br> return null;<br> }<br>}<br>
<br><bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"><br><property name="databaseType" value="oracle" /><br><property name="dataSource" ref="dataSource" /><br><property name="transactionManager" ref="hibernateTransactionManager" /><br><property name="databaseSchemaUpdate" value="false" /><br><property name="history" value="audit" /><br><property name="jobExecutorActivate" value="true" /><br><property name="jobExecutor" ref="jobExecutor"/><br></bean><br><br><bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.JobExecutor"><br><property name="corePoolSize" value="${activiti.jobExecutor.corePoolSize}"/><br><property name="lockTimeInMillis" value="${activiti.jobExecutor.lockTimeInMillis}"/><br><property name="maxJobsPerAcquisition" value="${activiti.jobExecutor.maxJobsPerAcquisition}"/><br><property name="maxPoolSize" value="${activiti.jobExecutor.maxPoolSize}"/><br><property name="queueSize" value="${activiti.jobExecutor.queueSize}"/><br><property name="waitTimeInMillis" value="${activiti.jobExecutor.waitTimeInMillis}"/><br></bean><br><br>
<br>public class ShellServiceTask implements JavaDelegate {<br><br> final static Logger logger = Logger.getLogger(ShellServiceTask.class.getName());<br><br> protected Expression command;<br> protected Expression wait;<br> protected Expression arg1;<br> protected Expression arg2;<br> protected Expression arg3;<br> protected Expression arg4;<br> protected Expression arg5;<br> protected Expression outputVariable;<br> protected Expression errorCodeVariable;<br> protected Expression redirectError;<br> protected Expression cleanEnv;<br> protected Expression directory;<br><br> String commandStr;<br> String arg1Str;<br> String arg2Str;<br> String arg3Str;<br> String arg4Str;<br> String arg5Str;<br> String waitStr;<br> String resultVariableStr;<br> String errorCodeVariableStr;<br> Boolean waitFlag;<br> Boolean redirectErrorFlag;<br> Boolean cleanEnvBoolan;<br> String directoryStr;<br><br> @Override<br> public void execute(DelegateExecution execution) throws Exception {<br> logger.info("In " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br> <br> executeScript(execution);<br> // create a new value for execution<br> <br> logger.info("Leaving " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br><br> }<br><br> private void readFields(DelegateExecution execution) {<br> commandStr = getStringFromField(command, execution);<br> arg1Str = getStringFromField(arg1, execution);<br> arg2Str = getStringFromField(arg2, execution);<br> arg3Str = getStringFromField(arg3, execution);<br> arg4Str = getStringFromField(arg4, execution);<br> arg5Str = getStringFromField(arg5, execution);<br> waitStr = getStringFromField(wait, execution);<br> resultVariableStr = getStringFromField(outputVariable, execution);<br> errorCodeVariableStr = getStringFromField(errorCodeVariable, execution);<br><br> String redirectErrorStr = getStringFromField(redirectError, execution);<br> String cleanEnvStr = getStringFromField(cleanEnv, execution);<br><br> waitFlag = waitStr == null || waitStr.equals("true");<br> redirectErrorFlag = redirectErrorStr != null && redirectErrorStr.equals("true");<br> cleanEnvBoolan = cleanEnvStr != null && cleanEnvStr.equals("true");<br> directoryStr = getStringFromField(directory, execution);<br> }<br><br> public String toString() {<br> return "command="+command+", arg1="+arg1+", arg2="+arg2+", arg3="+arg3+", arg4="+arg4+", arg5="+arg5+<br> ", wait="+wait+", outputVariable="+outputVariable+", errorCodeVariable="+errorCodeVariable;<br> }<br> <br> public void executeScript(DelegateExecution execution) {<br> logger.info("starting execute");<br> <br> readFields(execution);<br> <br> List<String> argList = new ArrayList<String>();<br> argList.add(commandStr);<br> <br> if (arg1Str != null)<br> argList.add(arg1Str);<br> if (arg2Str != null)<br> argList.add(arg2Str);<br> if (arg3Str != null)<br> argList.add(arg3Str);<br> if (arg4Str != null)<br> argList.add(arg4Str);<br> if (arg5Str != null)<br> argList.add(arg5Str);<br> <br> logger.info("Firing executor with processInstanceId = " + execution.getProcessInstanceId());<br> <br> Thread executor = new Thread(new ShellTaskThread(argList, waitFlag, redirectErrorFlag, cleanEnvBoolan, directoryStr, <br> resultVariableStr, errorCodeVariableStr, execution.getProcessInstanceId()));<br> executor.start();<br> logger.info("Executor started…leaving workflow");<br><br> }<br> <br> protected String getStringFromField(Expression expression, DelegateExecution execution) {<br> if (expression != null) {<br> Object value = expression.getValue(execution);<br> if (value != null) {<br> return value.toString();<br> }<br> }<br> return null;<br> }<br>}<br><br>class ShellTaskThread implements Runnable { <br> final static Logger logger = Logger.getLogger(ShellTaskThread.class.getName()); <br> <br> List<String> commands;<br> boolean waitFlag;<br> String resultVariableStr;<br> String errorCodeVariableStr;<br> boolean cleanEnv;<br> boolean redirectErrorFlag;<br> String directoryStr;<br> String processId;<br><br> public ShellTaskThread(List<String> commands, boolean waitFlag, boolean redirectErrorFlag, <br> boolean cleanEnv, String directoryStr,<br> String resultVariableStr, String errorCodeVariableStr, String processId) {<br> this.commands = commands;<br> this.waitFlag = waitFlag;<br> this.resultVariableStr = resultVariableStr;<br> this.errorCodeVariableStr = errorCodeVariableStr;<br> this.redirectErrorFlag = redirectErrorFlag;<br> this.cleanEnv = cleanEnv;<br> this.directoryStr = directoryStr;<br> this.processId = processId;<br> }<br><br> @Override<br> public void run() {<br><br> logger.info("running async thread with command: " + commands);<br> logger.info("other vars: resultVariableStr: " + resultVariableStr + " errorCodeVariableStr: " + <br> errorCodeVariableStr + " processId: " + processId);<br> <br> // set activiti context<br> ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();<br> RuntimeService runtimeService = processEngine.getRuntimeService();<br> Execution execution = runtimeService.createExecutionQuery().processInstanceId(processId).singleResult();<br><br> logger.info("execution = " + execution.getId() + ": " + execution.getProcessInstanceId());<br> ProcessBuilder processBuilder = new ProcessBuilder(commands);<br> <br> try {<br> processBuilder.redirectErrorStream(redirectErrorFlag);<br> if (cleanEnv) {<br> Map<String, String> env = processBuilder.environment();<br> env.clear();<br> }<br> <br> if (directoryStr != null && directoryStr.length() > 0)<br> processBuilder.directory(new File(directoryStr));<br> <br> Process process = processBuilder.start();<br> <br> if (waitFlag) {<br> try {<br> int errorCode = process.waitFor();<br> logger.info("errorCode = " + errorCode);<br> <br> if (resultVariableStr != null) {<br> String result = convertStreamToStr(process.getInputStream());<br> runtimeService.setVariable(execution.getId(), resultVariableStr, result);<br> }<br> <br> if (errorCodeVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), errorCodeVariableStr, Integer.toString(errorCode));<br> }<br> } catch (InterruptedException e) {<br> if (resultVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), resultVariableStr, e);<br> }<br> if (errorCodeVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), errorCodeVariableStr, "1");<br> }<br> <br> throw e;<br> }<br><br> }<br> <br> } catch (Exception e) {<br> logger.info("Could not execute shell command " + commands + " with error = " + e);<br> } finally {<br> logger.info("Leaving thread with process variables = " + runtimeService.getVariables(execution.getId()));<br> runtimeService.signal(execution.getId());<br> }<br> }<br> <br> public static String convertStreamToStr(InputStream is) throws IOException {<br> if (is != null) {<br> Writer writer = new StringWriter();<br> char[] buffer = new char[1024];<br> try {<br> Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));<br> int n;<br> while ((n = reader.read(buffer)) != -1) {<br> writer.write(buffer, 0, n);<br> }<br> } finally {<br> is.close();<br> }<br> return writer.toString();<br> } else {<br> return "";<br> }<br> }<br><br>}
Note: there will be only one instance of that Java class created for the serviceTask it is defined on. All process-instances share the same class instance that will be used to call execute(DelegateExecution). This means that the class must not use any member variables and must be thread-safe, since it can be executed simultaneously from different threads. This also influences the way Field injection is handled.
<br>public class ShellServiceTask implements JavaDelegate {<br><br> final static Logger logger = Logger.getLogger(ShellServiceTask.class.getName());<br><br> protected Expression command;<br> protected Expression wait;<br> protected Expression arg1;<br> protected Expression arg2;<br> protected Expression arg3;<br> protected Expression arg4;<br> protected Expression arg5;<br> protected Expression outputVariable;<br> protected Expression errorCodeVariable;<br> protected Expression redirectError;<br> protected Expression cleanEnv;<br> protected Expression directory;<br><br> @Override<br> public void execute(DelegateExecution execution) throws Exception {<br> logger.info("In " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br> String commandStr = getStringFromField(command, execution);<br> String arg1Str = getStringFromField(arg1, execution);<br> String arg2Str = getStringFromField(arg2, execution);<br> String arg3Str = getStringFromField(arg3, execution);<br> String arg4Str = getStringFromField(arg4, execution);<br> String arg5Str = getStringFromField(arg5, execution);<br> String waitStr = getStringFromField(wait, execution);<br> String resultVariableStr = getStringFromField(outputVariable, execution);<br> String errorCodeVariableStr = getStringFromField(errorCodeVariable, execution);<br><br> String redirectErrorStr = getStringFromField(redirectError, execution);<br> String cleanEnvStr = getStringFromField(cleanEnv, execution);<br> String directoryStr = getStringFromField(directory, execution);<br> <br> Boolean waitFlag = waitStr == null || waitStr.equals("true");<br> Boolean redirectErrorFlag = redirectErrorStr != null && redirectErrorStr.equals("true");<br> Boolean cleanEnvBoolean = cleanEnvStr != null && cleanEnvStr.equals("true");<br><br> // Build commands for shell command<br> List<String> argList = new ArrayList<String>();<br> argList.add(commandStr);<br> <br> if (arg1Str != null)<br> argList.add(arg1Str);<br> if (arg2Str != null)<br> argList.add(arg2Str);<br> if (arg3Str != null)<br> argList.add(arg3Str);<br> if (arg4Str != null)<br> argList.add(arg4Str);<br> if (arg5Str != null)<br> argList.add(arg5Str);<br> <br> // Start async thread<br> logger.info("Firing executor with processInstanceId = " + execution.getProcessInstanceId());<br> <br> Thread executor = new Thread(new ShellTaskThread(argList, waitFlag, redirectErrorFlag, cleanEnvBoolean, directoryStr, <br> resultVariableStr, errorCodeVariableStr, execution.getProcessInstanceId()));<br> executor.start();<br> logger.info("Executor started…leaving workflow");<br> <br> logger.info("Leaving " + command.getValue(execution) + " ShellTask script with variables = " + execution.getVariables());<br><br> }<br><br> public String toString() {<br> return "command="+command+", arg1="+arg1+", arg2="+arg2+", arg3="+arg3+", arg4="+arg4+", arg5="+arg5+<br> ", wait="+wait+", outputVariable="+outputVariable+", errorCodeVariable="+errorCodeVariable;<br> }<br> <br> protected String getStringFromField(Expression expression, DelegateExecution execution) {<br> if (expression != null) {<br> Object value = expression.getValue(execution);<br> if (value != null) {<br> return value.toString();<br> }<br> }<br> return null;<br> }<br>}<br><br>class ShellTaskThread implements Runnable { <br> final static Logger logger = Logger.getLogger(ShellTaskThread.class.getName()); <br> <br> List<String> command;<br> boolean waitFlag;<br> String resultVariableStr;<br> String errorCodeVariableStr;<br> boolean cleanEnv;<br> boolean redirectErrorFlag;<br> String directoryStr;<br> String processId;<br><br> public ShellTaskThread(List<String> command, boolean waitFlag, boolean redirectErrorFlag, <br> boolean cleanEnv, String directoryStr,<br> String resultVariableStr, String errorCodeVariableStr, String processId) {<br> this.command = command;<br> this.waitFlag = waitFlag;<br> this.resultVariableStr = resultVariableStr;<br> this.errorCodeVariableStr = errorCodeVariableStr;<br> this.redirectErrorFlag = redirectErrorFlag;<br> this.cleanEnv = cleanEnv;<br> this.directoryStr = directoryStr;<br> this.processId = processId;<br> }<br><br> @Override<br> public void run() {<br><br> logger.info("running async thread with command: " + command);<br> logger.info("other vars: resultVariableStr: " + resultVariableStr + " errorCodeVariableStr: " + <br> errorCodeVariableStr + " processId: " + processId);<br> <br> // set activiti context<br> ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();<br> RuntimeService runtimeService = processEngine.getRuntimeService();<br> Execution execution = runtimeService.createExecutionQuery().processInstanceId(processId).singleResult();<br><br> logger.info("execution = " + execution.getId() + ": " + execution.getProcessInstanceId());<br> ProcessBuilder processBuilder = new ProcessBuilder(command);<br> <br> try {<br> processBuilder.redirectErrorStream(redirectErrorFlag);<br> if (cleanEnv) {<br> Map<String, String> env = processBuilder.environment();<br> env.clear();<br> }<br> <br> if (directoryStr != null && directoryStr.length() > 0)<br> processBuilder.directory(new File(directoryStr));<br> <br> Process process = processBuilder.start();<br> <br> if (waitFlag) {<br> try {<br> int errorCode = process.waitFor();<br> logger.info("errorCode = " + errorCode);<br> <br> if (resultVariableStr != null) {<br> String result = convertStreamToStr(process.getInputStream());<br> runtimeService.setVariable(execution.getId(), resultVariableStr, result);<br> }<br> <br> if (errorCodeVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), errorCodeVariableStr, Integer.toString(errorCode));<br> }<br> } catch (InterruptedException e) {<br> if (resultVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), resultVariableStr, e);<br> }<br> if (errorCodeVariableStr != null) {<br> runtimeService.setVariable(execution.getId(), errorCodeVariableStr, "1");<br> }<br> <br> throw e;<br> }<br><br> }<br> <br> } catch (Exception e) {<br> logger.info("Could not execute shell command " + command + " with error = " + e);<br> } finally {<br> logger.info("Leaving thread with process variables = " + runtimeService.getVariables(execution.getId()));<br> runtimeService.signal(execution.getId());<br> }<br> }<br> <br> public static String convertStreamToStr(InputStream is) throws IOException {<br> if (is != null) {<br> Writer writer = new StringWriter();<br> char[] buffer = new char[1024];<br> try {<br> Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));<br> int n;<br> while ((n = reader.read(buffer)) != -1) {<br> writer.write(buffer, 0, n);<br> }<br> } finally {<br> is.close();<br> }<br> return writer.toString();<br> } else {<br> return "";<br> }<br> }<br><br>}<br>
<br> ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();<br> RuntimeService runtimeService = processEngine.getRuntimeService();<br> Execution execution = runtimeService.createExecutionQuery().processInstanceId(processId).singleResult();<br>