2016-03-28 14 views
1

Aşağıdaki ders çalışmasında olduğu gibi jbpm örneğinde çalışıyorum https://docs.jboss.org/jbpm/v5.3/userguide/ch.quickstarts.html#d0e1137 fakat set kullanıcı değişkeninde komut dosyası işleminde sorun yaşıyorum, bu yüzden aşağıdaki iletiyi alıyorum
com/innvo/Process_com $ u46 $ innvo $ U46 $ U46 $ Drools_Work_Flow_Example421421234.java (16: 701): kullanıcı kullanıcıyaJbpmm'de betik görevini değişken olarak ayarlayın

System.out.println(user.getName()); 

BPMN kodu

yazdırmak için değişken

public static void main(String arg[]){ 

     User user=new User(); 
     user.setName("123123"); 
     user.setMail("456456"); 
     KieServices ks = KieServices.Factory.get(); 
     KieContainer kContainer = ks.getKieClasspathContainer(); 
     KieSession kSession = kContainer.newKieSession("ksession-process"); 
     Map<String, Object> params=new HashMap<String,Object>(); 
     params.put("user", user); 
     kSession.startProcess("com.innvo", params); 

    } 

komut dosyası görev koduna çözülemeyen

<?xml version="1.0" encoding="UTF-8"?> 
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" 
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" 
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" 
xmlns:di="http://www.omg.org/spec/DD/20100524/DI" 
xmlns:g="http://www.jboss.org/drools/flow/gpd" 
xmlns:tns="http://www.jboss.org/drools" xmlns="http://www.jboss.org 
/drools" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL 
BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org 
/schemas/1.0 bpsim.xsd" id="Definition" 
expressionLanguage="http://www.mvel.org/2.0" 
targetNamespace="http://www.jboss.org/drools" 
typeLanguage="http://www.java.com/javaTypes"> 
<bpmn2:process id="com.innvo.drools" tns:version="1" 
tns:packageName="com.innvo.drools" tns:adHoc="false" name="Drools Work 
Flow Example" isExecutable="true" processType="Private"> 
<bpmn2:extensionElements> 
    <tns:import name="org.kie.api.runtime.ObjectFilter"/> 
    <tns:import name="java.util.ArrayList"/> 
    <tns:import name="java.util.List"/> 
    <tns:import name="com.innvo.domain.Score"/> 
    <tns:import name="org.kie.api.runtime.rule.FactHandle"/> 
    <tns:import name="com.innvo.drools.ScoreService"/> 
</bpmn2:extensionElements> 
<bpmn2:startEvent id="_1" name=""> 
    <bpmn2:outgoing>_1-_jbpm-unique-6</bpmn2:outgoing> 
</bpmn2:startEvent> 
<bpmn2:sequenceFlow id="_1-_jbpm-unique-6" tns:priority="1" name="" 
sourceRef="_1" targetRef="ScriptTask_1"/> 
<bpmn2:scriptTask id="ScriptTask_1" name="Script Task 1" 
scriptFormat="http://www.java.com/java"> 
    <bpmn2:incoming>_1-_jbpm-unique-6</bpmn2:incoming> 
    <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> 
    <bpmn2:script>kcontext.setVariable(&quot;scoreRouteRulefile&quot;, 
    &quot;scoreRouteRulefile&quot;); 
    System.out.println(scoreRouteRulefile);</bpmn2:script> 
</bpmn2:scriptTask> 
<bpmn2:sequenceFlow id="SequenceFlow_1" tns:priority="1" name="" 
sourceRef="ScriptTask_1" targetRef="_jbpm-unique-6"/> 
<bpmn2:endEvent id="_3" name=""> 
    <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> 
    <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1"/> 
</bpmn2:endEvent> 
<bpmn2:businessRuleTask id="_jbpm-unique-6" tns:ruleFlowGroup="" 
g:ruleFlowGroup="Group1" name="rule"> 
    <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> 
    <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> 
    <bpmn2:ioSpecification id="InputOutputSpecification_1"> 
    <bpmn2:inputSet id="InputSet_1"/> 
    <bpmn2:outputSet id="OutputSet_1"/> 
    </bpmn2:ioSpecification> 
</bpmn2:businessRuleTask> 
<bpmn2:sequenceFlow id="SequenceFlow_2" tns:priority="1" name="" 
    sourceRef="_jbpm-unique-6" targetRef="_3"/> 
</bpmn2:process> 
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> 
<bpmndi:BPMNPlane id="BPMNPlane_Process_1" bpmnElement="com.innvo.drools"> 
    <bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="_1"> 
    <dc:Bounds height="48.0" width="48.0" x="75.0" y="133.0"/> 
    </bpmndi:BPMNShape> 
    <bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="_3"> 
    <dc:Bounds height="48.0" width="48.0" x="590.0" y="133.0"/> 
    </bpmndi:BPMNShape> 
    <bpmndi:BPMNShape id="BPMNShape_ScriptTask_1" 
     bpmnElement="ScriptTask_1"> 
    <dc:Bounds height="50.0" width="110.0" x="220.0" y="132.0"/> 
    </bpmndi:BPMNShape> 
    <bpmndi:BPMNShape id="BPMNShape_BusinessRuleTask_1" bpmnElement="_jbpm- 
     unique-6"> 
    <dc:Bounds height="48.0" width="80.0" x="420.0" y="133.0"/> 
    </bpmndi:BPMNShape> 
    <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="_1-_jbpm- 
    unique-6" sourceElement="BPMNShape_StartEvent_1" 
    targetElement="BPMNShape_ScriptTask_1"> 
    <di:waypoint xsi:type="dc:Point" x="123.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="216.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="216.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="220.0" y="157.0"/> 
    </bpmndi:BPMNEdge> 
    <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" 
    bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_ScriptTask_1" 
    targetElement="BPMNShape_BusinessRuleTask_1"> 
    <di:waypoint xsi:type="dc:Point" x="330.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="406.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="406.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="420.0" y="157.0"/> 
    </bpmndi:BPMNEdge> 
    <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" 
bpmnElement="SequenceFlow_2" 
    sourceElement="BPMNShape_BusinessRuleTask_1" 
     targetElement="BPMNShape_EndEvent_1"> 
    <di:waypoint xsi:type="dc:Point" x="500.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="570.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="570.0" y="157.0"/> 
    <di:waypoint xsi:type="dc:Point" x="590.0" y="157.0"/> 
    </bpmndi:BPMNEdge> 
</bpmndi:BPMNPlane> 
</bpmndi:BPMNDiagram> 
</bpmn2:definitions> 

cevap

1

Bildiğim kadarıyla gördüğünüz gibi

(sizin süreç tanımı scoreRouteRulefile kullanıyor olsa bile, benim cevap olarak User ve user kullanacağız) kullanarak, birlikte sürecinde tanımlanmış bir değişken yok user adı ve User yazın. Bir işlem örneğini başlattığınızda parametreleri göndermek bunları otomatik olarak süreç değişkenleri olarak ayarlamaz. Yapmanız gereken, argüman user anahtarının ve aynı nesnenin geçtiği (User) aynı adı taşıyan bir değişken eklemek. jbpm-designer'de çalışıyorsanız, işlemin arka planını tıklayın ve nitelik paletine gidin. Orada işlemin değişkenlerinin tanımı olan bir özellik bulacaksınız.

Yardım edin,

İlgili konular